Repository navigation
[Fuzzing] Fix feature checks in get_random_opts - #9303
Conversation
In test_one(), get_random_opts() was called before update_feature_opts('a.wasm') converted FEATURE_OPTS from '--all-features --disable-*' into explicit '--enable-*' flags, so get_random_opts() never saw the active '--enable-*' flags when selecting passes for test_one(). In addition, get_random_opts() checked "'--gc' not in FEATURE_OPTS" instead of "'--enable-gc' in FEATURE_OPTS", which was always true and caused '--flatten', '-O4', '--rereloop', and '--dfo' to be skipped on every call. Move get_random_opts() after update_feature_opts('a.wasm') and check for '--enable-gc' in FEATURE_OPTS.
There was a problem hiding this comment.
Code Review
This pull request updates scripts/fuzz_opt.py by delaying the generation of randomized options (get_random_opts()) until after update_feature_opts('a.wasm') is called. Additionally, it corrects a condition in get_random_opts() to avoid the --flatten option when --enable-gc is present in FEATURE_OPTS, replacing the previous check for the absence of --gc. There are no review comments, and I have no feedback to provide.
| opts = get_random_opts() | ||
| print('randomized opts:', '\n ' + '\n '.join(opts)) | ||
| print() |
There was a problem hiding this comment.
Can we include this output in a lit test to cover this?
There was a problem hiding this comment.
Potentially, but I would expect the test output to change over time, even if we fixed the seed and initial contents. For example adding new features to choose from would change the output. I don't think the test would be worth the ongoing maintenance of keeping it up-to-date.
In test_one(), get_random_opts() was called before update_feature_opts('a.wasm') converted FEATURE_OPTS from '--all-features --disable-' into explicit '--enable-' flags, so get_random_opts() never saw the active '--enable-*' flags when selecting passes for test_one(). In addition, get_random_opts() checked "'--gc' not in FEATURE_OPTS" instead of "'--enable-gc' in FEATURE_OPTS", which was always true and caused '--flatten', '-O4', '--rereloop', and '--dfo' to be skipped on every call. Move get_random_opts() after update_feature_opts('a.wasm') and check for '--enable-gc' in FEATURE_OPTS.