X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=40ed2aea64e5c5e5b823f9ceb52316172a38fd59;hb=2fb5b174f6acb88a85c86aa4cd753ddefaccc987;hp=aac8a705dbba82c1e400bf613266dd4abaf1fa6d;hpb=4919f9971429d18fab618b9b49e164c6b57bea6f;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index aac8a70..40ed2ae 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -9,7 +9,7 @@ # 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. @@ -25,21 +25,39 @@ testfilestem=${TMPDIR:-/tmp}/sbcl-foreign-test-$$ ## Make a little shared object files to test with. +build_so() { + echo building $1.so + if [ "$(uname -m)" = x86_64 ]; 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 +} + echo 'int summish(int x, int y) { return 1 + x + y; }' > $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 +echo 'short negative_short() { return -1; }' >> $testfilestem.c +echo 'int negative_int() { return -2; }' >> $testfilestem.c +echo 'long negative_long() { return -3; }' >> $testfilestem.c +build_so $testfilestem + +echo 'int foo = 13;' > $testfilestem-b.c +echo 'int bar() { return 42; }' >> $testfilestem-b.c +build_so $testfilestem-b -echo 'int foo = 13;' > $testfilestem-foobar.c -echo 'int bar() { return 42; }' >> $testfilestem-foobar.c -cc -c $testfilestem-foobar.c -o $testfilestem-foobar.o -ld -shared -o $testfilestem-foobar.so $testfilestem-foobar.o +echo 'int foo = 42;' > $testfilestem-b2.c +echo 'int bar() { return 13; }' >> $testfilestem-b2.c +build_so $testfilestem-b2 -echo 'int foo = 42;' > $testfilestem-foobar2.c -echo 'int bar() { return 13; }' >> $testfilestem-foobar2.c -cc -c $testfilestem-foobar2.c -o $testfilestem-foobar2.o -ld -shared -o $testfilestem-foobar2.so $testfilestem-foobar2.o +echo 'int late_foo = 43;' > $testfilestem-c.c +echo 'int late_bar() { return 14; }' >> $testfilestem-c.c +build_so $testfilestem-c ## Foreign definitions & load @@ -50,7 +68,7 @@ cat > $testfilestem.def.lisp < $testfilestem.def.lisp < $testfilestem.test.lisp <