Skip to content

compile_native_go_fuzzer_v2: fix handling of multiple file matches#14783

Merged
AdamKorcz merged 2 commits intogoogle:masterfrom
roidelapluie:fix-compile-native-go-fuzzer-v2-multiple-matches
Mar 2, 2026
Merged

compile_native_go_fuzzer_v2: fix handling of multiple file matches#14783
AdamKorcz merged 2 commits intogoogle:masterfrom
roidelapluie:fix-compile-native-go-fuzzer-v2-multiple-matches

Conversation

@roidelapluie
Copy link
Copy Markdown
Contributor

The script uses recursive grep to find fuzzer functions, which can match function names in multiple files. This causes fuzzer_filename to contain multiple files, breaking the convertLibFuzzerTestcaseToStdLibGo command during coverage builds.

Fix by searching directly for the function signature with testing.F parameter, which only exists in the actual fuzzer test file. This avoids false matches in files that only reference the function name in comments or helper functions. The script now also explicitly fails if multiple matching files are found.

Required for #14183

@roidelapluie roidelapluie force-pushed the fix-compile-native-go-fuzzer-v2-multiple-matches branch 2 times, most recently from e8ad8a1 to c2219f0 Compare January 13, 2026 10:47
@roidelapluie
Copy link
Copy Markdown
Contributor Author

cc @jonathanmetzman do yo think we can move this further? Thanks

@AdamKorcz
Copy link
Copy Markdown
Collaborator

/gcbrun trial_build.py go --fuzzing-engines libfuzzer --sanitizers address coverage

@roidelapluie
Copy link
Copy Markdown
Contributor Author

I do not have access to failure logs so I don't know if they are related to this change.

@roidelapluie
Copy link
Copy Markdown
Contributor Author

cc @AdamKorcz Do you think we can move this further?

@AdamKorcz
Copy link
Copy Markdown
Collaborator

/gcbrun trial_build.py go --fuzzing-engines libfuzzer --sanitizers address coverage

The script uses recursive grep to find fuzzer functions, which can match
function names in multiple files. This causes fuzzer_filename to contain
multiple files, breaking the convertLibFuzzerTestcaseToStdLibGo command
during coverage builds.

Fix by searching directly for the function signature with testing.F parameter,
which only exists in the actual fuzzer test file. This avoids false matches in
files that only reference the function name in comments or helper functions.
The script now also explicitly fails if multiple matching files are found.

Required for google#14183

Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
@roidelapluie roidelapluie force-pushed the fix-compile-native-go-fuzzer-v2-multiple-matches branch from cf688d4 to e5c52fd Compare February 24, 2026 17:08
@roidelapluie
Copy link
Copy Markdown
Contributor Author

@AdamKorcz I did fix an issue, can you re-run the tests? Thanks!

@AdamKorcz
Copy link
Copy Markdown
Collaborator

/gcbrun trial_build.py go --fuzzing-engines libfuzzer --sanitizers address coverage

@roidelapluie
Copy link
Copy Markdown
Contributor Author

@AdamKorcz unfortunately the build failed with unrelated reasons. this is now on top of master again.

@AdamKorcz
Copy link
Copy Markdown
Collaborator

@roidelapluie thank you for rebasing. if the trial-build fails for unrelated reasons, that is fine, we can still merge it. If I verify that the failures are unrelated, we are good to go. We will need to run it again, and if it fails, could you hold off any updates and rebases until I review the logs?

@roidelapluie
Copy link
Copy Markdown
Contributor Author

@AdamKorcz Yes, will do

@AdamKorcz
Copy link
Copy Markdown
Collaborator

/gcbrun trial_build.py go --fuzzing-engines libfuzzer --sanitizers address coverage

@roidelapluie
Copy link
Copy Markdown
Contributor Author

roidelapluie commented Mar 2, 2026

@AdamKorcz Can you please have a look ? Seems there is just one timeout.

Copy link
Copy Markdown
Collaborator

@AdamKorcz AdamKorcz left a comment

Choose a reason for hiding this comment

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

Looks good. The failed builds in the cloud run are unrelated.

Thank you for the contribution and the patience.

@AdamKorcz AdamKorcz merged commit 28e3020 into google:master Mar 2, 2026
18 of 19 checks passed
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