Skip to content

Commit 4baa925

Browse files
committed
create new fuzz script and add to coverage job
1 parent a460b7a commit 4baa925

File tree

4 files changed

+21
-27
lines changed

4 files changed

+21
-27
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ jobs:
126126
# Could you use this to fake the coverage report for your PR? Sure.
127127
# Will anyone be impressed by your amazing coverage? No
128128
# Maybe if codecov wasn't broken we wouldn't need to do this...
129+
./ci/ci-fuzz.sh
129130
bash <(curl -s https://codecov.io/bash) -f target/codecov.json -t "f421b687-4dc2-4387-ac3d-dc3b2528af57"
130131
131132
benchmark:

ci/ci-fuzz.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -eox pipefail
3+
4+
echo -e "\n\nGenerating fuzz coverage report"
5+
# In CI, store coverage in a specific directory for artifact collection
6+
COVERAGE_DIR="coverage-report"
7+
echo "Installing cargo-llvm-cov..."
8+
# Install cargo-llvm-cov if not already installed
9+
cargo install cargo-llvm-cov --locked
10+
echo "Running fuzz coverage generation..."
11+
./contrib/generate_fuzz_coverage.sh --output-dir "$COVERAGE_DIR"
12+
echo "Coverage generation completed. Checking results..."
13+
if [ -f "fuzz/$COVERAGE_DIR/html/index.html" ]; then
14+
echo "✓ Coverage report successfully generated at fuzz/$COVERAGE_DIR/html/index.html"
15+
ls -la "fuzz/$COVERAGE_DIR/html/"
16+
else
17+
echo "✗ Coverage report not found at expected location"
18+
fi

ci/ci-tests.sh

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,3 @@ RUSTFLAGS="--cfg=splicing" cargo test --verbose --color always -p lightning
137137
RUSTFLAGS="--cfg=async_payments" cargo test --verbose --color always -p lightning
138138
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
139139
RUSTFLAGS="--cfg=lsps1_service" cargo test --verbose --color always -p lightning-liquidity
140-
141-
# Generate fuzz coverage report
142-
echo -e "\n\nGenerating fuzz coverage report"
143-
if [ -n "$CI" ]; then
144-
# In CI, store coverage in a specific directory for artifact collection
145-
COVERAGE_DIR="coverage-report"
146-
mkdir -p "$COVERAGE_DIR"
147-
echo "Installing cargo-llvm-cov..."
148-
# Install cargo-llvm-cov if not already installed
149-
cargo install cargo-llvm-cov --locked
150-
echo "Running fuzz coverage generation..."
151-
./contrib/generate_fuzz_coverage.sh --output-dir "$COVERAGE_DIR"
152-
echo "Coverage generation completed. Checking results..."
153-
if [ -f "fuzz/$COVERAGE_DIR/html/index.html" ]; then
154-
echo "✓ Coverage report successfully generated at fuzz/$COVERAGE_DIR/html/index.html"
155-
ls -la "fuzz/$COVERAGE_DIR/html/"
156-
else
157-
echo "✗ Coverage report not found at expected location"
158-
echo "Checking what was created in fuzz/$COVERAGE_DIR:"
159-
ls -la "fuzz/$COVERAGE_DIR" || echo "Directory does not exist"
160-
fi
161-
else
162-
# Local development
163-
./contrib/generate_fuzz_coverage.sh
164-
fi

contrib/generate_fuzz_coverage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33
set -x
44

55
# Parse command line arguments
6-
OUTPUT_DIR="target/llvm-cov/html"
6+
OUTPUT_DIR="coverage-report"
77
while [[ $# -gt 0 ]]; do
88
case $1 in
99
--output-dir)
@@ -56,7 +56,7 @@ export RUSTFLAGS="--cfg=fuzzing --cfg=secp256k1_fuzz --cfg=hashes_fuzz"
5656
cargo llvm-cov --html --ignore-filename-regex "fuzz/" --output-dir "$OUTPUT_DIR"
5757

5858
# Check if coverage report was generated successfully
59-
# The report is generated directly in $OUTPUT_DIR/html/index.html
59+
# The report is generated in $OUTPUT_DIR/html/index.html when using --html --output-dir
6060
if [ ! -f "$OUTPUT_DIR/html/index.html" ]; then
6161
echo "Error: Failed to generate coverage report at $OUTPUT_DIR/html/index.html"
6262
# Debug: list what was actually created

0 commit comments

Comments
 (0)