Skip to content

Commit b72aa50

Browse files
authored
Fuzz all feature flags, and fix another SignExt issue in the fuzzer (#2259)
1 parent daf0b9c commit b72aa50

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

scripts/fuzz_opt.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
# truncsat: https://github.com/WebAssembly/binaryen/issues/2198
3737
CONSTANT_FEATURE_OPTS = ['--all-features']
3838

39-
# possible feature options that are sometimes passed to the tools.
40-
POSSIBLE_FEATURE_OPTS = ['--disable-exception-handling', '--disable-simd', '--disable-threads', '--disable-bulk-memory', '--disable-nontrapping-float-to-int', '--disable-tail-call']
41-
4239
FUZZ_OPTS = []
4340

4441
INPUT_SIZE_LIMIT = 150 * 1024
@@ -297,7 +294,7 @@ def run(self, wasm):
297294
return out
298295

299296
def can_run_on_feature_opts(self, feature_opts):
300-
return all([x in feature_opts for x in ['--disable-exception-handling', '--disable-simd', '--disable-threads', '--disable-bulk-memory', '--disable-nontrapping-float-to-int', '--disable-tail-call']])
297+
return all([x in feature_opts for x in ['--disable-exception-handling', '--disable-simd', '--disable-threads', '--disable-bulk-memory', '--disable-nontrapping-float-to-int', '--disable-tail-call', '--disable-sign-ext']])
301298

302299

303300
class Asyncify(TestCaseHandler):
@@ -531,6 +528,12 @@ def get_multiple_opt_choices():
531528
if not NANS:
532529
FUZZ_OPTS += ['--no-fuzz-nans']
533530

531+
# possible feature options that are sometimes passed to the tools. this
532+
# contains the list of all possible feature flags we can disable (after
533+
# we enable all before that in the constant options)
534+
POSSIBLE_FEATURE_OPTS = run([in_bin('wasm-opt'), '--print-features', '-all', in_binaryen('test', 'hello_world.wast'), '-all']).replace('--enable', '--disable').strip().split('\n')
535+
print('POSSIBLE_FEATURE_OPTS:', POSSIBLE_FEATURE_OPTS)
536+
534537
if __name__ == '__main__':
535538
print('checking infinite random inputs')
536539
random.seed(time.time() * os.getpid())

src/tools/fuzzing.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,7 +1815,7 @@ class TranslateToFuzzReader {
18151815
auto op =
18161816
pick(FeatureOptions<UnaryOp>()
18171817
.add(FeatureSet::MVP, ClzInt64, CtzInt64, PopcntInt64)
1818-
.add(FeatureSet::Atomics,
1818+
.add(FeatureSet::SignExt,
18191819
ExtendS8Int64,
18201820
ExtendS16Int64,
18211821
ExtendS32Int64));

0 commit comments

Comments
 (0)