Commit 00abcf6
committed
Fix compile_native_go_fuzzer_v2 to handle multiple file matches
The compile_native_go_fuzzer_v2 script uses recursive grep to find fuzzer
functions, which can match function names in multiple files (e.g., in
fuzz_test.go, corpus.go, and corpus_gen/main.go). 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.
This fix is needed for the Prometheus native fuzzing migration
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>1 parent 0ea0467 commit 00abcf6
1 file changed
+13
-4
lines changedLines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
34 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
37 | 45 | | |
38 | 46 | | |
| 47 | + | |
39 | 48 | | |
0 commit comments