diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index af27fe97a..8d9ff57ca 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -28,6 +28,10 @@ jobs: id: syscall_test_linux run: make run AUTO_TEST=syscall ENABLE_KVM=0 BOOT_PROTOCOL=linux RELEASE_MODE=1 + - name: Regression Test (Linux Boot Portocol) + id: regression_test_linux + run: make run AUTO_TEST=regression ENABLE_KVM=0 BOOT_PROTOCOL=multiboot2 RELEASE_MODE=1 + - name: Syscall Test (MicroVM) id: syscall_test_microvm run: make run AUTO_TEST=syscall ENABLE_KVM=0 BOOT_METHOD=microvm RELEASE_MODE=1 diff --git a/Makefile b/Makefile index 33a2a6bd2..062aec034 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,9 @@ ifeq ($(AUTO_TEST), syscall) BUILD_SYSCALL_TEST := 1 INIT_CMDLINE += /opt/syscall_test/run_syscall_test.sh endif +ifeq ($(AUTO_TEST), regression) +INIT_CMDLINE += /regression/run_regression_test.sh +endif ifeq ($(AUTO_TEST), boot) INIT_CMDLINE += -c exit 0 endif diff --git a/README.md b/README.md index 7099bfe22..5113845b0 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,15 @@ cargo component-check ### Integration Test +#### Regression Test + +This command will automatically run Jinux with the test binaries in `regression/apps` directory. +```bash +make run AUTO_TEST=regression +``` + +#### Syscall Test + This command will build the syscall test binary and automatically run Jinux with the tests using QEMU. ```bash make run AUTO_TEST=syscall diff --git a/regression/apps/scripts/nettest.sh b/regression/apps/scripts/network.sh similarity index 69% rename from regression/apps/scripts/nettest.sh rename to regression/apps/scripts/network.sh index 12c10fae5..ec3988535 100755 --- a/regression/apps/scripts/nettest.sh +++ b/regression/apps/scripts/network.sh @@ -1,8 +1,10 @@ #!/bin/sh +set -e + NETTEST_DIR=/regression/network cd ${NETTEST_DIR} -echo "Start net test......" +echo "Start network test......" ./tcp_server & ./tcp_client ./udp_server & @@ -11,4 +13,4 @@ echo "Start net test......" ./unix_client ./socketpair -echo "All net test passed" +echo "All network test passed" diff --git a/regression/apps/scripts/run_tests.sh b/regression/apps/scripts/process.sh similarity index 83% rename from regression/apps/scripts/run_tests.sh rename to regression/apps/scripts/process.sh index d39bc5442..9e8145891 100755 --- a/regression/apps/scripts/run_tests.sh +++ b/regression/apps/scripts/process.sh @@ -5,11 +5,11 @@ set -e SCRIPT_DIR=/regression cd ${SCRIPT_DIR}/.. -echo "Running tests......" +echo "Start process test......" tests="hello_world/hello_world fork/fork execve/execve fork_c/fork signal_c/signal_test pthread/pthread_test hello_pie/hello pty/open_pty" for testcase in ${tests} do echo "Running test ${testcase}......" ${SCRIPT_DIR}/${testcase} done -echo "All tests passed" \ No newline at end of file +echo "All process test passed." \ No newline at end of file diff --git a/regression/apps/scripts/run_regression_test.sh b/regression/apps/scripts/run_regression_test.sh new file mode 100755 index 000000000..1dbba1474 --- /dev/null +++ b/regression/apps/scripts/run_regression_test.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +SCRIPT_DIR=/regression +cd ${SCRIPT_DIR} + +./shell_cmd.sh +./process.sh +./network.sh diff --git a/regression/apps/scripts/test_cmd.sh b/regression/apps/scripts/shell_cmd.sh similarity index 60% rename from regression/apps/scripts/test_cmd.sh rename to regression/apps/scripts/shell_cmd.sh index f3961ed99..36afa6c5d 100755 --- a/regression/apps/scripts/test_cmd.sh +++ b/regression/apps/scripts/shell_cmd.sh @@ -10,23 +10,23 @@ touch hello.txt mv hello.txt hello_world.txt rm hello_world.txt -awk '{print $2}' test_cmd.sh -cp test_cmd.sh test_cmd_backup.sh -cat test_cmd_backup.sh -rm test_cmd_backup.sh +awk '{print $2}' shell_cmd.sh +cp shell_cmd.sh shell_cmd_backup.sh +cat shell_cmd_backup.sh +rm shell_cmd_backup.sh -ln -s test_cmd.sh tesk_cmd_soft_link +ln -s shell_cmd.sh tesk_cmd_soft_link readlink -f tesk_cmd_soft_link tail -n 1 tesk_cmd_soft_link rm tesk_cmd_soft_link -ln test_cmd.sh tesk_cmd_hard_link +ln shell_cmd.sh tesk_cmd_hard_link tail -n 1 tesk_cmd_hard_link unlink tesk_cmd_hard_link -sed 3q test_cmd.sh +sed 3q shell_cmd.sh -find . -name "*test_cmd*" +find . -name "*shell_cmd*" mkdir foo rmdir foo