This commit is contained in:
Chengjun Chen 2026-02-11 17:01:27 +08:00 committed by GitHub
commit 1050e97680
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 8 deletions

View File

@ -402,19 +402,33 @@ test:
done
.PHONY: ktest
ktest: CONSOLE = ttyS0
ktest: initramfs $(CARGO_OSDK)
@# Notes:
@# 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)