Fix the issue that the make ktest CI could not identify failed results
This commit is contained in:
parent
b0407dd517
commit
f2a5a0075e
29
Makefile
29
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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue