summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-10-21 11:43:28 -0700
committerGitHub <noreply@github.com>2020-10-21 11:43:28 -0700
commitdc5638879350e7186ea79aa5199606ad570fa0c3 (patch)
tree013e2b3ee9f1ea97f5b9ba454216c7f942c00126
parent5374418d347e5adb242a2e92c3fec7aa02de8f13 (diff)
downloadbinaryen-dc5638879350e7186ea79aa5199606ad570fa0c3.tar.gz
binaryen-dc5638879350e7186ea79aa5199606ad570fa0c3.tar.bz2
binaryen-dc5638879350e7186ea79aa5199606ad570fa0c3.zip
Fuzzer: improve random selection of features (#3268)
We used to either apply all, or pick each at random. Also add a chance to pick none at all.
-rwxr-xr-xscripts/fuzz_opt.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py
index decd01f4a..0a0fd679b 100755
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -102,12 +102,11 @@ def no_pass_debug():
def randomize_feature_opts():
global FEATURE_OPTS
FEATURE_OPTS = CONSTANT_FEATURE_OPTS[:]
- # half the time apply all the possible opts. this lets all test runners work at max
- # capacity at least half the time, as otherwise if they need almost all the opts, the
- # chance of getting them is exponentially small.
- if random.random() < 0.5:
+ # 1/3 the time apply all the possible opts, 1/3 none of them, to maximize
+ # coverage both ways, and 1/3 pick each one randomly
+ if random.random() < 0.33333:
FEATURE_OPTS += POSSIBLE_FEATURE_OPTS
- else:
+ elif random.random() < 0.5:
for possible in POSSIBLE_FEATURE_OPTS:
if random.random() < 0.5:
FEATURE_OPTS.append(possible)