feat(test): 增加系统启动后执行syscall集成测试的make命令并将其加入流水线中#1306
feat(test): 增加系统启动后执行syscall集成测试的make命令并将其加入流水线中#1306fslongjin merged 7 commits intoDragonOS-Community:masterfrom
Conversation
|
good job! |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an automated integration testing system for syscall tests after DragonOS system startup. The main purpose is to add a new make command make test-syscall that starts DragonOS, automatically executes gvisor syscall test suite, and exits QEMU upon completion with success/failure status based on test results.
Key changes:
- Automated syscall testing workflow with environment variable-based test execution
- New make target with supporting shell scripts for enabling/disabling gvisor compilation
- GitHub Actions workflow integration for CI/CD testing on x86_64 architecture
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| user/sysconfig/etc/init.d/rcS | Adds auto-test logic based on AUTO_TEST environment variable |
| user/apps/tests/syscall/gvisor/run_tests.sh | New test runner script for executing gvisor tests |
| user/apps/tests/syscall/gvisor/monitor_test_results.sh | Monitors test results and exits with appropriate status codes |
| user/apps/tests/syscall/gvisor/enable_compile_gvisor.sh | Enables gvisor compilation by commenting out blocklist entries |
| user/apps/tests/syscall/gvisor/disable_compile_gvisor.sh | Restores gvisor blocklist configuration |
| user/apps/tests/syscall/gvisor/Makefile | Includes run_tests.sh in installation |
| tools/run-qemu.sh | Adds AUTO_TEST and SYSCALL_TEST_DIR environment variables to kernel command line |
| docs/kernel/ktest/gvisor_syscall_test.rst | Documents the new automated testing feature |
| docs/introduction/build_system.md | Documents the new make test-syscall command |
| Makefile | Implements test-syscall target with complete workflow |
| .github/workflows/test-x86.yml | Adds GitHub Actions workflow for automated testing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| # 串口文件路径 | ||
| SERIAL_FILE="serial_opt.txt" | ||
| # qemu进程PID | ||
| QEMU_PID=${QEMU_PID} |
There was a problem hiding this comment.
The QEMU_PID variable assignment is redundant and doesn't capture the actual PID. This will be empty unless QEMU_PID is already set in the environment.
| QEMU_PID=${QEMU_PID} | |
| QEMU_PID=$(pgrep -f qemu) |
| $(MAKE) qemu-nographic AUTO_TEST=syscall SYSCALL_TEST_DIR=/opt/tests/gvisor & | ||
| QEMU_PID=$$! | ||
| bash user/apps/tests/syscall/gvisor/monitor_test_results.sh || { bash user/apps/tests/syscall/gvisor/disable_compile_gvisor.sh; exit 1; } | ||
| bash user/apps/tests/syscall/gvisor/disable_compile_gvisor.sh |
There was a problem hiding this comment.
The QEMU_PID assignment happens after the background process is started but in a separate shell context. The PID won't be available to the monitor script. Consider exporting it or passing it as a parameter.
| $(MAKE) qemu-nographic AUTO_TEST=syscall SYSCALL_TEST_DIR=/opt/tests/gvisor & | |
| QEMU_PID=$$! | |
| bash user/apps/tests/syscall/gvisor/monitor_test_results.sh || { bash user/apps/tests/syscall/gvisor/disable_compile_gvisor.sh; exit 1; } | |
| bash user/apps/tests/syscall/gvisor/disable_compile_gvisor.sh | |
| { \ | |
| $(MAKE) qemu-nographic AUTO_TEST=syscall SYSCALL_TEST_DIR=/opt/tests/gvisor & \ | |
| QEMU_PID=$$!; \ | |
| bash user/apps/tests/syscall/gvisor/monitor_test_results.sh $$QEMU_PID || { bash user/apps/tests/syscall/gvisor/disable_compile_gvisor.sh; exit 1; }; \ | |
| bash user/apps/tests/syscall/gvisor/disable_compile_gvisor.sh; \ | |
| } |
.github/workflows/test-x86.yml
Outdated
| @@ -0,0 +1,31 @@ | |||
| name: Test x86_64 | |||
| description: Run tests on x86_64 architecture | |||
There was a problem hiding this comment.
GitHub Actions workflows should not have a 'description' field at the root level. This field is not recognized and should be removed.
| description: Run tests on x86_64 architecture |
11ad851 to
3485565
Compare
新的make命令
可以在本地执行
make test-syscall命令启动DragonOS后自动执行gvisor syscall测试套,测试完成后会退出qemu。同时根据测试用例成功率选择是成功返回还是失败返回,成功率不等于100%则失败返回。该命令的执行流程如下:enable_compile_gvisor.sh注释app-blocklist.toml中有关于屏蔽gvisor测试套的配置AUTO_TEST(自动测试选项,目前仅支持syscall测试)和SYSCALL_TEST_DIR(测试套所在目录),这两个环境变量会通过命令行参数传递到DragonOS。然后当busybox init进程执行rcS脚本时,该脚本会通过AUTO_TEST选项执行对应的测试monitor_test_results.sh定时查看qemu串口输出内容,并根据测试结果选择成功返回还是失败返回disable_compile_gvisor.sh取消app-blocklist.toml中有关于屏蔽gvisor测试套的配置注释新的流水线job
新增
test-x86.ymlworkflow,用来测试x86架构的DragonOS,目前仅支持了syscall测试这个job