Skip to content

Commit a4f0a0d

Browse files
authored
wamr-test-suites: Enable AOT multi-module spec tests (#3450)
Bypass some cases because: - aot multi-module doesn't support empty modules - aot multi-module doesn't support import globals
1 parent a2f3c72 commit a4f0a0d

3 files changed

Lines changed: 160 additions & 97 deletions

File tree

Lines changed: 27 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,57 @@
1-
diff --git a/test/core/imports.wast b/test/core/imports.wast
2-
index 0cc07cb..4e8367a 100644
3-
--- a/test/core/imports.wast
4-
+++ b/test/core/imports.wast
5-
@@ -86,7 +86,7 @@
6-
(assert_return (invoke "print64" (i64.const 24)))
7-
8-
(assert_invalid
9-
- (module
10-
+ (module
11-
(type (func (result i32)))
12-
(import "test" "func" (func (type 1)))
13-
)
14-
@@ -578,6 +578,7 @@
15-
(assert_return (invoke "grow" (i32.const 1)) (i32.const -1))
16-
(assert_return (invoke "grow" (i32.const 0)) (i32.const 2))
17-
18-
+(;
19-
(module $Mgm
20-
(memory (export "memory") 1) ;; initial size is 1
21-
(func (export "grow") (result i32) (memory.grow (i32.const 1)))
22-
@@ -586,7 +587,7 @@
23-
(assert_return (invoke $Mgm "grow") (i32.const 1)) ;; now size is 2
24-
(module $Mgim1
25-
;; imported memory limits should match, because external memory size is 2 now
26-
- (memory (export "memory") (import "grown-memory" "memory") 2)
27-
+ (memory (export "memory") (import "grown-memory" "memory") 2)
28-
(func (export "grow") (result i32) (memory.grow (i32.const 1)))
29-
)
30-
(register "grown-imported-memory" $Mgim1)
31-
@@ -597,7 +598,7 @@
32-
(func (export "size") (result i32) (memory.size))
33-
)
34-
(assert_return (invoke $Mgim2 "size") (i32.const 3))
35-
-
36-
+;)
37-
38-
;; Syntax errors
39-
40-
@@ -669,6 +670,7 @@
41-
"import after memory"
42-
)
43-
44-
+(;
45-
;; This module is required to validate, regardless of whether it can be
46-
;; linked. Overloading is not possible in wasm itself, but it is possible
47-
;; in modules from which wasm can import.
48-
@@ -695,3 +697,4 @@
49-
)
50-
"unknown import"
51-
)
52-
+;)
53-
\ No newline at end of file
541
diff --git a/test/core/linking.wast b/test/core/linking.wast
55-
index 994e0f4..8fbcc02 100644
2+
index 8fbcc02..a2254b3 100644
563
--- a/test/core/linking.wast
574
+++ b/test/core/linking.wast
58-
@@ -19,11 +19,11 @@
59-
(assert_return (invoke $Nf "call") (i32.const 3))
60-
(assert_return (invoke $Nf "call Mf.call") (i32.const 2))
61-
62-
-(module
63-
+(module $M1
5+
@@ -23,6 +23,8 @@
646
(import "spectest" "print_i32" (func $f (param i32)))
657
(export "print" (func $f))
668
)
67-
-(register "reexport_f")
68-
+(register "reexport_f" $M1)
9+
+
10+
+(; doesn't support empty files
11+
(register "reexport_f" $M1)
6912
(assert_unlinkable
7013
(module (import "reexport_f" "print" (func (param i64))))
14+
@@ -32,9 +34,11 @@
15+
(module (import "reexport_f" "print" (func (param i32) (result i32))))
7116
"incompatible import type"
72-
@@ -35,7 +35,6 @@
17+
)
18+
+;)
7319

7420

7521
;; Globals
76-
-
22+
+(; aot doesn't support to import globals
7723
(module $Mg
7824
(global $glob (export "glob") i32 (i32.const 42))
7925
(func (export "get") (result i32) (global.get $glob))
80-
@@ -47,6 +46,7 @@
26+
@@ -45,6 +49,7 @@
27+
(func (export "set_mut") (param i32) (global.set $mut_glob (local.get 0)))
8128
)
8229
(register "Mg" $Mg)
30+
+;)
8331

84-
+(; only sharing initial values
32+
(; only sharing initial values
8533
(module $Ng
86-
(global $x (import "Mg" "glob") i32)
87-
(global $mut_glob (import "Mg" "mut_glob") (mut i32))
88-
@@ -81,7 +81,7 @@
89-
(assert_return (get $Ng "Mg.mut_glob") (i32.const 241))
90-
(assert_return (invoke $Mg "get_mut") (i32.const 241))
34+
@@ -83,6 +88,7 @@
9135
(assert_return (invoke $Ng "Mg.get_mut") (i32.const 241))
92-
-
93-
+;)
36+
;)
9437

38+
+(;
9539
(assert_unlinkable
9640
(module (import "Mg" "mut_glob" (global i32)))
97-
@@ -130,7 +130,7 @@
98-
41+
"incompatible import type"
42+
@@ -92,7 +98,6 @@
43+
"incompatible import type"
44+
)
9945

100-
;; Tables
10146
-
102-
+(; no such support
103-
(module $Mt
104-
(type (func (result i32)))
105-
(type (func))
106-
@@ -307,10 +307,11 @@
107-
(module (table (import "Mtable_ex" "t-extern") 1 funcref))
47+
(module $Mref_ex
48+
(global (export "g-const-func") funcref (ref.null func))
49+
(global (export "g-var-func") (mut funcref) (ref.null func))
50+
@@ -127,6 +132,7 @@
51+
(module (global (import "Mref_ex" "g-var-extern") (mut funcref)))
10852
"incompatible import type"
10953
)
11054
+;)
11155

11256

113-
;; Memories
114-
-
115-
+(; no such support
116-
(module $Mm
117-
(memory (export "mem") 1 5)
118-
(data (i32.const 10) "\00\01\02\03\04\05\06\07\08\09")
119-
@@ -451,3 +452,4 @@
120-
121-
(assert_return (invoke $Ms "get memory[0]") (i32.const 104)) ;; 'h'
122-
(assert_return (invoke $Ms "get table[0]") (i32.const 0xdead))
123-
+;)
124-
\ No newline at end of file
57+
;; Tables
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
diff --git a/test/core/imports.wast b/test/core/imports.wast
2+
index 0cc07cb..4e8367a 100644
3+
--- a/test/core/imports.wast
4+
+++ b/test/core/imports.wast
5+
@@ -86,7 +86,7 @@
6+
(assert_return (invoke "print64" (i64.const 24)))
7+
8+
(assert_invalid
9+
- (module
10+
+ (module
11+
(type (func (result i32)))
12+
(import "test" "func" (func (type 1)))
13+
)
14+
@@ -578,6 +578,7 @@
15+
(assert_return (invoke "grow" (i32.const 1)) (i32.const -1))
16+
(assert_return (invoke "grow" (i32.const 0)) (i32.const 2))
17+
18+
+(;
19+
(module $Mgm
20+
(memory (export "memory") 1) ;; initial size is 1
21+
(func (export "grow") (result i32) (memory.grow (i32.const 1)))
22+
@@ -586,7 +587,7 @@
23+
(assert_return (invoke $Mgm "grow") (i32.const 1)) ;; now size is 2
24+
(module $Mgim1
25+
;; imported memory limits should match, because external memory size is 2 now
26+
- (memory (export "memory") (import "grown-memory" "memory") 2)
27+
+ (memory (export "memory") (import "grown-memory" "memory") 2)
28+
(func (export "grow") (result i32) (memory.grow (i32.const 1)))
29+
)
30+
(register "grown-imported-memory" $Mgim1)
31+
@@ -597,7 +598,7 @@
32+
(func (export "size") (result i32) (memory.size))
33+
)
34+
(assert_return (invoke $Mgim2 "size") (i32.const 3))
35+
-
36+
+;)
37+
38+
;; Syntax errors
39+
40+
@@ -669,6 +670,7 @@
41+
"import after memory"
42+
)
43+
44+
+(;
45+
;; This module is required to validate, regardless of whether it can be
46+
;; linked. Overloading is not possible in wasm itself, but it is possible
47+
;; in modules from which wasm can import.
48+
@@ -695,3 +697,4 @@
49+
)
50+
"unknown import"
51+
)
52+
+;)
53+
\ No newline at end of file
54+
diff --git a/test/core/linking.wast b/test/core/linking.wast
55+
index 994e0f4..8fbcc02 100644
56+
--- a/test/core/linking.wast
57+
+++ b/test/core/linking.wast
58+
@@ -19,11 +19,11 @@
59+
(assert_return (invoke $Nf "call") (i32.const 3))
60+
(assert_return (invoke $Nf "call Mf.call") (i32.const 2))
61+
62+
-(module
63+
+(module $M1
64+
(import "spectest" "print_i32" (func $f (param i32)))
65+
(export "print" (func $f))
66+
)
67+
-(register "reexport_f")
68+
+(register "reexport_f" $M1)
69+
(assert_unlinkable
70+
(module (import "reexport_f" "print" (func (param i64))))
71+
"incompatible import type"
72+
@@ -35,7 +35,6 @@
73+
74+
75+
;; Globals
76+
-
77+
(module $Mg
78+
(global $glob (export "glob") i32 (i32.const 42))
79+
(func (export "get") (result i32) (global.get $glob))
80+
@@ -47,6 +46,7 @@
81+
)
82+
(register "Mg" $Mg)
83+
84+
+(; only sharing initial values
85+
(module $Ng
86+
(global $x (import "Mg" "glob") i32)
87+
(global $mut_glob (import "Mg" "mut_glob") (mut i32))
88+
@@ -81,7 +81,7 @@
89+
(assert_return (get $Ng "Mg.mut_glob") (i32.const 241))
90+
(assert_return (invoke $Mg "get_mut") (i32.const 241))
91+
(assert_return (invoke $Ng "Mg.get_mut") (i32.const 241))
92+
-
93+
+;)
94+
95+
(assert_unlinkable
96+
(module (import "Mg" "mut_glob" (global i32)))
97+
@@ -130,7 +130,7 @@
98+
99+
100+
;; Tables
101+
-
102+
+(; no such support
103+
(module $Mt
104+
(type (func (result i32)))
105+
(type (func))
106+
@@ -307,10 +307,11 @@
107+
(module (table (import "Mtable_ex" "t-extern") 1 funcref))
108+
"incompatible import type"
109+
)
110+
+;)
111+
112+
113+
;; Memories
114+
-
115+
+(; no such support
116+
(module $Mm
117+
(memory (export "mem") 1 5)
118+
(data (i32.const 10) "\00\01\02\03\04\05\06\07\08\09")
119+
@@ -451,3 +452,4 @@
120+
121+
(assert_return (invoke $Ms "get memory[0]") (i32.const 104)) ;; 'h'
122+
(assert_return (invoke $Ms "get table[0]") (i32.const 0xdead))
123+
+;)
124+
\ No newline at end of file

tests/wamr-test-suites/test_wamr.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ function compile_reference_interpreter()
427427
# TODO: with iwasm only
428428
function spec_test()
429429
{
430+
local RUNNING_MODE="$1"
431+
430432
echo "Now start spec tests"
431433
touch ${REPORT_DIR}/spec_test_report.txt
432434

@@ -499,7 +501,11 @@ function spec_test()
499501
git apply ../../spec-test-script/simd_ignore_cases.patch || exit 1
500502
fi
501503
if [[ ${ENABLE_MULTI_MODULE} == 1 ]]; then
502-
git apply ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1
504+
git apply ../../spec-test-script/multi_module_ignore_cases.patch || exit 1
505+
506+
if [[ ${RUNNING_MODE} == "aot" ]]; then
507+
git apply ../../spec-test-script/multi_module_aot_ignore_cases.patch || exit 1
508+
fi
503509
fi
504510
fi
505511

@@ -856,10 +862,10 @@ function do_execute_in_running_mode()
856862
fi
857863
fi
858864

859-
# FIXME: add "aot" after fix the linking failure
860865
if [[ ${ENABLE_MULTI_MODULE} -eq 1 ]]; then
861866
if [[ "${RUNNING_MODE}" != "classic-interp" \
862-
&& "${RUNNING_MODE}" != "fast-interp" ]]; then
867+
&& "${RUNNING_MODE}" != "fast-interp" \
868+
&& "${RUNNING_MODE}" != "aot" ]]; then
863869
echo "support multi-module in both interp modes"
864870
return 0
865871
fi

0 commit comments

Comments
 (0)