gvisor_syscall_test.rst 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. .. note:: AI Translation Notice
  2. This document was automatically translated by `hunyuan-turbos-latest` model, for reference only.
  3. - Source document: kernel/ktest/gvisor_syscall_test.rst
  4. - Translation time: 2025-10-09 14:36:26
  5. - Translation model: `hunyuan-turbos-latest`
  6. Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
  7. ==============================
  8. gVisor System Call Testing
  9. ==============================
  10. DragonOS integrates the gVisor system call test suite to verify the compatibility and correctness of the operating system's system call implementations.
  11. Overview
  12. ========
  13. gVisor is a container runtime sandbox developed by Google, which includes a comprehensive set of system call compatibility tests. These tests are designed to validate whether an operating system's system call implementation complies with Linux standards.
  14. Key Features:
  15. - **Comprehensive Test Coverage**: Contains hundreds of system call test cases
  16. - **Whitelist Mechanism**: By default, only verified tests are executed, with support gradually expanding
  17. - **Blacklist Filtering**: Allows blocking specific test cases for each test program
  18. - **Automated Execution**: Provides Makefile and scripts to simplify the testing process
  19. Automated Testing
  20. ==========
  21. Execute the `make test-syscall` command. This command will launch DragonOS and automatically execute the gvisor syscall test suite. After testing completes, it will exit qemu. The return status will be success or failure based on the test case success rate - returning failure if the success rate is not 100%. The execution flow of this command is as follows:
  22. 1. Execute the configuration in `enable_compile_gvisor.sh` comment `app-blocklist.toml` regarding blocking the gvisor test suite
  23. 2. Compile DragonOS
  24. 3. Write the image
  25. 4. Start DragonOS in qemu background mode (without graphics), while setting environment variables `AUTO_TEST` (auto-test option, currently only supports syscall testing) and `SYSCALL_TEST_DIR` (test suite directory). These environment variables will be passed to DragonOS as command-line parameters. Then when the busybox init process executes the rcS script, this script will execute the corresponding test through the `AUTO_TEST` option
  26. 5. Execute `monitor_test_results.sh` to periodically check the qemu serial output content and determine success or failure return based on test results
  27. 6. Execute `disable_compile_gvisor.sh` to uncomment the configuration in `app-blocklist.toml` regarding blocking the gvisor test suite
  28. The corresponding workflow configuration file is `test-x86.yml`
  29. Manual Testing
  30. ==========
  31. 1. Enter the test directory:
  32. .. code-block:: bash
  33. cd user/apps/tests/syscall/gvisor
  34. 2. Run whitelist tests on Linux (automatically downloads the test suite):
  35. .. code-block:: bash
  36. make test
  37. 3. If you need to run tests, first modify the configuration file:
  38. Edit `config/app-blocklist.toml`, and comment out the following content:
  39. .. code-block:: toml
  40. # Block gvisor system call tests
  41. # [[blocked_apps]]
  42. # name = "gvisor syscall tests"
  43. # reason = "Blocked due to large file size. To allow system call tests, uncomment these lines"
  44. 4. Run tests within the DragonOS system:
  45. Enter the installation directory and run the test program:
  46. .. code-block:: bash
  47. cd /opt/tests/gvisor
  48. ./gvisor-test-runner --help
  49. Use `_translated_label__`./gvisor-test-runner`_en` to run specific test cases.
  50. 5. View detailed documentation:
  51. Please refer to `user/apps/tests/syscall/gvisor/README.md` for complete usage instructions.
  52. Testing Mechanism
  53. ==========
  54. Whitelist Mode
  55. -----------
  56. The test framework enables whitelist mode by default, running only the test programs specified in `_translated_label__`whitelist.txt`_en`. This allows for gradual verification of DragonOS's system call implementations.
  57. Blacklist Filtering
  58. -----------
  59. For each test program, specific test cases can be blocked through files in the `_translated_label__`blocklists/`_en` directory. This is particularly useful for skipping unsupported or unstable tests.
  60. More Detailed Information
  61. ==============
  62. For detailed usage methods, configuration options, and development guides regarding gVisor system call testing, please consult the README.md documentation in the test directory:
  63. - Documentation location: `user/apps/tests/syscall/gvisor/README.md`