projects
/
sbcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
0.8.21.34:
[sbcl.git]
/
tests
/
foreign.test.sh
diff --git
a/tests/foreign.test.sh
b/tests/foreign.test.sh
index
7d207b4
..
2d7865f
100644
(file)
--- a/
tests/foreign.test.sh
+++ b/
tests/foreign.test.sh
@@
-26,14
+26,25
@@
testfilestem=${TMPDIR:-/tmp}/sbcl-foreign-test-$$
## Make a little shared object files to test with.
build_so() {
## Make a little shared object files to test with.
build_so() {
- echo building $1.so
- cc -c $1.c -o $1.o
- ld -shared -o $1.so $1.o
+ 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
}
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
+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
build_so $testfilestem
echo 'int foo = 13;' > $testfilestem-b.c
@@
-69,6
+80,10
@@
cat > $testfilestem.def.lisp <<EOF
(define-alien-variable "foo" int)
(define-alien-routine "bar" int)
(define-alien-variable "foo" int)
(define-alien-routine "bar" int)
+ (define-alien-routine "negative_short" short)
+ (define-alien-routine "negative_int" int)
+ (define-alien-routine "negative_long" long)
+
;; Test that loading an object file didn't screw up our records
;; of variables visible in runtime. (This was a bug until
;; Nikodemus Siivola's patch in sbcl-0.8.5.50.)
;; Test that loading an object file didn't screw up our records
;; of variables visible in runtime. (This was a bug until
;; Nikodemus Siivola's patch in sbcl-0.8.5.50.)
@@
-83,7
+98,7
@@
cat > $testfilestem.def.lisp <<EOF
(lambda (condition hook)
(print (list :debugger-hook condition))
(let ((cont (find-restart 'continue condition)))
(lambda (condition hook)
(print (list :debugger-hook condition))
(let ((cont (find-restart 'continue condition)))
- (when cont
+ (when cont
(invoke-restart cont)))
(print :fell-through)
(invoke-debugger condition)))
(invoke-restart cont)))
(print :fell-through)
(invoke-debugger condition)))
@@
-97,6
+112,10
@@
cat > $testfilestem.test.lisp <<EOF
(assert (= 13 numberish))
(assert (= 14 (nummish 1)))
(assert (= 13 numberish))
(assert (= 14 (nummish 1)))
+ (assert (= -1 (negative-short)))
+ (assert (= -2 (negative-int)))
+ (assert (= -3 (negative-long)))
+
(print :stage-1)
;; test realoading object file with new definitions
(print :stage-1)
;; test realoading object file with new definitions