summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/fuzzing/fuzzing.cpp7
-rw-r--r--test/passes/fuzz_metrics_passes_noprint.bin.txt60
-rw-r--r--test/unit/test_cluster_fuzz.py12
3 files changed, 49 insertions, 30 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp
index 135e50393..a283aae91 100644
--- a/src/tools/fuzzing/fuzzing.cpp
+++ b/src/tools/fuzzing/fuzzing.cpp
@@ -270,6 +270,13 @@ void TranslateToFuzzReader::pickPasses(OptimizationOptions& options) {
options.passOptions.closedWorld = true;
}
+ // Prune things that error in JS if we call them (like SIMD), some of the
+ // time. This alters the wasm/JS boundary quite a lot, so testing both forms
+ // is useful.
+ if (oneIn(2)) {
+ options.passes.push_back("legalize-and-prune-js-interface");
+ }
+
// Usually DCE at the very end, to ensure that our binaries validate in other
// VMs, due to how non-nullable local validation and unreachable code
// interact. See fuzz_opt.py and
diff --git a/test/passes/fuzz_metrics_passes_noprint.bin.txt b/test/passes/fuzz_metrics_passes_noprint.bin.txt
index 5e0dbfe07..9c8c25c12 100644
--- a/test/passes/fuzz_metrics_passes_noprint.bin.txt
+++ b/test/passes/fuzz_metrics_passes_noprint.bin.txt
@@ -1,35 +1,35 @@
Metrics
total
- [exports] : 50
- [funcs] : 64
- [globals] : 24
- [imports] : 5
+ [exports] : 54
+ [funcs] : 84
+ [globals] : 17
+ [imports] : 4
[memories] : 1
- [memory-data] : 15
- [table-data] : 16
+ [memory-data] : 11
+ [table-data] : 22
[tables] : 1
[tags] : 0
- [total] : 6973
- [vars] : 223
- Binary : 534
- Block : 1168
- Break : 228
- Call : 282
- CallIndirect : 38
- Const : 1083
- Drop : 115
- GlobalGet : 580
- GlobalSet : 444
- If : 354
- Load : 113
- LocalGet : 501
- LocalSet : 367
- Loop : 148
- Nop : 99
- RefFunc : 16
- Return : 91
- Select : 53
- Store : 70
- Switch : 1
- Unary : 466
- Unreachable : 222
+ [total] : 8343
+ [vars] : 264
+ Binary : 597
+ Block : 1335
+ Break : 226
+ Call : 346
+ CallIndirect : 65
+ Const : 1375
+ Drop : 107
+ GlobalGet : 719
+ GlobalSet : 522
+ If : 458
+ Load : 139
+ LocalGet : 650
+ LocalSet : 441
+ Loop : 165
+ Nop : 97
+ RefFunc : 22
+ Return : 120
+ Select : 71
+ Store : 56
+ Switch : 2
+ Unary : 574
+ Unreachable : 256
diff --git a/test/unit/test_cluster_fuzz.py b/test/unit/test_cluster_fuzz.py
index 293cfa339..1d275c712 100644
--- a/test/unit/test_cluster_fuzz.py
+++ b/test/unit/test_cluster_fuzz.py
@@ -97,6 +97,18 @@ class ClusterFuzz(utils.BinaryenTestCase):
self.assertTrue(not os.path.exists(fuzz_file))
self.assertTrue(not os.path.exists(flags_file))
+ # Run.py should report no errors or warnings to stderr, except from
+ # those we know are safe.
+ SAFE_WARNINGS = [
+ # When we randomly pick no passes to run, this is shown.
+ 'warning: no passes specified, not doing any work',
+ ]
+ stderr = proc.stderr
+ for safe in SAFE_WARNINGS:
+ stderr = stderr.replace(safe, '')
+ stderr = stderr.strip()
+ self.assertEqual(stderr, '')
+
def test_fuzz_passes(self):
# We should see interesting passes being run in run.py. This is *NOT* a
# deterministic test, since the number of passes run is random (we just