X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=177d170089b833904ce44eaf1ae71f474609e26a;hb=31f68584d0732dc0d17f379773e5f87f1e5a78ad;hp=eaa3b4b8d7d1de0410184b9575e5701b6e55b063;hpb=2481b0d0f223640c43032f75b689608f8fa332db;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index eaa3b4b..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,54 +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-$$ - -# FIXME: At least on OpenBSD, the "make $testfilestem.o" puts the -# output file into the current directory, instead of the -# target directory. E.g. "make /tmp/foo.o" causes "./foo.o" to be -# created (!). Since OpenBSD doesn't support LOAD-FOREIGN, this -# doesn't matter much, since it punts with UNSUPPORTED-OPERATOR -# instead of not finding the file. But it'd be nice to straighten -# this out, if only so that sbcl-foreign-test-*.o clutter -# doesn't pile up in this directory. Maybe some time when I have -# several test machines at hand to check the behavior of different -# versions of "make"... -echo 'int summish(int x, int y) { return 1 + x + y; }' > $testfilestem.c -make $testfilestem.o -ld -shared -o $testfilestem.so $testfilestem.o - -${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 <