X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fforeign.test.sh;h=bd91bfe5dd3db4d8214a628adec40ab05061aa24;hb=c3334d2307b721cfcea29e6abcd33e48487fb1ea;hp=ac7ebcc296824f51b1959df62ef994c062a0434a;hpb=75b52379bdc2269961af6a1308eca63610f38ac3;p=sbcl.git diff --git a/tests/foreign.test.sh b/tests/foreign.test.sh index ac7ebcc..bd91bfe 100644 --- a/tests/foreign.test.sh +++ b/tests/foreign.test.sh @@ -23,27 +23,54 @@ PUNT=104 testfilestem=${TMPDIR:-/tmp}/sbcl-foreign-test-$$ -# Make a little shared object file to test with. +## Make a little shared object files to test with. + +build_so() { + echo building $1.so + if [ $(uname -p) = x86_64 ]; then + CFLAGS="$CFLAGS -fPIC" + fi + cc -c $1.c -o $1.o $CFLAGS + ld -shared -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 +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 = 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.deflisp < $testfilestem.def.lisp < $testfilestem.deflisp < $testfilestem.testlisp < $testfilestem.test.lisp <