Skip to content

Commit fb1a789

Browse files
committed
teach the fuzzer about implied feature options
1 parent 1b65a5e commit fb1a789

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

scripts/fuzz_opt.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ def randomize_feature_opts():
111111
for possible in POSSIBLE_FEATURE_OPTS:
112112
if random.random() < 0.5:
113113
FEATURE_OPTS.append(possible)
114+
if possible in IMPLIED_FEATURE_OPTS.keys():
115+
for implied in IMPLIED_FEATURE_OPTS[possible]:
116+
FEATURE_OPTS.append(implied)
114117
print('randomized feature opts:', ' '.join(FEATURE_OPTS))
115118

116119

@@ -870,6 +873,12 @@ def randomize_opt_flags():
870873
POSSIBLE_FEATURE_OPTS = run([in_bin('wasm-opt'), '--print-features', in_binaryen('test', 'hello_world.wat')] + CONSTANT_FEATURE_OPTS).replace('--enable', '--disable').strip().split('\n')
871874
print('POSSIBLE_FEATURE_OPTS:', POSSIBLE_FEATURE_OPTS)
872875

876+
# some features depend on other features, so if a required feature is
877+
# disabled, its dependent features need to be disabled as well.
878+
IMPLIED_FEATURE_OPTS = {
879+
'--disable-reference-types': ['--disable-exception-handling', '--disable-anyref']
880+
}
881+
873882
if __name__ == '__main__':
874883
# if we are given a seed, run exactly that one testcase. otherwise,
875884
# run new ones until we fail

0 commit comments

Comments
 (0)