Check if we truly pass the tests in auto test

This commit is contained in:
Zhang Junyang
2024-04-09 12:34:01 +08:00
committed by Tate, Hongliang Tian
parent e3cb4d25e3
commit 63be797c2d
4 changed files with 23 additions and 8 deletions

View File

@ -26,12 +26,10 @@ BUILD_SYSCALL_TEST := 1
CARGO_OSDK_ARGS += --kcmd_args="SYSCALL_TEST_DIR=$(SYSCALL_TEST_DIR)"
CARGO_OSDK_ARGS += --kcmd_args="EXTRA_BLOCKLISTS_DIRS=$(EXTRA_BLOCKLISTS_DIRS)"
CARGO_OSDK_ARGS += --init_args="/opt/syscall_test/run_syscall_test.sh"
endif
ifeq ($(AUTO_TEST), regression)
else ifeq ($(AUTO_TEST), regression)
CARGO_OSDK_ARGS += --init_args="/regression/run_regression_test.sh"
endif
ifeq ($(AUTO_TEST), boot)
CARGO_OSDK_ARGS += --init_args="-c exit 0"
else ifeq ($(AUTO_TEST), boot)
CARGO_OSDK_ARGS += --init_args="/regression/boot_hello.sh"
endif
ifeq ($(RELEASE_MODE), 1)
@ -122,7 +120,7 @@ initramfs:
.PHONY: build
build: initramfs $(CARGO_OSDK)
cargo osdk build $(CARGO_OSDK_ARGS)
@cargo osdk build $(CARGO_OSDK_ARGS)
.PHONY: tools
tools:
@ -131,6 +129,14 @@ tools:
.PHONY: run
run: build
@cargo osdk run $(CARGO_OSDK_ARGS)
# Check the running status of auto tests from the QEMU log
ifeq ($(AUTO_TEST), syscall)
@tail --lines 100 qemu.log | grep -q "^.* of .* test cases passed." || (echo "Syscall test failed" && exit 1)
else ifeq ($(AUTO_TEST), regression)
@tail --lines 100 qemu.log | grep -q "^All regression tests passed." || (echo "Regression test failed" && exit 1)
else ifeq ($(AUTO_TEST), boot)
@tail --lines 100 qemu.log | grep -q "^Successfully booted." || (echo "Boot test failed" && exit 1)
endif
.PHONY: gdb_server
gdb_server: build

View File

@ -0,0 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
echo "Successfully booted."

View File

@ -10,3 +10,5 @@ cd ${SCRIPT_DIR}
./shell_cmd.sh
./process.sh
./network.sh
echo "All regression tests passed."

View File

@ -65,10 +65,10 @@ for syscall_test in $(find $TEST_BIN_DIR/. -name \*_test) ; do
fi
done
echo -e "$GREEN$PASSED_TESTS$NC of $GREEN$TESTS$NC test cases are passed."
echo -e "$GREEN$PASSED_TESTS$NC of $GREEN$TESTS$NC test cases passed."
[ $PASSED_TESTS -ne $TESTS ] && RESULT=1
if [ $TESTS != $PASSED_TESTS ]; then
echo -e "The $RED$(($TESTS-$PASSED_TESTS))$NC failed test cases in this run are as follows:"
echo -e "The $RED$(($TESTS-$PASSED_TESTS))$NC failed test cases are as follows:"
cat $FAIL_CASES
fi