Skip to content

Commit cf039d7

Browse files
committed
create new fuzz script and add to coverage job
1 parent 62dfd35 commit cf039d7

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
@@ -128,6 +128,7 @@ jobs:
128128
# Could you use this to fake the coverage report for your PR? Sure.
129129
# Will anyone be impressed by your amazing coverage? No
130130
# Maybe if codecov wasn't broken we wouldn't need to do this...
131+
./ci/ci-fuzz.sh
131132
bash <(curl -s https://codecov.io/bash) -f target/codecov.json -t "f421b687-4dc2-4387-ac3d-dc3b2528af57"
132133
133134
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
@@ -158,28 +158,3 @@ RUSTFLAGS="--cfg=async_payments" cargo test --verbose --color always -p lightnin
158158
RUSTFLAGS="--cfg=simple_close" cargo test --verbose --color always -p lightning
159159
[ "$CI_MINIMIZE_DISK_USAGE" != "" ] && cargo clean
160160
RUSTFLAGS="--cfg=lsps1_service" cargo test --verbose --color always -p lightning-liquidity
161-
162-
# Generate fuzz coverage report
163-
echo -e "\n\nGenerating fuzz coverage report"
164-
if [ -n "$CI" ]; then
165-
# In CI, store coverage in a specific directory for artifact collection
166-
COVERAGE_DIR="coverage-report"
167-
mkdir -p "$COVERAGE_DIR"
168-
echo "Installing cargo-llvm-cov..."
169-
# Install cargo-llvm-cov if not already installed
170-
cargo install cargo-llvm-cov --locked
171-
echo "Running fuzz coverage generation..."
172-
./contrib/generate_fuzz_coverage.sh --output-dir "$COVERAGE_DIR"
173-
echo "Coverage generation completed. Checking results..."
174-
if [ -f "fuzz/$COVERAGE_DIR/html/index.html" ]; then
175-
echo "✓ Coverage report successfully generated at fuzz/$COVERAGE_DIR/html/index.html"
176-
ls -la "fuzz/$COVERAGE_DIR/html/"
177-
else
178-
echo "✗ Coverage report not found at expected location"
179-
echo "Checking what was created in fuzz/$COVERAGE_DIR:"
180-
ls -la "fuzz/$COVERAGE_DIR" || echo "Directory does not exist"
181-
fi
182-
else
183-
# Local development
184-
./contrib/generate_fuzz_coverage.sh
185-
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)