summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-06-14 12:07:44 -0700
committerGitHub <noreply@github.com>2024-06-14 19:07:44 +0000
commit0fa99fb09b881985cf94e74b8c0b339bdef61be6 (patch)
tree81d1a340dc17a55e6b611962807dd34599757651 /test
parent000fa2a8ac8dd66b8ca53b0451702966d59da4d0 (diff)
downloadbinaryen-0fa99fb09b881985cf94e74b8c0b339bdef61be6.tar.gz
binaryen-0fa99fb09b881985cf94e74b8c0b339bdef61be6.tar.bz2
binaryen-0fa99fb09b881985cf94e74b8c0b339bdef61be6.zip
[threads] Add a "shared-everything" feature (#6658)
Add the feature and flags to enable and disable it. Require the new feature to be enabled for shared heap types to validate. To make the test work, update the validator to actually check features for global types.
Diffstat (limited to 'test')
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt2
-rw-r--r--test/example/c-api-kitchen-sink.txt2
-rw-r--r--test/lit/help/wasm-as.test4
-rw-r--r--test/lit/help/wasm-ctor-eval.test4
-rw-r--r--test/lit/help/wasm-dis.test4
-rw-r--r--test/lit/help/wasm-emscripten-finalize.test4
-rw-r--r--test/lit/help/wasm-merge.test4
-rw-r--r--test/lit/help/wasm-metadce.test4
-rw-r--r--test/lit/help/wasm-opt.test5
-rw-r--r--test/lit/help/wasm-reduce.test4
-rw-r--r--test/lit/help/wasm-split.test4
-rw-r--r--test/lit/help/wasm2js.test5
-rw-r--r--test/lit/validation/shared-struct.wast12
-rw-r--r--test/passes/strip-target-features_roundtrip_print-features_all-features.txt1
-rw-r--r--test/unit/test_features.py1
15 files changed, 58 insertions, 2 deletions
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index a3e88703e..28922c2a0 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -33,7 +33,7 @@ Features.RelaxedSIMD: 4096
Features.ExtendedConst: 8192
Features.Strings: 16384
Features.MultiMemory: 32768
-Features.All: 131071
+Features.All: 262143
InvalidId: 0
BlockId: 1
IfId: 2
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 7231ded9a..d79b34e66 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -47,7 +47,7 @@ BinaryenFeatureMemory64: 2048
BinaryenFeatureRelaxedSIMD: 4096
BinaryenFeatureExtendedConst: 8192
BinaryenFeatureStrings: 16384
-BinaryenFeatureAll: 131071
+BinaryenFeatureAll: 262143
(f32.neg
(f32.const -33.61199951171875)
)
diff --git a/test/lit/help/wasm-as.test b/test/lit/help/wasm-as.test
index 09e5b7c9d..114064576 100644
--- a/test/lit/help/wasm-as.test
+++ b/test/lit/help/wasm-as.test
@@ -108,6 +108,10 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm-ctor-eval.test b/test/lit/help/wasm-ctor-eval.test
index e511ef0b9..93b5654ed 100644
--- a/test/lit/help/wasm-ctor-eval.test
+++ b/test/lit/help/wasm-ctor-eval.test
@@ -115,6 +115,10 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm-dis.test b/test/lit/help/wasm-dis.test
index 2dffcc945..06dda9e96 100644
--- a/test/lit/help/wasm-dis.test
+++ b/test/lit/help/wasm-dis.test
@@ -101,6 +101,10 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm-emscripten-finalize.test b/test/lit/help/wasm-emscripten-finalize.test
index a4ba48b16..1b31e1e44 100644
--- a/test/lit/help/wasm-emscripten-finalize.test
+++ b/test/lit/help/wasm-emscripten-finalize.test
@@ -143,6 +143,10 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm-merge.test b/test/lit/help/wasm-merge.test
index c87be5edf..293bdbff0 100644
--- a/test/lit/help/wasm-merge.test
+++ b/test/lit/help/wasm-merge.test
@@ -131,6 +131,10 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test
index f0889eb81..453328df1 100644
--- a/test/lit/help/wasm-metadce.test
+++ b/test/lit/help/wasm-metadce.test
@@ -156,6 +156,10 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test
index 727d1ab21..9dd38e03e 100644
--- a/test/lit/help/wasm-opt.test
+++ b/test/lit/help/wasm-opt.test
@@ -721,6 +721,11 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything
+;; CHECK-NEXT: threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm-reduce.test b/test/lit/help/wasm-reduce.test
index a98b8a199..397952855 100644
--- a/test/lit/help/wasm-reduce.test
+++ b/test/lit/help/wasm-reduce.test
@@ -137,6 +137,10 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test
index fcd919ea8..333864bcb 100644
--- a/test/lit/help/wasm-split.test
+++ b/test/lit/help/wasm-split.test
@@ -217,6 +217,10 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test
index d8768f35e..72efcd223 100644
--- a/test/lit/help/wasm2js.test
+++ b/test/lit/help/wasm2js.test
@@ -675,6 +675,11 @@
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-continuations Disable typed continuations
;; CHECK-NEXT:
+;; CHECK-NEXT: --enable-shared-everything Enable shared-everything threads
+;; CHECK-NEXT:
+;; CHECK-NEXT: --disable-shared-everything Disable shared-everything
+;; CHECK-NEXT: threads
+;; CHECK-NEXT:
;; CHECK-NEXT: --enable-typed-function-references Deprecated compatibility flag
;; CHECK-NEXT:
;; CHECK-NEXT: --disable-typed-function-references Deprecated compatibility flag
diff --git a/test/lit/validation/shared-struct.wast b/test/lit/validation/shared-struct.wast
new file mode 100644
index 000000000..ee25b6f24
--- /dev/null
+++ b/test/lit/validation/shared-struct.wast
@@ -0,0 +1,12 @@
+;; Test that shared structs require shared-everything threads
+
+;; RUN: not wasm-opt %s 2>&1 | filecheck %s --check-prefix NO-SHARED
+;; RUN: wasm-opt %s --enable-reference-types --enable-gc --enable-shared-everything -o - -S | filecheck %s --check-prefix SHARED
+
+;; NO-SHARED: global type requires additional features [--enable-reference-types --enable-gc --enable-shared-everything]
+;; SHARED: (type $t (shared (struct )))
+
+(module
+ (type $t (shared (struct)))
+ (global (import "" "") (ref null $t))
+)
diff --git a/test/passes/strip-target-features_roundtrip_print-features_all-features.txt b/test/passes/strip-target-features_roundtrip_print-features_all-features.txt
index a15210d05..2c6523e6d 100644
--- a/test/passes/strip-target-features_roundtrip_print-features_all-features.txt
+++ b/test/passes/strip-target-features_roundtrip_print-features_all-features.txt
@@ -15,6 +15,7 @@
--enable-strings
--enable-multimemory
--enable-typed-continuations
+--enable-shared-everything
(module
(type $0 (func (result v128 externref)))
(func $foo (type $0) (result v128 externref)
diff --git a/test/unit/test_features.py b/test/unit/test_features.py
index 4ce426275..3bd9ac127 100644
--- a/test/unit/test_features.py
+++ b/test/unit/test_features.py
@@ -425,4 +425,5 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase):
'--enable-strings',
'--enable-multimemory',
'--enable-typed-continuations',
+ '--enable-shared-everything',
], p2.stdout.splitlines())