Bug 1333011: Update wasm spec import script and reimports a few tests; r=luke

MozReview-Commit-ID: DmoXe8EuY1Y

--HG--
extra : rebase_source : 574fd70bc772fa8e8ab748454ac53212e6e1bb16
extra : histedit_source : a82670b06df83380607755c3728a1c5d024dd6fd
This commit is contained in:
Benjamin Bouvier 2017-01-23 11:27:50 +01:00
parent 297fc63b6e
commit 4f5ef495e2
4 changed files with 107 additions and 14 deletions

View File

@ -99,11 +99,57 @@
(module
(import "spectest" "global" (global i32))
)
(assert_malformed (module "\00asm\0d\00\00\00\02\94\80\80\80\00\01\08\73\70\65\63\74\65\73\74\06\67\6c\6f\62\61\6c\03\7f\02") "invalid mutability")
(assert_malformed
(module
"\00asm" "\0d\00\00\00"
"\02\94\80\80\80\00" ;; import section
"\01" ;; length 1
"\08\73\70\65\63\74\65\73\74" ;; "spectest"
"\06\67\6c\6f\62\61\6c" ;; "global"
"\03" ;; GlobalImport
"\7f" ;; i32
"\02" ;; invalid mutability
)
"invalid mutability"
)
(assert_malformed
(module
"\00asm" "\0d\00\00\00"
"\02\94\80\80\80\00" ;; import section
"\01" ;; length 1
"\08\73\70\65\63\74\65\73\74" ;; "spectest"
"\06\67\6c\6f\62\61\6c" ;; "global"
"\03" ;; GlobalImport
"\7f" ;; i32
"\ff" ;; invalid mutability
)
"invalid mutability"
)
(module
(global i32 (i32.const 0))
)
(assert_malformed (module "\00asm\0d\00\00\00\06\86\80\80\80\00\01\7f\ff\41\00\0b") "invalid mutability")
(assert_malformed (module "\00asm\0d\00\00\00\06\86\80\80\80\00\01\7f\d4\41\00\0b") "invalid mutability")
(assert_malformed (module "\00asm\0d\00\00\00\06\86\80\80\80\00\01\7f\02\41\00\0b") "invalid mutability")
(assert_malformed
(module
"\00asm" "\0d\00\00\00"
"\06\86\80\80\80\00" ;; global section
"\01" ;; length 1
"\7f" ;; i32
"\02" ;; invalid mutability
"\41\00" ;; i32.const 0
"\0b" ;; end
)
"invalid mutability"
)
(assert_malformed
(module
"\00asm" "\0d\00\00\00"
"\06\86\80\80\80\00" ;; global section
"\01" ;; length 1
"\7f" ;; i32
"\ff" ;; invalid mutability
"\41\00" ;; i32.const 0
"\0b" ;; end
)
"invalid mutability"
)

View File

@ -3,7 +3,7 @@
rm -rf ./*.wast ./*.wast.js
git clone https://github.com/WebAssembly/spec spec
mv spec/interpreter/test/*.wast ./
mv spec/test/core/*.wast ./
rm -rf spec/
# TODO not handled yet

View File

@ -28,9 +28,11 @@
(type $func_f64 (func (param f64)))
(import "spectest" "print" (func (param i32)))
(func (import "spectest" "print") (param i64))
;; JavaScript can't handle i64 yet.
;; (func (import "spectest" "print") (param i64))
(import "spectest" "print" (func $print_i32 (param i32)))
(import "spectest" "print" (func $print_i64 (param i64)))
;; JavaScript can't handle i64 yet.
;; (import "spectest" "print" (func $print_i64 (param i64)))
(import "spectest" "print" (func $print_f32 (param f32)))
(import "spectest" "print" (func $print_f64 (param f64)))
(import "spectest" "print" (func $print_i32_f32 (param i32 f32)))
@ -58,7 +60,8 @@
(func (export "print64") (param $i i64)
(local $x f64)
(set_local $x (f64.convert_s/i64 (call $i64->i64 (get_local $i))))
(call 1 (get_local $i))
;; JavaScript can't handle i64 yet.
;; (call 1 (get_local $i))
(call $print_f64_f64
(f64.add (get_local $x) (f64.const 1))
(f64.const 53)
@ -191,8 +194,8 @@
(import "spectest" "global" (global $x i32))
(global $y (import "spectest" "global") i32)
;; limitation of the spidermonkey testing mode (an imported global can't be both a number and i64).
;;(import "spectest" "global" (global i64))
;; JavaScript can't handle i64 yet.
;; (import "spectest" "global" (global i64))
(import "spectest" "global" (global f32))
(import "spectest" "global" (global f64))

View File

@ -158,17 +158,39 @@
(assert_unlinkable
(module
(func $host (import "spectest" "print"))
(table (import "Mt" "tab") 10 anyfunc)
(memory (import "Mt" "mem") 1) ;; does not exist
(elem (i32.const 7) $own)
(elem (i32.const 9) $host)
(func $own (result i32) (i32.const 666))
(func $f (result i32) (i32.const 0))
(elem (i32.const 7) $f)
(elem (i32.const 9) $f)
)
"unknown import"
)
(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized")
(assert_unlinkable
(module
(table (import "Mt" "tab") 10 anyfunc)
(func $f (result i32) (i32.const 0))
(elem (i32.const 7) $f)
(elem (i32.const 12) $f) ;; out of bounds
)
"elements segment does not fit"
)
(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized")
(assert_unlinkable
(module
(table (import "Mt" "tab") 10 anyfunc)
(func $f (result i32) (i32.const 0))
(elem (i32.const 7) $f)
(memory 1)
(data (i32.const 0x10000) "d") ;; out of bounds
)
"data segment does not fit"
)
(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized")
;; Memories
@ -239,3 +261,25 @@
"unknown import"
)
(assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0))
(assert_unlinkable
(module
(memory (import "Mm" "mem") 1)
(data (i32.const 0) "abc")
(data (i32.const 0x50000) "d") ;; out of bounds
)
"data segment does not fit"
)
(assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0))
(assert_unlinkable
(module
(memory (import "Mm" "mem") 1)
(data (i32.const 0) "abc")
(table 0 anyfunc)
(func)
(elem (i32.const 0) 0) ;; out of bounds
)
"elements segment does not fit"
)
(assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0))