Skip to content

[Fuzzing] Fix feature checks in get_random_opts - #9303

Merged
tlively merged 1 commit into
mainfrom
fuzzer-flatten-opts
Oct 26, 2026
Merged

tlively merged 1 commit into
mainfrom
fuzzer-flatten-opts

Conversation

@tlively

@tlively tlively commented Oct 24, 2026

Copy link
Copy Markdown
Member

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.

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.
@tlively
tlively requested a review from a team as a code owner October 24, 2026 02:00
@tlively
tlively requested review from stevenfontanella and removed request for a team October 24, 2026 02:00

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread scripts/fuzz_opt.py
Comment on lines +2629 to +2631
opts = get_random_opts()
print('randomized opts:', '\n ' + '\n '.join(opts))
print()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include this output in a lit test to cover this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tlively
tlively merged commit 795ef8e into main Oct 26, 2026
17 checks passed
@tlively
tlively deleted the fuzzer-flatten-opts branch October 26, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants