run-tests.sh 1.94 KB
Newer Older
Daniel Barlow's avatar
Daniel Barlow committed
1 2
#!/bin/sh

3 4 5 6 7 8 9

if [ -z "$2" ]; then
    scripts="*.script"
else
    scripts="$2"
fi

10 11
sok=1

12
do_tests() {
13
rm *.$2 || true
14 15 16 17 18 19
( cd .. && echo '(load "test/compile-asdf.lisp")' | $1  )
if [ $? -eq 0 ] ; then
    test_count=0
    test_pass=0
    test_fail=0
    failed_list=""
20
    for i in $scripts ; 
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
    do 
      echo "Testing: $i" >&2
      test_count=`expr "$test_count" + 1`
      rm *.$2 || true
      if $1 < $i ;then
        echo "Using $1, $i passed" >&2
	test_pass=`expr "$test_pass" + 1`
      else
        echo "Using $1, $i failed" >&2
	test_fail=`expr "$test_fail" + 1`
	failed_list="$failed_list $i"
        sok=0
      fi
    done
    echo >&2
    echo "Using $1" >&2
    echo "Ran $test_count tests: " >&2
    echo "  $test_pass passing and $test_fail failing" >&2
    if [ $test_fail -eq 0 ] ; then
	echo "all tests apparently successful" >&2
    else
	echo "failing test(s): $failed_list" >&2
    fi
    echo >&2
fi
46 47 48 49 50 51 52
}

# do_tests {lisp invocation} {fasl extension}
# - read lisp forms one at a time from standard input
# - quit with exit status 0 on getting eof
# - quit with exit status >0 if an unhandled error occurs

53
# terminate on error
54 55
set -e

56 57 58
lisp=$1
if [ -z $1 ] ; then
    lisp="sbcl"
59 60
fi

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
if [ "$lisp" = "sbcl" ] ; then 
    if type sbcl ; then
      fasl_ext="fasl"
      command="sbcl --userinit /dev/null --sysinit /dev/null --noprogrammer"
    fi
elif [ "$lisp" = "clisp" ] ; then
    if type clisp ; then
	fasl_ext="fas"
	command=`where clisp`
	command="$command -norc -ansi -I - "
    fi
elif [ "$lisp" = "allegro" ] ; then
    if type alisp ; then
	fasl_ext="fasl"
	command="alisp -q --batch "
    fi
77 78 79 80 81
elif [ "$lisp" = "allegromodern" ] ; then
    if type mlisp ; then
	fasl_ext="fasl"
	command="mlisp -q --batch "
    fi
82 83
fi

84 85 86 87 88 89 90 91 92 93 94 95

#if [ -x /usr/bin/lisp ]
#then 
#  do_tests "/usr/bin/lisp -batch -noinit" x86f
#fi


if [ -z "$command" ] ; then
    echo "Error: don't know how to run Lisp named $lisp"
else
    echo $command
    do_tests "$command" $fasl_ext
96
fi
97