Skip to content

feat(test): 增加系统启动后执行syscall集成测试的make命令并将其加入流水线中#1306

Merged
fslongjin merged 7 commits intoDragonOS-Community:masterfrom
1037827920:feat-syscall-test
Oct 9, 2025
Merged

feat(test): 增加系统启动后执行syscall集成测试的make命令并将其加入流水线中#1306
fslongjin merged 7 commits intoDragonOS-Community:masterfrom
1037827920:feat-syscall-test

Conversation

@1037827920
Copy link
Contributor

新的make命令

可以在本地执行make test-syscall命令启动DragonOS后自动执行gvisor syscall测试套,测试完成后会退出qemu。同时根据测试用例成功率选择是成功返回还是失败返回,成功率不等于100%则失败返回。该命令的执行流程如下:

  1. 执行enable_compile_gvisor.sh注释app-blocklist.toml中有关于屏蔽gvisor测试套的配置
  2. 编译DragonOS
  3. 写入镜像
  4. 后台qemu无图形模式启动DragonOS,同时设置环境变量AUTO_TEST(自动测试选项,目前仅支持syscall测试)和SYSCALL_TEST_DIR(测试套所在目录),这两个环境变量会通过命令行参数传递到DragonOS。然后当busybox init进程执行rcS脚本时,该脚本会通过AUTO_TEST选项执行对应的测试
  5. 执行monitor_test_results.sh定时查看qemu串口输出内容,并根据测试结果选择成功返回还是失败返回
  6. 执行disable_compile_gvisor.sh取消app-blocklist.toml中有关于屏蔽gvisor测试套的配置注释

新的流水线job

新增test-x86.yml workflow,用来测试x86架构的DragonOS,目前仅支持了syscall测试这个job

@github-actions github-actions bot added the enhancement New feature or request label Oct 6, 2025
@1037827920 1037827920 requested a review from fslongjin October 6, 2025 16:03
@fslongjin
Copy link
Member

good job!

Copilot AI review requested due to automatic review settings October 8, 2025 12:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
QEMU_PID=${QEMU_PID}
QEMU_PID=$(pgrep -f qemu)

Copilot uses AI. Check for mistakes.
Comment on lines +161 to +164
$(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
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
$(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; \
}

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,31 @@
name: Test x86_64
description: Run tests on x86_64 architecture
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Actions workflows should not have a 'description' field at the root level. This field is not recognized and should be removed.

Suggested change
description: Run tests on x86_64 architecture

Copilot uses AI. Check for mistakes.
cursor[bot]

This comment was marked as outdated.

@fslongjin fslongjin merged commit b74420f into DragonOS-Community:master Oct 9, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants