X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=177d170089b833904ce44eaf1ae71f474609e26a;hb=a189a69454ef7635149319ae213b337f17c50d20;hp=ee78f512b5caf3d41fc17a654fdbdf3e6aada295;hpb=9cbb7f9b3a418314ffcd8f2cb0448278d2b6f812;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index ee78f51..177d170 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -1,6 +1,7 @@ #!/bin/sh -# tests related to foreign function interface and LOAD-FOREIGN +# tests related to foreign function interface and loading of shared +# libraries # This software is part of the SBCL system. See the README file for # more information. @@ -8,46 +9,379 @@ # While most of SBCL is derived from the CMU CL system, the test # files (like this one) were written from scratch after the fork # from CMU CL. -# +# # This software is in the public domain and is provided with # absolutely no warranty. See the COPYING and CREDITS files for # more information. +. ./expect.sh +. ./subr.sh + +use_test_subdirectory + echo //entering foreign.test.sh -testfilestem=${TMPDIR:-/tmp}/sbcl-foreign-test-$$ - -# Make a little shared object file to test with. -echo 'int summish(int x, int y) { return 1 + x + y; }' > $testfilestem.c -cc -c $testfilestem.c -o $testfilestem.o -ld -shared -o $testfilestem.so $testfilestem.o - -# Test interaction with the shared object file. -${SBCL:-sbcl} < $TEST_FILESTEM.c < $TEST_FILESTEM-b.c +echo 'int bar() { return 42; }' >> $TEST_FILESTEM-b.c +build_so $TEST_FILESTEM-b + +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;' > $TEST_FILESTEM-c.c +echo 'int late_bar() { return 14; }' >> $TEST_FILESTEM-c.c +build_so $TEST_FILESTEM-c + +## Foreign definitions & load + +cat > $TEST_FILESTEM.base.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 > $TEST_FILESTEM.test.lisp < $TEST_FILESTEM.addr.heap.c < $TEST_FILESTEM.alien.enum.lisp <