From 0b6d587beae1c9788d1a7b1079735f8377389df1 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 12 Sep 2024 14:35:49 -0400 Subject: [PATCH] fix(ci): skip files without modified functions Updates test-heavy-fuzz-modified-tests to skip any files that don't have any modified fuzz tests. --- .../scripts/testing/test-heavy-fuzz-modified-tests.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/contracts-bedrock/scripts/testing/test-heavy-fuzz-modified-tests.sh b/packages/contracts-bedrock/scripts/testing/test-heavy-fuzz-modified-tests.sh index 6f8706366916..b608f88bea08 100755 --- a/packages/contracts-bedrock/scripts/testing/test-heavy-fuzz-modified-tests.sh +++ b/packages/contracts-bedrock/scripts/testing/test-heavy-fuzz-modified-tests.sh @@ -88,6 +88,11 @@ for FILE in $CHANGED_FILES; do # Extract function names and their line numbers from the entire file FUNCTION_LINES=$(awk '/function testFuzz_|function invariant_/ {print FNR, $0}' "$FILE") + # If there are no function lines, skip the file. + if [ -z "$FUNCTION_LINES" ]; then + continue + fi + # Reverse the function lines so we can match the last function modified. # We'd otherwise end up matching the first function with a line number less # than the modified line number which is not what we want.