X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=6e761335d3e8df4f5dd6b1eaca77a74e3b90414d;hb=60053af56e69de2fd251cde8fcdb2ea7f01d0b01;hp=045d36bb63f1e900d40a3665d6645df8459570bf;hpb=4e6200853a661da5e73d0843a4afca9077a06fa8;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index 045d36b..6e76133 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -14,22 +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 - -testfilestem=${TMPDIR:-/tmp}/sbcl-foreign-test-$$ +PUNT=$EXIT_TEST_WIN ## Make some shared object files to test with. -build_so() { +build_so() ( echo building $1.so - if [ "`uname -m`" = x86_64 ]; 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 @@ -37,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.def.lisp < $TEST_FILESTEM.base.lisp < $testfilestem.def.lisp < $testfilestem.def.lisp < $TEST_FILESTEM.fast.lisp +cat $TEST_FILESTEM.base.lisp >> $TEST_FILESTEM.fast.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 < $TEST_FILESTEM.addr.heap.c <