# The testing function
-testing ()
+testing()
{
NAME="$1"
[ -z "$1" ] && NAME=$2
# the file is assumed to already be there and only its library dependencies
# are copied.
-function mkchroot
+mkchroot()
{
[ $# -lt 2 ] && return
# Needed commands listed on command line
# Script fed to stdin.
-function dochroot
+dochroot()
{
mkdir tmpdir4chroot
mount -t ramfs tmpdir4chroot tmpdir4chroot
[ -z "$TOPDIR" ] && TOPDIR="$(pwd)"
-rm -rf testdir
-mkdir -p testdir/testdir
+trap 'kill $(jobs -p) 2>/dev/null; exit 1' INT
+
+rm -rf generated/testdir
+mkdir -p generated/testdir/testdir
if [ -z "$TEST_HOST" ]
then
if [ $# -ne 0 ]
then
- PREFIX=testdir/ scripts/single.sh "$@" || exit 1
+ PREFIX=generated/testdir/ scripts/single.sh "$@" || exit 1
else
- make install_flat PREFIX=testdir || exit 1
+ make install_flat PREFIX=generated/testdir || exit 1
fi
fi
-cd testdir
+cd generated/testdir
PATH="$PWD:$PATH"
cd testdir
-. "$TOPDIR"/scripts/test/testing.sh
+. "$TOPDIR"/scripts/runtest.sh
[ -f "$TOPDIR/generated/config.h" ] && export OPTIONFLAGS=:$(echo $(sed -nr 's/^#define CFG_(.*) 1/\1/p' "$TOPDIR/generated/config.h") | sed 's/ /:/g')
if [ $# -ne 0 ]
then
for i in "$@"
do
- . "$TOPDIR"/scripts/test/$i.test
+ . "$TOPDIR"/tests/$i.test
done
else
- for i in "$TOPDIR"/scripts/test/*.test
+ for i in "$TOPDIR"/tests/*.test
do
CMDNAME="$(echo "$i" | sed 's@.*/\(.*\)\.test@\1@')"
if [ -h ../$CMDNAME ] || [ ! -z "$TEST_HOST" ]
#testing "name" "command" "result" "infile" "stdin"
-BDIR="$TOPDIR/scripts/test/blkid"
+BDIR="$TOPDIR/tests/blkid"
bzcat "$BDIR"/squashfs.bz2 > temp.img
testing "blkid file" "blkid temp.img" 'temp.img: TYPE="squashfs"\n' "" ""