1 2os=$(uname) 3 4case $os in 5 FreeBSD) libdl=;; 6 Linux) libdl=-ldl;; 7 Haiku) libdl=;; 8 *) echo "Unsupported OS: $os"; exit 1;; 9esac 10 11testdir=${testdir-testdir}/$(basename $0) 12 13rm -rf $testdir 14mkdir -p $testdir 15cd $testdir 16 17# test_run_ok <program> <expected return value> 18test_run_ok() 19{ 20 # exists? 21 if [ ! -f $1 ]; then 22 exit 1 23 fi 24 25 # run 26 $1 27 retval=$? 28 if [ $retval != $2 ]; then 29 echo "test_run_ok: $1: return value: $retval, expected: $2" 30 exit 1 31 fi 32} 33