Update of /cvsroot/sbcl/sbcl/tests
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv19109/tests
22.214.171.124: Integer callback result fixes.
* Callback results should be typechecked based on their declared
type, but stored as if they were the full width of a machine register.
* Fixed sb-alien::alien-callback-lisp-wrapper-lambda to make this
* Updated corresponding tests (formerly callback.impure.lisp /
sign-extension and underflow-detection) to cover 16-bit cases, which
would have broken on all targets, not merely 64-bit targets.
* As a minor side note, assistance in testing the changes in 126.96.36.199
was provided by one Andreas Selfjord Eriksen, but I forgot to note this
fact in the commit message. Mea Culpa.
RCS file: /cvsroot/sbcl/sbcl/tests/callback.impure.lisp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- callback.impure.lisp 4 Aug 2006 14:34:46 -0000 1.15
+++ callback.impure.lisp 21 May 2010 01:03:25 -0000 1.16
@@ -134,20 +134,29 @@
(sb-alien::alien-lambda void ()
-;;; tests for a sign extension problem in callback argument handling on x86-64
+;;; tests for integer-width problems in callback result handling
-(defvar *add-two-ints* (sb-alien::alien-callback (function int int int) #'+))
+ (sb-alien::alien-callback (function int int int) #'+))
+ (sb-alien::alien-callback (function short short short) #'+))
-(with-test (:name :sign-extension)
- (assert (= (alien-funcall *add-two-ints* #x-80000000 1) -2147483647)))
+;;; The original test cases here were what are now (:int-result
+;;; :sign-extension) and (:int-result :underflow-detection), the latter
+;;; of which would fail on 64-bit platforms. Upon further investigation,
+;;; it turned out that the same tests with a SHORT return type instead of
+;;; an INT return type would also fail on 32-bit platforms.
-;;; On x86 This'll signal a TYPE-ERROR "The value -2147483649 is not of type
-;;; (SIGNED-BYTE 32)". On x86-64 it'll wrap around to 2147483647, probably
-;;; due to the sign-extension done by the (INTEGER :NATURALIZE-GEN)
-;;; alien-type-method. I believe the former behaviour is the one we want.
-;;; -- JES, 2005-10-16
+(with-test (:name (:short-result :sign-extension))
+ (assert (= (alien-funcall *add-two-shorts* #x-8000 1) -32767)))
-(with-test (:name :underflow-detection :fails-on :x86-64)
+(with-test (:name (:short-result :underflow-detection))
+ (assert (raises-error? (alien-funcall *add-two-shorts* #x-8000 -1))))
+(with-test (:name (:int-result :sign-extension))
+ (assert (= (alien-funcall *add-two-ints* #x-80000000 1) -2147483647)))
+(with-test (:name (:int-result :underflow-detection))
(assert (raises-error? (alien-funcall *add-two-ints* #x-80000000 -1))))
;;; tests for handling 64-bit arguments - this was causing problems on