1#!/bin/bash 2 3[ -z "$TOPDIR" ] && TOPDIR="$(pwd)" 4 5trap 'kill $(jobs -p) 2>/dev/null; exit 1' INT 6 7rm -rf generated/testdir 8mkdir -p generated/testdir/testdir 9 10if [ -z "$TEST_HOST" ] 11then 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 18fi 19 20cd generated/testdir 21PATH="$PWD:$PATH" 22cd testdir 23export 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 28if [ $# -ne 0 ] 29then 30 for i in "$@" 31 do 32 . "$TOPDIR"/tests/$i.test 33 done 34else 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 46fi 47