Skip to content

Commit

Permalink
Update repos
Browse files Browse the repository at this point in the history
  spec:
    WebAssembly/spec@a2196ec8
  simd:
    WebAssembly/simd@634be58a

This change was automatically generated by `update-testsuite.sh`
  • Loading branch information
Mark McCaskey committed Feb 9, 2021
1 parent c11a37f commit e3c0884
Show file tree
Hide file tree
Showing 44 changed files with 29,869 additions and 2,367 deletions.
21 changes: 21 additions & 0 deletions tests/wast/spec/address.wast
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@
(assert_return (invoke "32_good4" (i32.const 65508)) (i32.const 0))
(assert_trap (invoke "32_good5" (i32.const 65508)) "out of bounds memory access")

(assert_trap (invoke "8u_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "8s_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "16u_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "16s_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "32_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "32_good3" (i32.const -1)) "out of bounds memory access")

(assert_trap (invoke "8u_bad" (i32.const 0)) "out of bounds memory access")
(assert_trap (invoke "8s_bad" (i32.const 0)) "out of bounds memory access")
(assert_trap (invoke "16u_bad" (i32.const 0)) "out of bounds memory access")
Expand Down Expand Up @@ -478,6 +485,14 @@
(assert_return (invoke "64_good4" (i32.const 65504)) (i64.const 0))
(assert_trap (invoke "64_good5" (i32.const 65504)) "out of bounds memory access")

(assert_trap (invoke "8u_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "8s_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "16u_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "16s_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "32u_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "32s_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "64_good3" (i32.const -1)) "out of bounds memory access")

(assert_trap (invoke "8u_bad" (i32.const 0)) "out of bounds memory access")
(assert_trap (invoke "8s_bad" (i32.const 0)) "out of bounds memory access")
(assert_trap (invoke "16u_bad" (i32.const 0)) "out of bounds memory access")
Expand Down Expand Up @@ -538,6 +553,9 @@
(assert_return (invoke "32_good4" (i32.const 65525)) (f32.const 0.0))
(assert_trap (invoke "32_good5" (i32.const 65525)) "out of bounds memory access")

(assert_trap (invoke "32_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "32_good3" (i32.const -1)) "out of bounds memory access")

(assert_trap (invoke "32_bad" (i32.const 0)) "out of bounds memory access")
(assert_trap (invoke "32_bad" (i32.const 1)) "out of bounds memory access")

Expand Down Expand Up @@ -585,5 +603,8 @@
(assert_return (invoke "64_good4" (i32.const 65511)) (f64.const 0.0))
(assert_trap (invoke "64_good5" (i32.const 65511)) "out of bounds memory access")

(assert_trap (invoke "64_good3" (i32.const -1)) "out of bounds memory access")
(assert_trap (invoke "64_good3" (i32.const -1)) "out of bounds memory access")

(assert_trap (invoke "64_bad" (i32.const 0)) "out of bounds memory access")
(assert_trap (invoke "64_bad" (i32.const 1)) "out of bounds memory access")
40 changes: 39 additions & 1 deletion tests/wast/spec/binary-leb128.wast
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@
"\41\00" ;; i32.const 0
"\41\03" ;; i32.const 3
"\36" ;; i32.store
"\03" ;; alignment 2
"\02" ;; alignment 2
"\82\80\80\80\10" ;; offset 2 with unused bits set
"\0b" ;; end
)
Expand Down Expand Up @@ -961,3 +961,41 @@
)
"integer too large"
)


(module binary
"\00asm" "\01\00\00\00"
"\01\04\01" ;; type section
"\60\00\00" ;; empty function type
"\03\02\01" ;; function section
"\00" ;; function 0, type 0
"\0a\1b\01\19" ;; code section
"\00" ;; no locals
"\00" ;; unreachable
"\fc\80\00" ;; i32_trunc_sat_f32_s with 2 bytes
"\00" ;; unreachable
"\fc\81\80\00" ;; i32_trunc_sat_f32_u with 3 bytes
"\00" ;; unreachable
"\fc\86\80\80\00" ;; i64_trunc_sat_f64_s with 4 bytes
"\00" ;; unreachable
"\fc\87\80\80\80\00" ;; i64_trunc_sat_f64_u with 5 bytes
"\00" ;; unreachable
"\0b" ;; end
)

(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01\04\01" ;; type section
"\60\00\00" ;; empty function type
"\03\02\01" ;; function section
"\00" ;; function 0, type 0
"\0a\0d\01\0b" ;; code section
"\00" ;; no locals
"\00" ;; unreachable
"\fc\87\80\80\80\80\00" ;; i64_trunc_sat_f64_u with 6 bytes
"\00" ;; unreachable
"\0b" ;; end
)
"integer representation too long"
)
232 changes: 207 additions & 25 deletions tests/wast/spec/binary.wast
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@
(assert_malformed (module binary "\00asm\00\00\01\00") "unknown binary version")
(assert_malformed (module binary "\00asm\00\00\00\01") "unknown binary version")

;; Invalid section id.
(assert_malformed (module binary "\00asm" "\01\00\00\00" "\0c\00") "malformed section id")
(assert_malformed (module binary "\00asm" "\01\00\00\00" "\7f\00") "malformed section id")
(assert_malformed (module binary "\00asm" "\01\00\00\00" "\80\00\01\00") "malformed section id")
(assert_malformed (module binary "\00asm" "\01\00\00\00" "\81\00\01\00") "malformed section id")
(assert_malformed (module binary "\00asm" "\01\00\00\00" "\ff\00\01\00") "malformed section id")


;; Type section with signed LEB128 encoded type
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01" ;; Type section id
"\05" ;; Type section length
"\01" ;; Types vector length
"\e0\7f" ;; Malformed functype, -0x20 in signed LEB128 encoding
"\00\00"
)
"integer representation too long"
)


;; call_indirect reserved byte equal to zero.
(assert_malformed
Expand Down Expand Up @@ -329,7 +350,24 @@
"zero flag expected"
)

;; No more than 2^32 locals.
;; Local number is unsigned 32 bit
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01\04\01\60\00\00" ;; Type section
"\03\02\01\00" ;; Function section
"\0a\0c\01" ;; Code section

;; function 0
"\0a\02"
"\80\80\80\80\10\7f" ;; 0x100000000 i32
"\02\7e" ;; 0x00000002 i64
"\0b" ;; end
)
"integer too large"
)

;; No more than 2^32-1 locals.
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
Expand All @@ -346,6 +384,24 @@
"too many locals"
)

(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01\06\01\60\02\7f\7f\00" ;; Type section: (param i32 i32)
"\03\02\01\00" ;; Function section
"\0a\1c\01" ;; Code section

;; function 0
"\1a\04"
"\80\80\80\80\04\7f" ;; 0x40000000 i32
"\80\80\80\80\04\7e" ;; 0x40000000 i64
"\80\80\80\80\04\7d" ;; 0x40000000 f32
"\80\80\80\80\04\7c" ;; 0x40000000 f64
"\0b" ;; end
)
"too many locals"
)

;; Local count can be 0.
(module binary
"\00asm" "\01\00\00\00"
Expand Down Expand Up @@ -450,6 +506,71 @@
"\02\01\00" ;; import count can be zero
)

;; Malformed import kind
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\02\04\01" ;; import section with single entry
"\00" ;; string length 0
"\00" ;; string length 0
"\04" ;; malformed import kind
)
"malformed import kind"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\02\05\01" ;; import section with single entry
"\00" ;; string length 0
"\00" ;; string length 0
"\04" ;; malformed import kind
"\00" ;; dummy byte
)
"malformed import kind"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\02\04\01" ;; import section with single entry
"\00" ;; string length 0
"\00" ;; string length 0
"\05" ;; malformed import kind
)
"malformed import kind"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\02\05\01" ;; import section with single entry
"\00" ;; string length 0
"\00" ;; string length 0
"\05" ;; malformed import kind
"\00" ;; dummy byte
)
"malformed import kind"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\02\04\01" ;; import section with single entry
"\00" ;; string length 0
"\00" ;; string length 0
"\80" ;; malformed import kind
)
"malformed import kind"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\02\05\01" ;; import section with single entry
"\00" ;; string length 0
"\00" ;; string length 0
"\80" ;; malformed import kind
"\00" ;; dummy byte
)
"malformed import kind"
)

;; 2 import declared, 1 given
(assert_malformed
(module binary
Expand Down Expand Up @@ -510,6 +631,37 @@
"unexpected end of section or function"
)

;; Malformed table limits flag
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\05\03\01" ;; table section with one entry
"\70" ;; anyfunc
"\02" ;; malformed table limits flag
)
"integer too large"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\05\04\01" ;; table section with one entry
"\70" ;; anyfunc
"\02" ;; malformed table limits flag
"\00" ;; dummy byte
)
"integer too large"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\05\06\01" ;; table section with one entry
"\70" ;; anyfunc
"\81\00" ;; malformed table limits flag as LEB128
"\00\00" ;; dummy bytes
)
"integer too large"
)

;; Memory count can be zero
(module binary
"\00asm" "\01\00\00\00"
Expand All @@ -526,6 +678,43 @@
"unexpected end of section or function"
)

;; Malformed memory limits flag
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\05\02\01" ;; memory section with one entry
"\02" ;; malformed memory limits flag
)
"integer too large"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\05\03\01" ;; memory section with one entry
"\02" ;; malformed memory limits flag
"\00" ;; dummy byte
)
"integer too large"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\05\05\01" ;; memory section with one entry
"\81\00" ;; malformed memory limits flag as LEB128
"\00\00" ;; dummy bytes
)
"integer representation too long"
)
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\05\05\01" ;; memory section with one entry
"\81\01" ;; malformed memory limits flag as LEB128
"\00\00" ;; dummy bytes
)
"integer representation too long"
)

;; Global count can be zero
(module binary
"\00asm" "\01\00\00\00"
Expand Down Expand Up @@ -633,8 +822,23 @@
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
"\00\41\00\0b\01\00" ;; elem 0
;; "\00\41\00\0b\01\00" ;; elem 1 (missed)
"\0a\04\01" ;; code section
"\02\00\0b" ;; function body
)
"unexpected end"
)

;; 2 elem segment declared, 1.5 given
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01\04\01" ;; type section
"\60\00\00" ;; type 0
"\03\02\01\00" ;; func section
"\04\04\01" ;; table section
"\70\00\01" ;; table 0
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
"\00\41\00\0b\01\00" ;; elem 0
"\00\41\00" ;; elem 1 (partial)
;; "\0b\01\00" ;; elem 1 (missing part)
)
"unexpected end"
)
Expand Down Expand Up @@ -736,28 +940,6 @@
"\0b\0b\0b" ;; end
)

;; 2 br_table target declared, 1 given
(assert_malformed
(module binary
"\00asm" "\01\00\00\00"
"\01\04\01" ;; type section
"\60\00\00" ;; type 0
"\03\02\01\00" ;; func section
"\0a\12\01" ;; code section
"\10\00" ;; func 0
"\02\40" ;; block 0
"\41\01" ;; condition of if 0
"\04\40" ;; if 0
"\41\01" ;; index of br_table element
"\0e\02" ;; br_table with inconsistent target count (2 declared, 1 given)
"\00" ;; break depth 0
;; "\01" ;; break depth 1 (missed)
"\02" ;; break depth for default
"\0b\0b\0b" ;; end
)
"unexpected end of section or function"
)

;; 1 br_table target declared, 2 given
(assert_malformed
(module binary
Expand Down
Loading

0 comments on commit e3c0884

Please sign in to comment.