Fix the issue that the make ktest CI could not identify failed results
This commit is contained in:
parent
b0407dd517
commit
f2a5a0075e
25
Makefile
25
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;
|
@# 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
|
@# 2. Artifacts are removed after testing each crate to save the limited disk space
|
||||||
@# available to free-tier Github runners.
|
@# available to free-tier Github runners.
|
||||||
@for dir in $(OSDK_CRATES); do \
|
@# 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; \
|
[ $$dir = "ostd/libs/linux-bzimage/setup" ] && continue; \
|
||||||
echo "[make] Testing $$dir"; \
|
echo "[make] Testing $$dir"; \
|
||||||
(cd $$dir && cargo osdk test $(CARGO_OSDK_TEST_ARGS)) || exit 1; \
|
if ! (cd $$dir && cargo osdk test $(CARGO_OSDK_TEST_ARGS)); then \
|
||||||
tail --lines 10 qemu.log | grep -q "^\\[ktest runner\\] All crates tested." \
|
echo "ERROR: Testing $$dir failed"; \
|
||||||
|| (echo "Test failed" && exit 1); \
|
failed=1; \
|
||||||
rm -r target/osdk/*; \
|
elif ! tail --lines 10 qemu.log | grep -q "^\\[ktest runner\\] All crates tested."; then \
|
||||||
done
|
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
|
.PHONY: docs
|
||||||
docs: $(CARGO_OSDK)
|
docs: $(CARGO_OSDK)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue