Skip to content

Commit 77c038f

Browse files
committed
workflows: eliminate unnecessary echo pipes in blktests counting
The blktests result collection was using intermediate variables and echo pipes for counting tests, which is inefficient and could potentially hit broken pipe issues with set -o pipefail. The test name extraction piped through echo to count total tests, and failed test detection stored results in a variable before piping through echo to wc. Optimize by piping find output directly to the counting pipeline, eliminating the intermediate test_names and bad_files variables. This makes the code more efficient with less memory usage and avoids any potential SIGPIPE issues. The failed_tests count is now always set directly from the find pipeline, eliminating the conditional logic that was previously needed to handle the empty case. Generated-by: Claude AI Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
1 parent 427a970 commit 77c038f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

.github/actions/test/action.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,16 @@ runs:
122122
123123
# Count total tests by unique test names (not file extensions)
124124
# Get base test names by removing extensions and extracting just the test name
125-
test_names=$(find "$wpath/results/last-run" -type f -name "*" | \
125+
total_tests=$(find "$wpath/results/last-run" -type f -name "*" | \
126126
grep -E '/[^/]*$' | \
127127
sed 's|.*/||' | \
128128
sed 's/\.\(full\|out\|runtime\|dmesg\)$//' | \
129-
sort -u)
130-
total_tests=$(echo "$test_names" | grep -v '^$' | wc -l)
129+
sort -u | \
130+
grep -v '^$' | \
131+
wc -l)
131132
132-
bad_files=$(find "$wpath/results/last-run" -name "*.out.bad" -type f)
133-
if [[ -n "$bad_files" ]]; then
134-
failed_tests=$(echo "$bad_files" | wc -l)
135-
else
136-
failed_tests=0
137-
fi
133+
# Count failed tests directly from find output
134+
failed_tests=$(find "$wpath/results/last-run" -name "*.out.bad" -type f | wc -l)
138135
139136
passed_tests=$((total_tests - failed_tests))
140137

0 commit comments

Comments
 (0)