From f2a5a0075ebc0ac7fd75de484a919f8d7f2c97b0 Mon Sep 17 00:00:00 2001 From: Chen Chengjun Date: Tue, 10 Feb 2026 02:36:54 +0000 Subject: [PATCH] Fix the issue that the make ktest CI could not identify failed results --- Makefile | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 7bac4db33..f8442eab0 100644 --- a/Makefile +++ b/Makefile @@ -404,14 +404,27 @@ ktest: initramfs $(CARGO_OSDK) @# 1. linux-bzimage-setup is excluded from ktest since it's hard to be unit tested; @# 2. Artifacts are removed after testing each crate to save the limited disk space @# available to free-tier Github runners. - @for dir in $(OSDK_CRATES); do \ - [ $$dir = "ostd/libs/linux-bzimage/setup" ] && continue; \ - echo "[make] Testing $$dir"; \ - (cd $$dir && cargo osdk test $(CARGO_OSDK_TEST_ARGS)) || exit 1; \ - tail --lines 10 qemu.log | grep -q "^\\[ktest runner\\] All crates tested." \ - || (echo "Test failed" && exit 1); \ - rm -r target/osdk/*; \ - done + @# 3. Even if a crate test fails, we continue testing other crates but mark + @# the overall result as failed. + @failed=0; \ + for dir in $(OSDK_CRATES); do \ + [ $$dir = "ostd/libs/linux-bzimage/setup" ] && continue; \ + echo "[make] Testing $$dir"; \ + if ! (cd $$dir && cargo osdk test $(CARGO_OSDK_TEST_ARGS)); then \ + echo "ERROR: Testing $$dir failed"; \ + failed=1; \ + elif ! tail --lines 10 qemu.log | grep -q "^\\[ktest runner\\] All crates tested."; then \ + echo "ERROR: Test verification failed for $$dir"; \ + failed=1; \ + fi; \ + rm -rf target/osdk/*; \ + done; \ + if [ $$failed -ne 0 ]; then \ + echo "SUMMARY: Some crate tests failed"; \ + exit 1; \ + else \ + echo "SUMMARY: All crate tests passed"; \ + fi .PHONY: docs docs: $(CARGO_OSDK)