X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=177d170089b833904ce44eaf1ae71f474609e26a;hb=HEAD;hp=593412a68728ddc5a5b6693b320d0d51e1b3cd1f;hpb=8902b8b6bd2e9285749dd39d313b33b6c69c5213;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index 593412a..177d170 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -9,88 +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 # 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 +PUNT=$EXIT_TEST_WIN + +## Make some shared object files to test with. + +build_so() ( + echo building $1.so + /bin/sh ../run-compiler.sh -sbcl-pic -sbcl-shared "$1.c" -o "$1.so" +) + +# We want to bail out in case any of these Unix programs fails. +set -e + +cat > $TEST_FILESTEM.c < $testfilestem.c -echo 'int numberish = 42;' >> $testfilestem.c -echo 'int nummish(int x) { return numberish + x; }' >> $testfilestem.c -cc -c $testfilestem.c -o $testfilestem.o -ld -shared -o $testfilestem.so $testfilestem.o +int long_sap_test2(int *p1, int i1, long long l1) { + return (l1 == (3 + powish(2,*p1))); +} -# Foreign definitions & load -cat > $testfilestem.deflisp < $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 > $testfilestem.testlisp < $TEST_FILESTEM.test.lisp < $TEST_FILESTEM.addr.heap.c < $TEST_FILESTEM.alien.enum.lisp <