Skip to content

Commit 74ba259

Browse files
Improve kselftest report
Signed-off-by: Shreeya Patel <[email protected]>
1 parent 5b896bf commit 74ba259

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

.github/workflows/kernel-build-and-test-x86_64.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ jobs:
212212
name: kselftest-logs-x86_64
213213
path: output-previous
214214
branch: ${{ github.ref_name }}
215+
workflow_conclusion: success
215216
search_artifacts: true
216217
skip_unpack: false
217218
if_no_artifact_found: warn
@@ -220,13 +221,44 @@ jobs:
220221
- name: Compare test results
221222
run: |
222223
if [ -f output-previous/kselftests-*.log ]; then
223-
BEFORE=$(grep -a '^ok' output-previous/kselftests-*.log | wc -l)
224-
AFTER=$(grep -a '^ok' output-current/kselftests-*.log | wc -l)
225-
echo "Previous run: $BEFORE passing tests"
226-
echo "Current run: $AFTER passing tests"
227-
if [ "$AFTER" -lt "$BEFORE" ]; then
228-
echo "::warning::Regression detected: $BEFORE -> $AFTER"
224+
# Compare passing tests (ok)
225+
BEFORE_PASS=$(grep -a '^ok' output-previous/kselftests-*.log | wc -l)
226+
AFTER_PASS=$(grep -a '^ok' output-current/kselftests-*.log | wc -l)
227+
228+
# Compare failing tests (not ok)
229+
BEFORE_FAIL=$(grep -a '^not ok' output-previous/kselftests-*.log | wc -l)
230+
AFTER_FAIL=$(grep -a '^not ok' output-current/kselftests-*.log | wc -l)
231+
232+
echo "### Kselftest Comparison (Branch: ${{ github.ref_name }})"
233+
echo "Passing tests: $BEFORE_PASS -> $AFTER_PASS"
234+
echo "Failing tests: $BEFORE_FAIL -> $AFTER_FAIL"
235+
236+
# Calculate differences
237+
PASS_DIFF=$((AFTER_PASS - BEFORE_PASS))
238+
FAIL_DIFF=$((AFTER_FAIL - BEFORE_FAIL))
239+
240+
echo "Pass difference: $PASS_DIFF"
241+
echo "Fail difference: $FAIL_DIFF"
242+
243+
# Check for regression (more than 3 tests difference)
244+
REGRESSION=0
245+
246+
if [ $PASS_DIFF -lt -3 ]; then
247+
echo "::error::Regression detected: $PASS_DIFF passing tests (threshold: -3)"
248+
REGRESSION=1
249+
fi
250+
251+
if [ $FAIL_DIFF -gt 3 ]; then
252+
echo "::error::Regression detected: +$FAIL_DIFF failing tests (threshold: +3)"
253+
REGRESSION=1
254+
fi
255+
256+
if [ $REGRESSION -eq 1 ]; then
257+
echo "::error::Test regression exceeds acceptable threshold of 3 tests"
258+
exit 1
259+
else
260+
echo "::notice::Test results within acceptable range (threshold: ±3 tests)"
229261
fi
230262
else
231-
echo "No previous results found, skipping comparison"
263+
echo "::warning::No previous successful test results found for branch ${{ github.ref_name }}, skipping comparison"
232264
fi

0 commit comments

Comments
 (0)