From: Richard M Kreuter Date: Fri, 28 Dec 2007 19:46:57 +0000 (+0000) Subject: 1.0.13.1: Various cleanups and touchups in tests/ X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=a42922aef908a1b45ae5420d51b2ca7ee1bafb9e;p=sbcl.git 1.0.13.1: Various cleanups and touchups in tests/ * Tests written in shell modified to use shell functions, rather than variables, so that tests written in shell can run when the build directory's absolute pathname contains whitespace (as home directories might tend to on Windows). * tests/subr.sh: new file, with some shell functions, variables, and settings to support the above. Files in the test suite written in shell should source this file. * Factored code for creating and cleaning up temporary directories for tests written in shell that touch the file system. Test scripts written in shell should now call "use_test_subdirectory" to create and chdir to a test directory, and the shell should clean out the test directory at exit time. * Most tests written in shell now quote filenames that derive from the truename of the current working directory or from an environment variable, as such names may contain whitespace. (Variables set to non-offending constant strings in the script itself need not be quoted this way.) * tests/filesys.test.sh was not prepared to deal with a TRUENAME that resolves all symbolic links in a pathname, as a soon-to-be-committed TRUENAME will; "/tmp" on MacOSX is a symbolic link to "/private/tmp". POSIX pwd(1) takes a -P option to resolve symbolic links in the working directory's path, so we'll try that. * Tests now supply --no-userinit, --no-sysinit arguments, so that we don't need to conditionalize these for win32. * Some tests written in shell changed from using --eval to heredocs, which allows the Lisp code the be formatted nicer and avoids some shell quotation headaches (not all, of course). * Minor shell errors corrected in some tests. Notable example: program; if [ $? != $value ]; then echo failed $?; fi Because "[" is a child process, after the test $? is set to the exit status of the "["; the exit status of "program" is lost. --- diff --git a/sbcl-pwd.sh b/sbcl-pwd.sh index ceded1e..a835689 100644 --- a/sbcl-pwd.sh +++ b/sbcl-pwd.sh @@ -5,9 +5,9 @@ sbcl_pwd() { if [ "$OSTYPE" = "cygwin" ] ; then - SBCL_PWD=`cygpath -m "$(pwd)"` + SBCL_PWD="`cygpath -m \"$(pwd)\"`" else - SBCL_PWD=`pwd` + SBCL_PWD="`pwd`" fi export SBCL_PWD } diff --git a/tests/clocc-ansi.test.sh b/tests/clocc-ansi.test.sh index 87be861..1e4cba9 100644 --- a/tests/clocc-ansi.test.sh +++ b/tests/clocc-ansi.test.sh @@ -25,17 +25,18 @@ # absolutely no warranty. See the COPYING and CREDITS files for # more information. -# Remember where we came from so we can find local support files later. -originalpwd=`pwd` +. ./subr.sh # Find clocc ansi-test (or just punt, returning success). +set +u if [ "$SBCL_CLOCC_ANSI_TEST" = "" ] ; then echo //punting clocc ansi-test because SBCL_CLOCC_ANSI_TEST is undefined - exit 104 + exit $EXIT_TEST_WIN else echo //going on to run clocc ansi-test in $SBCL_CLOCC_ANSI_TEST cd $SBCL_CLOCC_ANSI_TEST fi +set -u # The condition system is for the weak. tmpprefix="${TMPDIR:-/tmp}/sbcl-clocc-ansi-test-$$" @@ -43,10 +44,10 @@ rawfilename="$tmpprefix-raw.tmp" bugsfilename="$tmpprefix-bugs.tmp" # Go SBCL go. -$SBCL <$rawfilename +run_sbcl <$rawfilename (in-package :cl-user) ;;; Tell ansi-test about our known bugs. -(load "$originalpwd/clocc-ansi-test-known-bugs.lisp") +(load "$SBCL_PWD/clocc-ansi-test-known-bugs.lisp") ;;; Actually run ansi-test. (load "tests.lisp") ;;; Return a special status code to show that we reached the end diff --git a/tests/clos.test.sh b/tests/clos.test.sh index 47e91a8..9f8d4e1 100644 --- a/tests/clos.test.sh +++ b/tests/clos.test.sh @@ -13,9 +13,9 @@ . ./expect.sh -base_tmpfilename="clos-test-$$-tmp" -tmpfilename="$base_tmpfilename.lisp" -compiled_tmpfilename="$base_tmpfilename.fasl" +use_test_subdirectory + +tmpfilename="$TEST_FILESTEM.lisp" # This should fail, but didn't until sbcl-0.6.12.7, with Martin # Atzmueller's port of Pierre Mai's fixes. @@ -69,8 +69,5 @@ cat > $tmpfilename < $tmpfilename < # # diagnosed and fixed by Dan Barlow in sbcl-0.7.7.29 -$SBCL <"$tmpoutput" \ - --no-userinit --no-sysinit --eval '(quit :unix-status 71)' -if [ $? != 71 ]; then - echo "failure in banner suppression: $?" +./"$tmpcore" > "$tmpoutput" --no-userinit --no-sysinit --noprint < $testdir/test-1.tmp -echo this is a test > $testdir/test-2.tmp -echo this is a test > $testdir/wild\?test.tmp -cd $testdir -ln -s $testdir dirlinktest +echo this is a test > test-1.tmp +echo this is a test > test-2.tmp +echo this is a test > wild?test.tmp + +ln -s "$testdir" dirlinktest ln -s test-1.tmp link-1 -ln -s `pwd`/test-2.tmp link-2 +ln -s "$testdir/test-2.tmp" link-2 ln -s i-do-not-exist link-3 ln -s link-4 link-4 ln -s link-5 link-6 -ln -s `pwd`/link-6 link-5 -expected_truenames=\ -"'(#p\"$testdir/\"\ - #p\"$testdir/link-3\"\ - #p\"$testdir/link-4\"\ - #p\"$testdir/link-5\"\ - #p\"$testdir/link-6\"\ - #p\"$testdir/test-1.tmp\"\ - #p\"$testdir/test-2.tmp\"\ - #p\"$testdir/wild\\\\?test.tmp\")" -$SBCL < /dev/null & +run_sbcl < /dev/null & (defvar *tmp* 0.0) (defvar *count* 0) @@ -48,11 +50,11 @@ while true; do if [ -f finalize-test-passed ]; then echo "OK" rm finalize-test-passed - exit 104 # Success + exit $EXIT_TEST_WIN elif [ -f finalize-test-failed ]; then echo "Failed" rm finalize-test-failed - exit 1 # Failure + exit $EXIT_LOSE fi sleep 1 WAITED="x$WAITED" @@ -60,7 +62,7 @@ while true; do echo echo "timeout, killing SBCL" kill -9 $SBCL_PID - exit 1 # Failure, SBCL probably hanging in GC + exit $EXIT_LOSE # Failure, SBCL probably hanging in GC fi done diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index 039d121..034deef 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -14,25 +14,26 @@ # absolutely no warranty. See the COPYING and CREDITS files for # more information. +. ./subr.sh +use_test_subdirectory + echo //entering foreign.test.sh # simple way to make sure we're not punting by accident: # setting PUNT to anything other than 104 will make non-dlopen # and non-linkage-table platforms fail this -PUNT=104 - -testfiledir=sbcl-foreign-test-$$ -testfilestem=`pwd`/$testfiledir/sbcl-foreign-test +PUNT=$EXIT_TEST_WIN -mkdir $testfiledir ## Make some shared object files to test with. -build_so() { +build_so() ( echo building $1.so - if [ "`uname -m`" = x86_64 -o "`uname -m`" = amd64 -o \ - "`uname -m`" = mips -o "`uname -m`" = mips64 ]; then - CFLAGS="$CFLAGS -fPIC" - fi + set +u + case "`uname -m`" in + x86_64|amd64|mips|mips64) + CFLAGS="$CFLAGS -fPIC" + ;; + esac if [ "`uname`" = Darwin ]; then SO_FLAGS="-bundle" else @@ -40,9 +41,12 @@ build_so() { fi cc -c $1.c -o $1.o $CFLAGS ld $SO_FLAGS -o $1.so $1.o -} +) + +# We want to bail out in case any of these Unix programs fails. +set -e -cat > $testfilestem.c < $TEST_FILESTEM.c < $testfilestem-b.c -echo 'int bar() { return 42; }' >> $testfilestem-b.c -build_so $testfilestem-b +echo 'int foo = 13;' > $TEST_FILESTEM-b.c +echo 'int bar() { return 42; }' >> $TEST_FILESTEM-b.c +build_so $TEST_FILESTEM-b -echo 'int foo = 42;' > $testfilestem-b2.c -echo 'int bar() { return 13; }' >> $testfilestem-b2.c -build_so $testfilestem-b2 +echo 'int foo = 42;' > $TEST_FILESTEM-b2.c +echo 'int bar() { return 13; }' >> $TEST_FILESTEM-b2.c +build_so $TEST_FILESTEM-b2 -echo 'int late_foo = 43;' > $testfilestem-c.c -echo 'int late_bar() { return 14; }' >> $testfilestem-c.c -build_so $testfilestem-c +echo 'int late_foo = 43;' > $TEST_FILESTEM-c.c +echo 'int late_bar() { return 14; }' >> $TEST_FILESTEM-c.c +build_so $TEST_FILESTEM-c ## Foreign definitions & load -cat > $testfilestem.base.lisp < $TEST_FILESTEM.base.lisp < $testfilestem.base.lisp < $testfilestem.base.lisp < $testfilestem.fast.lisp -cat $testfilestem.base.lisp >> $testfilestem.fast.lisp +echo "(declaim (optimize speed))" > $TEST_FILESTEM.fast.lisp +cat $TEST_FILESTEM.base.lisp >> $TEST_FILESTEM.fast.lisp -echo "(declaim (optimize space))" > $testfilestem.small.lisp -cat $testfilestem.base.lisp >> $testfilestem.small.lisp +echo "(declaim (optimize space))" > $TEST_FILESTEM.small.lisp +cat $TEST_FILESTEM.base.lisp >> $TEST_FILESTEM.small.lisp # Test code -cat > $testfilestem.test.lisp < $TEST_FILESTEM.test.lisp < $testfilestem.test.lisp < $testfilestem.test.lisp <$testfilename < $testfile -if [ "`grep -c FOO::BAR $testfile`" != 1 ] ; then +run_sbcl --eval "(defpackage :foo)" --eval "(print 'foo::bar)" \ + < /dev/null > $TEST_FILESTEM +if [ "`grep -c FOO::BAR $TEST_FILESTEM`" != 1 ] ; then echo failed DEFPACKAGE-then-PRINT from --eval form - exit 1 + exit $EXIT_LOSE fi +exit $EXIT_TEST_WIN \ No newline at end of file diff --git a/tests/undefined-classoid-bug.test.sh b/tests/undefined-classoid-bug.test.sh index ad05e77..1a030f7 100644 --- a/tests/undefined-classoid-bug.test.sh +++ b/tests/undefined-classoid-bug.test.sh @@ -1,26 +1,28 @@ # This file run a regression test for a bug in loading # forward-referenced layouts. +. ./subr.sh + +use_test_subdirectory + FILES='"undefined-classoid-bug-1.lisp" "undefined-classoid-bug-2.lisp"' FASLS='"undefined-classoid-bug-1.fasl" "undefined-classoid-bug-2.fasl"' -${SBCL:-sbcl} <