-
Notifications
You must be signed in to change notification settings - Fork 787
Fix features section handling in the fuzzer #3980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
scripts/fuzz_opt.py
Outdated
def update_feature_opts(wasm): | ||
global FEATURE_OPTS | ||
# we will re-compute the features; leave all other things as they are | ||
EXTRA = [x for x in FEATURE_OPTS if not x.startswith('--enable') and not x.startswith('--disable') and x != '--all-features'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is EXTRA
for? Why is --all-features
excluded but not -all
or --mvp-features
or -mvp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I just handled the actually used ones. But good point, I generalized it now.
scripts/fuzz_opt.py
Outdated
@@ -563,7 +574,7 @@ def can_run(self, wasm): | |||
if random.random() < 0.5: | |||
return False | |||
# wasm2c doesn't support most features | |||
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', '--disable-reference-types', '--disable-multivalue', '--disable-gc']]) | |||
return not any([x in FEATURE_OPTS for x in ['--enable-exception-handling', '--enable-simd', '--enable-threads', '--enable-bulk-memory', '--enable-nontrapping-float-to-int', '--enable-tail-call', '--enable-sign-ext', '--enable-reference-types', '--enable-multivalue', '--enable-gc']]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be good to factor this pattern out into a helper function that takes a list of feature names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Co-authored-by: Thomas Lively <[email protected]>
The features section is additive since #3960. For the fuzzer to know which features
are used, it therefore needs to also scan the features section. To do this,
run
--print-features
to get the total features used from both flags + thefeatures section.
A result of this is that we now have a list of enabled features instead of
"enable all, then disable". This is actually clearer I think, but it does require
inverting the logic in some places.
May help with #3979 , although I haven't checked yet (cc @MaxGraey ).