X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=039d1210f576fc49d74d437b78c2fc4dbc0a0d5a;hb=6a0601ab48635465ad3400c290e5cfbca28e5367;hp=b5176bde7494c0641c08db8acdd9987072a30ba2;hpb=5827ad0e60f034bff35ff1986aa5227ed88eef45;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index b5176bd..039d121 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. @@ -21,30 +21,83 @@ echo //entering foreign.test.sh # and non-linkage-table platforms fail this PUNT=104 -testfilestem=${TMPDIR:-/tmp}/sbcl-foreign-test-$$ +testfiledir=sbcl-foreign-test-$$ +testfilestem=`pwd`/$testfiledir/sbcl-foreign-test -## Make a little shared object files to test with. +mkdir $testfiledir +## Make some shared object files to test with. build_so() { echo building $1.so - if [ "$(uname -m)" = x86_64 ]; then + if [ "`uname -m`" = x86_64 -o "`uname -m`" = amd64 -o \ + "`uname -m`" = mips -o "`uname -m`" = mips64 ]; then CFLAGS="$CFLAGS -fPIC" fi - if [ "$(uname)" = Darwin ]; then + 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 + ld $SO_FLAGS -o $1.so $1.o +} + +cat > $testfilestem.c < $testfilestem.c -echo 'int numberish = 42;' >> $testfilestem.c -echo 'int nummish(int x) { return numberish + x; }' >> $testfilestem.c -echo 'short negative_short() { return -1; }' >> $testfilestem.c -echo 'int negative_int() { return -2; }' >> $testfilestem.c -echo 'long negative_long() { return -3; }' >> $testfilestem.c + +long long return_long_long() { + return powish(2,33); +} +EOF + build_so $testfilestem echo 'int foo = 13;' > $testfilestem-b.c @@ -61,7 +114,7 @@ build_so $testfilestem-c ## Foreign definitions & load -cat > $testfilestem.def.lisp < $testfilestem.base.lisp < $testfilestem.def.lisp < $testfilestem.def.lisp < $testfilestem.def.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.test.lisp < $testfilestem.test.lisp <