X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=2f1f40587689f3efb1c6a66d0ff6d1bad8351818;hb=fe9173b98a9ddeb703a98b89f38ee7115c1b6717;hp=ac7ebcc296824f51b1959df62ef994c062a0434a;hpb=75b52379bdc2269961af6a1308eca63610f38ac3;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index ac7ebcc..2f1f405 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. @@ -23,74 +23,310 @@ PUNT=104 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 -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 +## Make some shared object files to test with. + +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 +} + +cat > $testfilestem.c < $testfilestem.deflisp < $testfilestem-b.c +echo 'int bar() { return 42; }' >> $testfilestem-b.c +build_so $testfilestem-b + +echo 'int foo = 42;' > $testfilestem-b2.c +echo 'int bar() { return 13; }' >> $testfilestem-b2.c +build_so $testfilestem-b2 + +echo 'int late_foo = 43;' > $testfilestem-c.c +echo 'int late_bar() { return 14; }' >> $testfilestem-c.c +build_so $testfilestem-c + +## Foreign definitions & load + +cat > $testfilestem.base.lisp < $testfilestem.fast.lisp +cat $testfilestem.base.lisp >> $testfilestem.fast.lisp + +echo "(declaim (optimize space))" > $testfilestem.small.lisp +cat $testfilestem.base.lisp >> $testfilestem.small.lisp + # Test code -cat > $testfilestem.testlisp < $testfilestem.test.lisp <