Add framework for setting component values in the inspector. Add the ability to destr...
[sbcl/lichteblau.git] / tests / foreign.test.sh
blobee78f512b5caf3d41fc17a654fdbdf3e6aada295
1 #!/bin/sh
3 # tests related to foreign function interface and LOAD-FOREIGN
5 # This software is part of the SBCL system. See the README file for
6 # more information.
8 # While most of SBCL is derived from the CMU CL system, the test
9 # files (like this one) were written from scratch after the fork
10 # from CMU CL.
12 # This software is in the public domain and is provided with
13 # absolutely no warranty. See the COPYING and CREDITS files for
14 # more information.
16 echo //entering foreign.test.sh
18 testfilestem=${TMPDIR:-/tmp}/sbcl-foreign-test-$$
20 # Make a little shared object file to test with.
21 echo 'int summish(int x, int y) { return 1 + x + y; }' > $testfilestem.c
22 cc -c $testfilestem.c -o $testfilestem.o
23 ld -shared -o $testfilestem.so $testfilestem.o
25 # Test interaction with the shared object file.
26 ${SBCL:-sbcl} <<EOF
27 (handler-case
28 (load-foreign '("$testfilestem.so"))
29 (sb-int:unsupported-operator ()
30 ;; At least as of sbcl-0.7.0.5, LOAD-FOREIGN isn't supported
31 ;; on every OS. In that case, there's nothing to test, and we
32 ;; can just fall through to success.
33 (sb-ext:quit :unix-status 52))) ; success convention for Lisp program
34 (define-alien-routine summish int (x int) (y int))
35 (assert (= (summish 10 20) 31))
36 (sb-ext:quit :unix-status 52) ; success convention for Lisp program
37 EOF
38 if [ $? != 52 ]; then
39 echo test failed: $?
40 exit 1
43 # FIXME: I rewrote the handling of ENV/ENVIRONMENT arguments for
44 # LOAD-FOREIGN, but I can't think of a nice way to test it. (Kent Beck
45 # would cry. If he didn't keel over on the spot and then commence
46 # rolling over in his grave.:-) It would be good to make a test case
47 # for it..
49 echo //cleanup: removing $testfilestem.*
50 rm $testfilestem.*
52 # success convention for script
53 exit 104