X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=177d170089b833904ce44eaf1ae71f474609e26a;hb=a189a69454ef7635149319ae213b337f17c50d20;hp=2f1f40587689f3efb1c6a66d0ff6d1bad8351818;hpb=874586929c175a28728a632d4b2123365bd63851;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index 2f1f405..177d170 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -14,32 +14,29 @@ # absolutely no warranty. See the COPYING and CREDITS files for # more information. +. ./expect.sh +. ./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 -o "`uname -m`" = amd64 ]; then - CFLAGS="$CFLAGS -fPIC" - fi - if [ "`uname`" = Darwin ]; then - SO_FLAGS="-bundle" - else - SO_FLAGS="-shared" - fi - cc -c $1.c -o $1.o $CFLAGS - ld $SO_FLAGS -o $1.so $1.o -} + /bin/sh ../run-compiler.sh -sbcl-pic -sbcl-shared "$1.c" -o "$1.so" +) -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.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 < $testfilestem.test.lisp < $TEST_FILESTEM.addr.heap.c < $TEST_FILESTEM.alien.enum.lisp <