1 #!/bin/bash 2 3 [ -z "$TOPDIR" ] && TOPDIR="$(pwd)" 4 5 trap 'kill $(jobs -p) 2>/dev/null; exit 1' INT 6 7 rm -rf generated/testdir 8 mkdir -p generated/testdir/testdir 9 10 if [ -z "$TEST_HOST" ] 11 then 12 if [ $# -ne 0 ] 13 then 14 PREFIX=generated/testdir/ scripts/single.sh "$@" || exit 1 15 else 16 make install_flat PREFIX=generated/testdir || exit 1 17 fi 18 fi 19 20 cd generated/testdir 21 PATH="$PWD:$PATH" 22 cd testdir 23 export LC_COLLATE=C 24 25 . "$TOPDIR"/scripts/runtest.sh 26 [ -f "$TOPDIR/generated/config.h" ] && export OPTIONFLAGS=:$(echo $(sed -nr 's/^#define CFG_(.*) 1/\1/p' "$TOPDIR/generated/config.h") | sed 's/ /:/g') 27 28 if [ $# -ne 0 ] 29 then 30 for i in "$@" 31 do 32 . "$TOPDIR"/tests/$i.test 33 done 34 else 35 for i in "$TOPDIR"/tests/*.test 36 do 37 CMDNAME="$(echo "$i" | sed 's@.*/\(.*\)\.test@\1@')" 38 if [ -h ../$CMDNAME ] || [ ! -z "$TEST_HOST" ] 39 then 40 cd .. && rm -rf testdir && mkdir testdir && cd testdir || exit 1 41 . $i 42 else 43 echo "$CMDNAME disabled" 44 fi 45 done 46 fi 47