From: Ricardo B. Marlière rbm@suse.com
[ Upstream commit 2a912258c90e895363c0ffc0be8a47f112ab67b7 ]
Currently, even if some subtests fails, the end result will still yield "ok 1 selftests: bpf: test_xsk.sh". Fix it by exiting with 1 if there are any failures.
Signed-off-by: Ricardo B. Marlière rbm@suse.com Signed-off-by: Andrii Nakryiko andrii@kernel.org Acked-by: Magnus Karlsson magnus.karlsson@intel.com Link: https://lore.kernel.org/bpf/20250828-selftests-bpf-test_xsk_ret-v1-1-e6656c0... Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
Based on my comprehensive analysis, here is my determination:
**Backport Status: YES**
## Analysis
### Code Change The commit adds a simple 2-line fix to ensure the test script exits with code 1 when failures occur: ```bash +else + exit 1 ```
### Rationale for Backporting
**1. Pattern of Similar Backports** My research shows that similar test exit code fixes have been consistently backported to stable kernels: - `selftests/net: have gro.sh -t return a correct exit code` (commit 784e6abd99f24) was backported by AUTOSEL - `selftests: ksft: Fix finished() helper exit code on skipped tests` (commit 170c966cbe274) was backported by AUTOSEL - `selftests: xsk: fix reporting of failed tests` (commit 895b62eed2ab4) was backported to stable 6.1 branches
**2. Critical for Testing Infrastructure** This fix addresses a real bug in test reporting that affects: - **CI/Automated Testing**: Systems running selftests on stable kernels rely on correct exit codes to detect regressions - **False Positives**: The current behavior reports "ok" even when tests fail, masking real problems - **Quality Assurance**: Proper exit codes are essential for stable kernel validation
**3. Meets Stable Kernel Rules** According to Documentation/process/stable-kernel-rules.rst: - ✅ **Obviously correct**: Trivial 2-line addition with clear intent - ✅ **Small and contained**: Only 2 lines in a single shell script - ✅ **Fixes a real bug**: Test infrastructure incorrectly reporting success on failures - ✅ **Already in mainline**: Commit 2a912258c90e exists in upstream - ✅ **Minimal risk**: Changes only test infrastructure, cannot affect kernel runtime - ✅ **Benefits users**: Helps developers and organizations running tests on stable kernels
**4. Historical Evidence** The commit 8f610b24a1a44 shows this has already been selected by AUTOSEL for backporting, with the marker `[ Upstream commit 2a912258c90e895363c0ffc0be8a47f112ab67b7 ]` and signed by Sasha Levin.
### Conclusion This is a clear candidate for stable backporting. It fixes test infrastructure that provides critical validation for stable kernels, follows established backporting patterns for similar fixes, and meets all stable kernel rules criteria.
tools/testing/selftests/bpf/test_xsk.sh | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh index 65aafe0003db0..62db060298a4a 100755 --- a/tools/testing/selftests/bpf/test_xsk.sh +++ b/tools/testing/selftests/bpf/test_xsk.sh @@ -241,4 +241,6 @@ done
if [ $failures -eq 0 ]; then echo "All tests successful!" +else + exit 1 fi