diff --git a/Makefile b/Makefile index 1f5a617f8..a7436208b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/regression/apps/scripts/boot_hello.sh b/regression/apps/scripts/boot_hello.sh new file mode 100644 index 000000000..20149225f --- /dev/null +++ b/regression/apps/scripts/boot_hello.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +echo "Successfully booted." diff --git a/regression/apps/scripts/run_regression_test.sh b/regression/apps/scripts/run_regression_test.sh index 57d87ae15..59d515bbd 100755 --- a/regression/apps/scripts/run_regression_test.sh +++ b/regression/apps/scripts/run_regression_test.sh @@ -10,3 +10,5 @@ cd ${SCRIPT_DIR} ./shell_cmd.sh ./process.sh ./network.sh + +echo "All regression tests passed." diff --git a/regression/syscall_test/run_syscall_test.sh b/regression/syscall_test/run_syscall_test.sh index 480c93f35..d87ee2ccf 100755 --- a/regression/syscall_test/run_syscall_test.sh +++ b/regression/syscall_test/run_syscall_test.sh @@ -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