Skip to content

Commit 1f0763f

Browse files
authored
Merge pull request #4503 from joostjager/fuzz-flags
Add .cargo/config.toml for fuzz cfg flags
2 parents b3a99f6 + 43cf380 commit 1f0763f

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ jobs:
241241
- name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
242242
run: |
243243
cd fuzz
244-
RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo test --verbose --color always --lib --bins -j8
244+
cargo test --verbose --color always --lib --bins -j8
245245
cargo clean
246246
- name: Run fuzzers
247247
run: cd fuzz && ./ci-fuzz.sh && cd ..

contrib/generate_fuzz_coverage.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ fi
5555
# Create output directory if it doesn't exist
5656
mkdir -p "$OUTPUT_DIR"
5757

58-
export RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz"
59-
6058
# dont run this command when running in CI
6159
if [ "$OUTPUT_CODECOV_JSON" = "0" ]; then
6260
cargo llvm-cov --html --ignore-filename-regex "fuzz/" --output-dir "$OUTPUT_DIR"

fuzz/.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[build]
2+
rustflags = ["--cfg=fuzzing", "--cfg=secp256k1_fuzz", "--cfg=hashes_fuzz"]

fuzz/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ mkdir -p ./test_cases/$TARGET
134134
echo $HEX | xxd -r -p > ./test_cases/$TARGET/any_filename_works
135135

136136
export RUST_BACKTRACE=1
137-
export RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz"
138137
cargo test
139138
```
140139

@@ -152,7 +151,7 @@ Alternatively, you can use the `stdin_fuzz` feature to pipe the crash input dire
152151
creating test case files on disk:
153152

154153
```shell
155-
echo -ne '\x2d\x31\x36\x38\x37\x34\x09\x01...' | RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz" cargo run --features stdin_fuzz --bin full_stack_target
154+
echo -ne '\x2d\x31\x36\x38\x37\x34\x09\x01...' | cargo run --features stdin_fuzz --bin full_stack_target
156155
```
157156

158157
Panics will abort the process directly (the crate uses `panic = "abort"`), resulting in a

0 commit comments

Comments
 (0)