diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-07-14 16:07:13 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-07-14 16:07:13 +0200 |
commit | 44362a1086b778efb47b7c64a8ed38db5f82d0ae (patch) | |
tree | 2db022a7c6e8c4a1b8c424dfc85b75de764bfb3e /test-suite | |
parent | c4b681fdacc57de0b2a9584c1f6a195cf2629b32 (diff) | |
download | guile-44362a1086b778efb47b7c64a8ed38db5f82d0ae.tar.gz |
Fix tests that assumed little endian.
* test-suite/tests/asm-to-bytecode.test (u32->u8-list): New procedure.
("compiler")[(load-program 3 2 1 0 () 3 #f (make-int8 3) (return)),
(load-program 3 2 1 0 () 3 (load-program 3 2 1 0 ...))]: Make these
tests work on hosts whose endianness is not little endian.
Diffstat (limited to 'test-suite')
-rw-r--r-- | test-suite/tests/asm-to-bytecode.test | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/test-suite/tests/asm-to-bytecode.test b/test-suite/tests/asm-to-bytecode.test index 1c2a5994b..01ba84687 100644 --- a/test-suite/tests/asm-to-bytecode.test +++ b/test-suite/tests/asm-to-bytecode.test @@ -15,6 +15,7 @@ ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA (define-module (test-suite tests asm-to-bytecode) + #:use-module (rnrs bytevector) #:use-module (test-suite lib) #:use-module (system vm instruction) #:use-module (language assembly compile-bytecode)) @@ -45,6 +46,14 @@ (lambda () (equal? v y))))) +(define (u32->u8-list x) + ;; Return a 4 uint8 list corresponding to the host's native representation + ;; of X, a uint32. + (let ((bv (make-bytevector 4))) + (bytevector-u32-native-set! bv 0 x) + (bytevector->u8-list bv))) + + (with-test-prefix "compiler" (with-test-prefix "asm-to-bytecode" @@ -75,22 +84,30 @@ (comp-test '(load-keyword "qux") (vector 'load-keyword 0 0 3 (char->integer #\q) (char->integer #\u) (char->integer #\x))) - - ;; fixme: little-endian test. + (comp-test '(load-program 3 2 1 0 () 3 #f (make-int8 3) (return)) - (vector 'load-program 3 2 1 0 3 0 0 0 0 0 0 0 - (instruction->opcode 'make-int8) 3 - (instruction->opcode 'return))) + (list->vector + `(load-program + 3 2 1 0 ;; nargs, nrest, nlocs, nexts + ,@(u32->u8-list 3) ;; len + ,@(u32->u8-list 0) ;; metalen + make-int8 3 + return))) - ;; fixme: little-endian test. (comp-test '(load-program 3 2 1 0 () 3 (load-program 3 2 1 0 () 3 #f (make-int8 3) (return)) (make-int8 3) (return)) - (vector 'load-program 3 2 1 0 3 0 0 0 (+ 3 12) 0 0 0 - (instruction->opcode 'make-int8) 3 - (instruction->opcode 'return) - 3 2 1 0 3 0 0 0 0 0 0 0 - (instruction->opcode 'make-int8) 3 - (instruction->opcode 'return))))) + (list->vector + `(load-program + 3 2 1 0 ;; nargs, nrest, nlocs, nexts + ,@(u32->u8-list 3) ;; len + ,@(u32->u8-list (+ 3 12)) ;; metalen + make-int8 3 + return + 3 2 1 0 ;; nargs, nrest, nlocs, nexts + ,@(u32->u8-list 3) ;; len + ,@(u32->u8-list 0) ;; metalen + make-int8 3 + return))))) |