|
66 | 66 | cargo llvm-cov clean --workspace |
67 | 67 |
|
68 | 68 | # Import honggfuzz corpus if the artifact was downloaded. |
69 | | - imported=0 |
70 | 69 | if [ -d "hfuzz_workspace" ]; then |
71 | 70 | echo "Importing corpus from hfuzz_workspace..." |
72 | 71 | for target_dir in hfuzz_workspace/*; do |
73 | 72 | [ -d "$target_dir" ] || continue |
74 | 73 | src_name="$(basename "$target_dir")" |
75 | | - for dest in "$src_name" "${src_name%_target}"; do |
76 | | - mkdir -p "test_cases/$dest" |
77 | | - # Copy corpus files into the test_cases directory |
78 | | - find "$target_dir" -maxdepth 2 -type f \ |
79 | | - \( -path "$target_dir/CORPUS/*" -o -path "$target_dir/INPUT/*" -o -path "$target_dir/NEW/*" -o -path "$target_dir/input/*" \) \ |
80 | | - -print0 | xargs -0 -I{} cp -n {} "test_cases/$dest/" 2>/dev/null || true |
81 | | - done |
| 74 | + dest="${src_name%_target}" |
| 75 | + mkdir -p "test_cases/$dest" |
| 76 | + # Copy corpus files into the test_cases directory |
| 77 | + find "$target_dir" -maxdepth 2 -type f -path "$target_dir/input/*" \ |
| 78 | + -print0 | xargs -0 -I{} cp -n {} "test_cases/$dest/" |
82 | 79 | done |
83 | | - # Check if any files were actually imported |
84 | | - if [ -n "$(find test_cases -type f -print -quit 2>/dev/null)" ]; then |
85 | | - imported=1 |
86 | | - fi |
87 | 80 | fi |
88 | 81 |
|
89 | | - # Generate coverage based on whether a corpus was imported. |
90 | | - if [ "$imported" = "1" ]; then |
91 | | - echo "Replaying imported corpus via tests to generate coverage..." |
92 | | - cargo llvm-cov -j8 --codecov --ignore-filename-regex "fuzz/" \ |
93 | | - --output-path "$OUTPUT_DIR/fuzz-codecov.json" --tests |
94 | | - else |
95 | | - echo "No corpus found; generating no-corpus coverage JSON..." |
96 | | - cargo llvm-cov -j8 --codecov --ignore-filename-regex "fuzz/" \ |
97 | | - --output-path "$OUTPUT_DIR/fuzz-codecov.json" --no-run |
98 | | - fi |
| 82 | + echo "Replaying imported corpus (if found) via tests to generate coverage..." |
| 83 | + cargo llvm-cov -j8 --codecov --ignore-filename-regex "fuzz/" \ |
| 84 | + --output-path "$OUTPUT_DIR/fuzz-codecov.json" --tests |
99 | 85 |
|
100 | 86 | echo "Fuzz codecov report available at $OUTPUT_DIR/fuzz-codecov.json" |
101 | 87 | fi |
0 commit comments