Compare commits

..

48 Commits

Author SHA1 Message Date
chainsx bb8b024d56 fix: compatibility: test_ltp_posix_pthread_pthread_mutex_trylock 2026-07-13 05:29:24 +00:00
redrose2100 fab039059f Merge pull request 'fix: prevent exec() from hanging on long-running sudo commands' (#105) from dev into main
Reviewed-on: woqidaideshi/openruyi-autotest#105
2026-07-16 09:52:19 +00:00
honghua 32d1d1bfc4 chore: add requirements.txt for cloudpods create_server.py 2026-07-16 17:49:53 +08:00
honghua ab93958db5 chore: normalize line endings to LF per .gitattributes 2026-07-16 16:19:38 +08:00
honghua 360ec8daaf fix: use select.poll on channel fd instead of settimeout which is unreliable across paramiko versions 2026-07-15 17:55:05 +08:00
honghua 2a22c7ac96 fix: remove get_pty() causing exit_status_ready() to never return true on some SSH servers 2026-07-15 17:50:18 +08:00
honghua efb7980499 fix: remove is_sshable race condition causing false SSH timeout after connect 2026-07-15 17:44:24 +08:00
honghua 54468c3291 fix: replace select+nonblocking with short socket timeout for more reliable SSH exec I/O polling 2026-07-15 17:31:40 +08:00
honghua e30e2cb789 fix: skip sudo password injection for root user in wait_for_sshable 2026-07-15 17:21:04 +08:00
honghua 9de29d952c fix: rewrite SSH exec I/O polling with select to fix PTY recv stall 2026-07-15 16:47:30 +08:00
honghua bc3e36c268 fix: give each QEMU VM its own UEFI VARS file to prevent firmware corruption 2026-07-15 16:20:17 +08:00
honghua 026f62f7b0 fix: elevate timeout and non-zero exit logs to ERROR level for better visibility 2026-07-15 15:19:46 +08:00
honghua 316311151b fix: use wildcard repo path for guest VM sed, compatible with all distro repo filenames 2026-07-15 15:11:26 +08:00
honghua cdbdbe9127 fix: auto-inject sudo password for QEMU guest via SSHClient sudo_password param 2026-07-15 14:44:59 +08:00
honghua 70eb880357 fix: prevent exec() from hanging on long-running sudo commands by using short socket timeout with polling 2026-07-15 14:09:18 +08:00
honghua 400d9ded86 chore: rename user/password to cloudpods_server_user/cloudpods_server_password 2026-07-15 12:28:42 +08:00
honghua 89bb8016ca fix: use echo password | sudo -S ls / for SSH readiness check 2026-07-15 12:24:49 +08:00
honghua b3d4caeff5 fix: remove sudo from wait_for_sshable check, qemu user lacks passwordless sudo 2026-07-15 12:21:48 +08:00
honghua 400976e76e fix: add progress log for long-running commands, reduce dnf makecache timeout to 600s 2026-07-15 10:49:12 +08:00
honghua 80f24d275c fix: per-QEMU CPU/memory now configurable, default 8C/8G, SKU upgraded to c16m16 2026-07-15 10:23:36 +08:00
honghua 6dfb60f7f7 fix: suppress all paramiko traceback noise during SSH wait 2026-07-15 09:43:23 +08:00
honghua 2e91949595 feat: loop all CloudPods hosts for QEMU setup, collect bridge IPs per host 2026-07-15 09:19:43 +08:00
honghua 06325da554 feat: add tools/cloudpods/create_server.py for RISC-V QEMU VM creation 2026-07-14 16:21:33 +08:00
honghua e11446a13c chore: remove tools directory 2026-07-14 15:34:58 +08:00
honghua 50deeab3b1 chore: remove create_cloudpods_server.py 2026-07-14 15:34:31 +08:00
honghua f865a62d95 refactor: rename cloudpods_launcher to create_cloudpods_server and extract Env config class; chore: remove blank lines from fmf files via convert_indent 2026-07-14 14:25:03 +08:00
honghua 7f677ed855 Merge branch 'main' of ssh://git.openruyi.cn:54865/woqidaideshi/openruyi-autotest into dev 2026-07-14 12:13:38 +08:00
redrose2100 1ad9a91fdd Merge pull request 'feat: code quality standardization - indent, unittests, i18n, tmt compliance, docs' (#104) from fix-0713 into main
Reviewed-on: woqidaideshi/openruyi-autotest#104
2026-07-14 04:12:40 +00:00
honghua 48ff6ea190 docs: add unit tests section to development guide (EN/ZH) 2026-07-14 11:16:43 +08:00
honghua a4b1a75673 chore: rename tests_quality to unittests 2026-07-14 10:59:40 +08:00
honghua cbac17e315 feat: convert all .sh files to 4-space indentation, add indentation unit tests 2026-07-14 10:49:54 +08:00
honghua bc01dae4ba chore: remove __pycache__ from tracking, update .gitignore 2026-07-14 09:36:52 +08:00
honghua 2e6c7dc3c3 feat: add tests_quality unit tests and fix CRLF/executable issues in .sh files 2026-07-14 09:36:18 +08:00
honghua 7d163f5037 fix: add missing space after 'test:' in all main.fmf YAML files 2026-07-13 16:25:49 +08:00
honghua b8577f5c3e fix(csmith): add missing space in test_csmith_lto main.fmf YAML 2026-07-13 16:21:48 +08:00
honghua add739955d fix: rename hardware-require to extra-hardware-require to comply with tmt custom key naming 2026-07-13 16:02:35 +08:00
redrose2100 1d01dd8e0f Merge pull request 'docs: add full English documentation and translate all Chinese text to English' (#103) from fix-0713 into main
Reviewed-on: woqidaideshi/openruyi-autotest#103
2026-07-13 07:50:00 +00:00
honghua 95a33a8a5c docs: translate all plans/*.fmf comments and summaries to English 2026-07-13 15:45:14 +08:00
honghua 158e21d55b fix: rename README.zh.md to README_CN.md to avoid Gitea language detection 2026-07-13 15:40:58 +08:00
honghua 343fa469ac fix: rename README_zh.md to README.zh.md so Gitea renders README.md first 2026-07-13 15:38:05 +08:00
honghua 11e634eaf7 docs: add English docs, rename CN to *_zh.md with cross-links 2026-07-13 15:15:32 +08:00
honghua abe1c60d06 docs: add English README as homepage, rename CN version to README_zh.md with cross-links 2026-07-13 15:09:29 +08:00
honghua fc166201ee chore: fix fullwidth punctuation, mojibake and concatenated words in tests/ 2026-07-13 14:42:15 +08:00
honghua 91dd1b2d44 chore: fix 514 mojibake instances in 127 test files 2026-07-13 13:50:42 +08:00
honghua c5ca1fab93 chore: translate all Chinese text to English in tests/ 2026-07-13 12:35:22 +08:00
redrose2100 80611d1f76 Merge pull request 'fix: non-root user auto sudo elevation and hardcoded password replacement' (#102) from fix-0713 into main
Reviewed-on: woqidaideshi/openruyi-autotest#102
2026-07-13 02:44:01 +00:00
honghua 0f4991afbe fix: non-root user auto sudo elevation and hardcoded password replacement 2026-07-13 09:12:43 +08:00
honghua bb9ce5f87f chore(ci): add tools 2026-07-13 08:57:49 +08:00
7776 changed files with 94647 additions and 71473 deletions
+3
View File
@@ -15,3 +15,6 @@ AGENTS.md
# 测试服务器拓扑配置(本地敏感信息)
topology.env
# Python 缓存
__pycache__/
+88 -86
View File
@@ -1,116 +1,118 @@
# openruyi-autotest
openruyi-autotest 是基于 [tmt (Test Management Tool)](https://tmt.readthedocs.io/) 框架的自动化测试项目,使用 [BeakerLib](https://github.com/beakerlib/beakerlib) 编写测试脚本,通过 [FMF](https://fmf.readthedocs.io/) 管理元数据。涵盖冒烟测试、功能测试、安全测试、兼容性测试、性能测试、可靠性测试和特性测试七大类,共 726 个测试套、3708 个测试用例(功能测试 281 套 / 3216 用例:566 pkgs + 2407 LTP + 211 kernel + 32 compiler;安全测试 113 套 / 113 用例:98 CVE + 8 nmap + 7 openscap;可靠性测试 12 套 / 12 用例:6 trinity + 6 stress-ng)。
openruyi-autotest is an automated testing project based on the [tmt (Test Management Tool)](https://tmt.readthedocs.io/) framework, using [BeakerLib](https://github.com/beakerlib/beakerlib) for test scripts and [FMF](https://fmf.readthedocs.io/) for metadata management. It covers seven categories: Smoke, Functional, Security, Compatibility, Performance, Reliability, and Feature tests, totaling 726 test suites and 3,708 test cases (Functional: 281 suites / 3,216 cases — 566 pkgs + 2,407 LTP + 211 kernel + 32 compiler; Security: 113 suites / 113 cases — 98 CVE + 8 nmap + 7 openscap; Reliability: 12 suites / 12 cases — 6 trinity + 6 stress-ng).
> :cn: [中文版 (Chinese Version)](README_CN.md)
---
## 一、openruyi-autotest 简介
## 1. Introduction
### 1.1 目录结构
### 1.1 Directory Structure
```
openruyi-autotest/
├── .fmf/ # FMF 元数据根目录
├── .fmf/ # FMF metadata root
│ └── version
├── plans/ # 测试计划
│ ├── smoke.fmf # 冒烟测试计划
│ ├── functional.fmf # 功能测试计划
│ ├── security.fmf # 安全测试计划
│ ├── compatibility.fmf # 兼容性测试计划
│ ├── performance.fmf # 性能测试计划
│ ├── reliability.fmf # 可靠性测试计划
│ ├── feature.fmf # 特性测试计划
│ └── all.fmf # 全量测试计划
├── tests/ # 测试用例
│ ├── main.fmf # 全局共享配置
│ ├── smoke/ # 冒烟测试(100 个用例)
│ ├── functional/ # 功能测试
│ │ ├── kernel/ # 内核功能测试
│ │ │ ├── blktests/ # 块设备测试(195 个用例)
│ │ │ └── realtime/ # 实时性测试(16 个用例)
│ │ ├── ltp/ # LTP 功能测试套件(32 个子模块, 2407 个用例)
│ │ ├── pkgs/ # RPM 软件包功能测试(202 个包, 566 个用例)
│ │ └── compiler/ # 编译器与工具链测试(32 个用例)
│ │ ├── dejagnu/ # DejaGnu GCC 测试框架(9 个用例)
│ │ ├── jotai/ # Jotai 基准程序测试(7 个用例)
│ │ ├── csmith/ # Csmith 随机程序差分测试(8 个用例)
│ │ └── yarpgen/ # YARPGen 优化 Bug 检测(8 个用例)
│ ├── security/ # 安全测试(113 个用例)
│ │ ├── cve/ # CVE 漏洞测试(98 个用例)
│ │ ├── nmap/ # 网络扫描测试(8 个用例)
│ │ ├── openscap/ # 安全合规性测试(7 个用例:4 基础 + 3 CIS
│ │ │ ├── basic/ # 基础 CLI 操作(4 个用例)
│ │ │ └── cis/ # CIS Benchmark3 个用例)
│ ├── compatibility/ # 兼容性测试(188 个用例)
│ ├── performance/ # 性能测试
│ │ ├── mmtests/ # MMTests 基准测试(53 个用例)
│ │ ├── unixbench/ # UnixBench 基准测试(11 个用例)
│ │ ├── iozone/ # IOzone 文件系统 I/O 基准(5 个用例)
│ │ ├── fio/ # fio 存储 I/O 性能测试(6 个用例)
│ │ ├── stream/ # STREAM 内存带宽基准(4 个用例)
│ │ ├── lmbench/ # LMbench 微基准测试(4 个用例)
│ │ └── sysbench/ # sysbench 多线程基准(5 个用例)
│ ├── feature/ # 特性测试
│ └── reliability/ # 可靠性测试
│ ├── trinity/ # Trinity 系统调用 Fuzzer6 个用例)
│ └── stress-ng/ # stress-ng 系统压力测试(6 个用例)
├── docs/ # 文档
├── plans/ # Test plans
│ ├── smoke.fmf # Smoke test plan
│ ├── functional.fmf # Functional test plan
│ ├── security.fmf # Security test plan
│ ├── compatibility.fmf # Compatibility test plan
│ ├── performance.fmf # Performance test plan
│ ├── reliability.fmf # Reliability test plan
│ ├── feature.fmf # Feature test plan
│ └── all.fmf # Full test plan
├── tests/ # Test cases
│ ├── main.fmf # Global shared configuration
│ ├── smoke/ # Smoke tests (100 cases)
│ ├── functional/ # Functional tests
│ │ ├── kernel/ # Kernel functional tests
│ │ │ ├── blktests/ # Block device tests (195 cases)
│ │ │ └── realtime/ # Real-time tests (16 cases)
│ │ ├── ltp/ # LTP functional test suite (32 sub-modules, 2,407 cases)
│ │ ├── pkgs/ # RPM package functional tests (202 packages, 566 cases)
│ │ └── compiler/ # Compiler & toolchain tests (32 cases)
│ │ ├── dejagnu/ # DejaGnu GCC test framework (9 cases)
│ │ ├── jotai/ # Jotai benchmark tests (7 cases)
│ │ ├── csmith/ # Csmith random program differential testing (8 cases)
│ │ └── yarpgen/ # YARPGen optimization bug detection (8 cases)
│ ├── security/ # Security tests (113 cases)
│ │ ├── cve/ # CVE vulnerability tests (98 cases)
│ │ ├── nmap/ # Network scanning tests (8 cases)
│ │ ├── openscap/ # Security compliance tests (7 cases: 4 basic + 3 CIS)
│ │ │ ├── basic/ # Basic CLI operations (4 cases)
│ │ │ └── cis/ # CIS Benchmark (3 cases)
│ ├── compatibility/ # Compatibility tests (188 cases)
│ ├── performance/ # Performance tests
│ │ ├── mmtests/ # MMTests benchmarks (53 cases)
│ │ ├── unixbench/ # UnixBench benchmarks (11 cases)
│ │ ├── iozone/ # IOzone filesystem I/O benchmarks (5 cases)
│ │ ├── fio/ # fio storage I/O performance tests (6 cases)
│ │ ├── stream/ # STREAM memory bandwidth benchmarks (4 cases)
│ │ ├── lmbench/ # LMbench micro-benchmarks (4 cases)
│ │ └── sysbench/ # sysbench multi-threaded benchmarks (5 cases)
│ ├── feature/ # Feature tests
│ └── reliability/ # Reliability tests
│ ├── trinity/ # Trinity syscall fuzzer (6 cases)
│ └── stress-ng/ # stress-ng system stress tests (6 cases)
├── docs/ # Documentation
└── README.md
```
### 1.2 测试覆盖详情
### 1.2 Test Coverage Details
| 分类 | 代表性软件包 | 覆盖要点 |
|------|--------|---------|
| **编译工具** | gcc, g++ (gxx), clang, cmake, make, binutils, autoconf, automake, bison, flex, meson, ninja | C/C++ 编译、链接、优化选项、标准支持 |
| **系统管理** | systemd, systemd-timesyncd, dbus, dbus-broker, chkconfig, kmod, util-linux | 服务管理、日志查询、性能分析、时间同步 |
| **文件/文本工具** | coreutils, tar, grep, sed, gawk, diffutils, findutils, file, gzip, xz, zstd, bzip2, lz4, unzip, cpio, dos2unix | 文件操作、归档、搜索、文本处理 |
| **安全/加密** | openssl, gnutls, libgcrypt, nettle, libtasn1, p11-kit, cryptsetup, pam, libselinux, libseccomp, audit, keyutils, krb5 | 加密算法、TLSACL、审计、认证 |
| **网络工具** | iputils, curl, wget, wget2, iproute2, iptables, libpcap, libnl, nghttp2, libssh, libidn2, libpsl | 网络诊断、文件下载、流量控制 |
| **容器/虚拟化** | podman, podmansh | 镜像管理、容器运行、网络配置 |
| **SSH 工具** | openssh, openssh-clients | 密钥生成、SSH 连接、scp/sftp |
| **版本控制** | git | 仓库初始化、分支操作、远程管理 |
| **脚本/编程语言** | python, perl, lua, tcl, bash, tcsh, expect, swig | 解释器、模块、脚本执行 |
| **库/运行时** | glibc, glib, libffi, libxml2, libxslt, libpng, pcre2, expat, icu4c, libarchive, boost, json-c, sqlite, popt, readline, slang, newt, gmp, mpfr, mpc, mpdecimal, isl, libunistring, libxcrypt, libeconf, libcap, libaio, libbpf, libedit, libevent, libmnl, libnfnetlink, libnetfilter_conntrack, libnftnl, libpwquality, libtirpc, libsodium, nghttp2, libmicrohttpd, xxhash, jitterentropy, libgpg-error, libpsl, publicsuffix-list, iso-codes, brotli, lz4, zstd | 动态库验证、头文件、pkg-config |
| **构建/打包工具** | rpmbuild, rpm, pkgconf, debugedit, dwz, chrpath, patch, pyproject-rpm-macros, python-rpm-macros, python-srpm-macros, python-rpm-generators, perl-rpm-packaging, rpm-config-openruyi, setup, filesystem, config | RPM 包构建、调试信息、宏配置 |
| **显示/桌面** | sddm, weston, labwc, groff, texinfo, help2man, scdoc, xmlto, source-highlight | 显示管理器、Wayland 合成器、文档生成 |
| **测试框架** | atf, cmocka, dejagnu, kyua, lutok, beakerlib | 测试库、测试框架 |
| **其他系统工具** | tmux, cloud-utils-growpart, procps-ng, psmisc, vim, less, bc, time, which, ed, fdupes, lzip, rsync, nfs-utils, cracklib, e2fsprogs, gdb, gdbm, gpm, kbd, lvm2, ncurses, nss, nss_wrapper, pam_wrapper, socket_wrapper, uid_wrapper, perl-Error, perl-Locale-gettext, systemtap, tzdata, unbound, ca-certificates, ca-certificates-mozilla, openruyi-release, linux-headers, pciutils, attr, acl, bash-completion, authselect, cpio, cryptsetup, dbus, dbus-broker, diffutils, elfutils, file, findutils, gawk, git, nghttp2, python-flit-core, python-lxml, python-packaging, python-pip, python-pyelftools, python-setuptools, python-wheel, re2c, scdoc, source-highlight, swig, uid_wrapper, xmlto, xxhash | 终端复用、分区扩容、进程管理、编辑器、时间日期 |
| Category | Representative Packages | Coverage Highlights |
|----------|------------------------|---------------------|
| **Build Tools** | gcc, g++ (gxx), clang, cmake, make, binutils, autoconf, automake, bison, flex, meson, ninja | C/C++ compilation, linking, optimization options, standard support |
| **System Management** | systemd, systemd-timesyncd, dbus, dbus-broker, chkconfig, kmod, util-linux | Service management, log query, performance analysis, time sync |
| **File/Text Tools** | coreutils, tar, grep, sed, gawk, diffutils, findutils, file, gzip, xz, zstd, bzip2, lz4, unzip, cpio, dos2unix | File operations, archiving, search, text processing |
| **Security/Crypto** | openssl, gnutls, libgcrypt, nettle, libtasn1, p11-kit, cryptsetup, pam, libselinux, libseccomp, audit, keyutils, krb5 | Encryption algorithms, TLS, ACL, auditing, authentication |
| **Network Tools** | iputils, curl, wget, wget2, iproute2, iptables, libpcap, libnl, nghttp2, libssh, libidn2, libpsl | Network diagnostics, file download, traffic control |
| **Container/Virtualization** | podman, podmansh | Image management, container runtime, network configuration |
| **SSH Tools** | openssh, openssh-clients | Key generation, SSH connection, scp/sftp |
| **Version Control** | git | Repository initialization, branch operations, remote management |
| **Scripting/Languages** | python, perl, lua, tcl, bash, tcsh, expect, swig | Interpreter, modules, script execution |
| **Libraries/Runtime** | glibc, glib, libffi, libxml2, libxslt, libpng, pcre2, expat, icu4c, libarchive, boost, json-c, sqlite, popt, readline, slang, newt, gmp, mpfr, mpc, mpdecimal, isl, libunistring, libxcrypt, libeconf, libcap, libaio, libbpf, libedit, libevent, libmnl, libnfnetlink, libnetfilter_conntrack, libnftnl, libpwquality, libtirpc, libsodium, nghttp2, libmicrohttpd, xxhash, jitterentropy, libgpg-error, libpsl, publicsuffix-list, iso-codes, brotli, lz4, zstd | Shared library verification, headers, pkg-config |
| **Build/Packaging** | rpmbuild, rpm, pkgconf, debugedit, dwz, chrpath, patch, pyproject-rpm-macros, python-rpm-macros, python-srpm-macros, python-rpm-generators, perl-rpm-packaging, rpm-config-openruyi, setup, filesystem, config | RPM package building, debug info, macro configuration |
| **Display/Desktop** | sddm, weston, labwc, groff, texinfo, help2man, scdoc, xmlto, source-highlight | Display manager, Wayland compositor, documentation generation |
| **Test Frameworks** | atf, cmocka, dejagnu, kyua, lutok, beakerlib | Test libraries, test frameworks |
| **Other System Tools** | tmux, cloud-utils-growpart, procps-ng, psmisc, vim, less, bc, time, which, ed, fdupes, lzip, rsync, nfs-utils, cracklib, e2fsprogs, gdb, gdbm, gpm, kbd, lvm2, ncurses, nss, nss_wrapper, pam_wrapper, socket_wrapper, uid_wrapper, perl-Error, perl-Locale-gettext, systemtap, tzdata, unbound, ca-certificates, ca-certificates-mozilla, openruyi-release, linux-headers, pciutils, attr, acl, bash-completion, authselect, cpio, cryptsetup, dbus, dbus-broker, diffutils, elfutils, file, findutils, gawk, git, nghttp2, python-flit-core, python-lxml, python-packaging, python-pip, python-pyelftools, python-setuptools, python-wheel, re2c, scdoc, source-highlight, swig, uid_wrapper, xmlto, xxhash | Terminal multiplexer, partition resizing, process management, editor, date/time |
### 1.3 用例运行状态统计
### 1.3 Test Case Execution Status
| 测试类型 | 测试套数 | 用例数 | 状态 |
|---------|:---:|:---:|:---:|
| Smoke | 100 | 100 | ✅ 全部通过 |
| Functional | 281 | 3216 | ✅ 全部通过 (566 pkgs + 2407 LTP + 211 kernel + 32 compiler) |
| Security | 113 | 113 | ✅ 全部通过 (98 CVE + 8 nmap + 7 openscap) |
| Compatibility | 188 | 188 | ✅ 通过 (LTP POSIX) |
| Performance | 32 | 84 | 已执行 (11 unixbench + 53 mmtests + 5 iozone + 6 fio + 4 stream + 4 lmbench + 5 sysbench) |
| Reliability | 12 | 12 | 已执行 (6 trinity + 6 stress-ng) |
| Test Type | Suites | Cases | Status |
|-----------|:---:|:---:|:---:|
| Smoke | 100 | 100 | ✅ All Passed |
| Functional | 281 | 3,216 | ✅ All Passed (566 pkgs + 2,407 LTP + 211 kernel + 32 compiler) |
| Security | 113 | 113 | ✅ All Passed (98 CVE + 8 nmap + 7 openscap) |
| Compatibility | 188 | 188 | ✅ Passed (LTP POSIX) |
| Performance | 32 | 84 | Executed (11 unixbench + 53 mmtests + 5 iozone + 6 fio + 4 stream + 4 lmbench + 5 sysbench) |
| Reliability | 12 | 12 | Executed (6 trinity + 6 stress-ng) |
| Feature | 0 | 0 | 🆕 |
| **合计** | **726** | **3708** | |
| **Total** | **726** | **3,708** | |
详情文档:
- [冒烟测试覆盖详情](docs/coverage/smoke-coverage.md)
- [功能测试覆盖详情](docs/coverage/functional-coverage.md)
- [安全测试覆盖详情](docs/coverage/security-coverage.md)
- [兼容性测试覆盖详情](docs/coverage/compatibility-coverage.md)
- [性能测试覆盖详情](docs/coverage/unixbench_results.md)
Detailed documentation:
- [Smoke Test Coverage](docs/coverage/smoke-coverage.md)
- [Functional Test Coverage](docs/coverage/functional-coverage.md)
- [Security Test Coverage](docs/coverage/security-coverage.md)
- [Compatibility Test Coverage](docs/coverage/compatibility-coverage.md)
- [Performance Test Coverage](docs/coverage/unixbench_results.md)
---
## 二、openruyi-autotest 用户指南
## 2. User Guide
参见 [用户指南](docs/user_guide.md) — 涵盖从克隆仓库、安装依赖到执行单个用例、测试套、测试类型全量用例以及全部测试的完整步骤。
See [User Guide](docs/user_guide.md) -- covers complete steps from cloning the repository and installing dependencies to running individual test cases, test suites, full test type runs, and all tests.
---
## 三、openruyi-autotest 开发指南
## 3. Development Guide
参见 [开发指南](docs/development-guide.md) — 涵盖如何添加新测试用例、目录约定、BeakerLib 生命周期、FMF 元数据规范以及命名规范。
See [Development Guide](docs/development-guide.md) -- covers how to add new test cases, directory conventions, BeakerLib lifecycle, FMF metadata specifications, and naming conventions.
---
## 四、openruyi-autotest 测试报告模版
## 4. Test Report Templates
参见 [测试报告模版](docs/test_reports.md) — 涵盖测试概述、各类型测试的套数/用例数/通过/失败/跳过统计表格。
See [Test Report Templates](docs/test_reports.md) -- covers test overview, suite/case/pass/fail/skip statistics tables for each test type.
+118
View File
@@ -0,0 +1,118 @@
# openruyi-autotest
openruyi-autotest 是基于 [tmt (Test Management Tool)](https://tmt.readthedocs.io/) 框架的自动化测试项目,使用 [BeakerLib](https://github.com/beakerlib/beakerlib) 编写测试脚本,通过 [FMF](https://fmf.readthedocs.io/) 管理元数据。涵盖冒烟测试、功能测试、安全测试、兼容性测试、性能测试、可靠性测试和特性测试七大类,共 726 个测试套、3708 个测试用例(功能测试 281 套 / 3216 用例:566 pkgs + 2407 LTP + 211 kernel + 32 compiler;安全测试 113 套 / 113 用例:98 CVE + 8 nmap + 7 openscap;可靠性测试 12 套 / 12 用例:6 trinity + 6 stress-ng)。
> :us: [English Version (英文版)](README.md)
---
## 一、openruyi-autotest 简介
### 1.1 目录结构
```
openruyi-autotest/
├── .fmf/ # FMF 元数据根目录
│ └── version
├── plans/ # 测试计划
│ ├── smoke.fmf # 冒烟测试计划
│ ├── functional.fmf # 功能测试计划
│ ├── security.fmf # 安全测试计划
│ ├── compatibility.fmf # 兼容性测试计划
│ ├── performance.fmf # 性能测试计划
│ ├── reliability.fmf # 可靠性测试计划
│ ├── feature.fmf # 特性测试计划
│ └── all.fmf # 全量测试计划
├── tests/ # 测试用例
│ ├── main.fmf # 全局共享配置
│ ├── smoke/ # 冒烟测试(100 个用例)
│ ├── functional/ # 功能测试
│ │ ├── kernel/ # 内核功能测试
│ │ │ ├── blktests/ # 块设备测试(195 个用例)
│ │ │ └── realtime/ # 实时性测试(16 个用例)
│ │ ├── ltp/ # LTP 功能测试套件(32 个子模块, 2407 个用例)
│ │ ├── pkgs/ # RPM 软件包功能测试(202 个包, 566 个用例)
│ │ └── compiler/ # 编译器与工具链测试(32 个用例)
│ │ ├── dejagnu/ # DejaGnu GCC 测试框架(9 个用例)
│ │ ├── jotai/ # Jotai 基准程序测试(7 个用例)
│ │ ├── csmith/ # Csmith 随机程序差分测试(8 个用例)
│ │ └── yarpgen/ # YARPGen 优化 Bug 检测(8 个用例)
│ ├── security/ # 安全测试(113 个用例)
│ │ ├── cve/ # CVE 漏洞测试(98 个用例)
│ │ ├── nmap/ # 网络扫描测试(8 个用例)
│ │ ├── openscap/ # 安全合规性测试(7 个用例:4 基础 + 3 CIS)
│ │ │ ├── basic/ # 基础 CLI 操作(4 个用例)
│ │ │ └── cis/ # CIS Benchmark3 个用例)
│ ├── compatibility/ # 兼容性测试(188 个用例)
│ ├── performance/ # 性能测试
│ │ ├── mmtests/ # MMTests 基准测试(53 个用例)
│ │ ├── unixbench/ # UnixBench 基准测试(11 个用例)
│ │ ├── iozone/ # IOzone 文件系统 I/O 基准(5 个用例)
│ │ ├── fio/ # fio 存储 I/O 性能测试(6 个用例)
│ │ ├── stream/ # STREAM 内存带宽基准(4 个用例)
│ │ ├── lmbench/ # LMbench 微基准测试(4 个用例)
│ │ └── sysbench/ # sysbench 多线程基准(5 个用例)
│ ├── feature/ # 特性测试
│ └── reliability/ # 可靠性测试
│ ├── trinity/ # Trinity 系统调用 Fuzzer6 个用例)
│ └── stress-ng/ # stress-ng 系统压力测试(6 个用例)
├── docs/ # 文档
└── README.md
```
### 1.2 测试覆盖详情
| 分类 | 代表性软件包 | 覆盖要点 |
|------|--------|---------|
| **编译工具** | gcc, g++ (gxx), clang, cmake, make, binutils, autoconf, automake, bison, flex, meson, ninja | C/C++ 编译、链接、优化选项、标准支持 |
| **系统管理** | systemd, systemd-timesyncd, dbus, dbus-broker, chkconfig, kmod, util-linux | 服务管理、日志查询、性能分析、时间同步 |
| **文件/文本工具** | coreutils, tar, grep, sed, gawk, diffutils, findutils, file, gzip, xz, zstd, bzip2, lz4, unzip, cpio, dos2unix | 文件操作、归档、搜索、文本处理 |
| **安全/加密** | openssl, gnutls, libgcrypt, nettle, libtasn1, p11-kit, cryptsetup, pam, libselinux, libseccomp, audit, keyutils, krb5 | 加密算法、TLS、ACL、审计、认证 |
| **网络工具** | iputils, curl, wget, wget2, iproute2, iptables, libpcap, libnl, nghttp2, libssh, libidn2, libpsl | 网络诊断、文件下载、流量控制 |
| **容器/虚拟化** | podman, podmansh | 镜像管理、容器运行、网络配置 |
| **SSH 工具** | openssh, openssh-clients | 密钥生成、SSH 连接、scp/sftp |
| **版本控制** | git | 仓库初始化、分支操作、远程管理 |
| **脚本/编程语言** | python, perl, lua, tcl, bash, tcsh, expect, swig | 解释器、模块、脚本执行 |
| **库/运行时** | glibc, glib, libffi, libxml2, libxslt, libpng, pcre2, expat, icu4c, libarchive, boost, json-c, sqlite, popt, readline, slang, newt, gmp, mpfr, mpc, mpdecimal, isl, libunistring, libxcrypt, libeconf, libcap, libaio, libbpf, libedit, libevent, libmnl, libnfnetlink, libnetfilter_conntrack, libnftnl, libpwquality, libtirpc, libsodium, nghttp2, libmicrohttpd, xxhash, jitterentropy, libgpg-error, libpsl, publicsuffix-list, iso-codes, brotli, lz4, zstd | 动态库验证、头文件、pkg-config |
| **构建/打包工具** | rpmbuild, rpm, pkgconf, debugedit, dwz, chrpath, patch, pyproject-rpm-macros, python-rpm-macros, python-srpm-macros, python-rpm-generators, perl-rpm-packaging, rpm-config-openruyi, setup, filesystem, config | RPM 包构建、调试信息、宏配置 |
| **显示/桌面** | sddm, weston, labwc, groff, texinfo, help2man, scdoc, xmlto, source-highlight | 显示管理器、Wayland 合成器、文档生成 |
| **测试框架** | atf, cmocka, dejagnu, kyua, lutok, beakerlib | 测试库、测试框架 |
| **其他系统工具** | tmux, cloud-utils-growpart, procps-ng, psmisc, vim, less, bc, time, which, ed, fdupes, lzip, rsync, nfs-utils, cracklib, e2fsprogs, gdb, gdbm, gpm, kbd, lvm2, ncurses, nss, nss_wrapper, pam_wrapper, socket_wrapper, uid_wrapper, perl-Error, perl-Locale-gettext, systemtap, tzdata, unbound, ca-certificates, ca-certificates-mozilla, openruyi-release, linux-headers, pciutils, attr, acl, bash-completion, authselect, cpio, cryptsetup, dbus, dbus-broker, diffutils, elfutils, file, findutils, gawk, git, nghttp2, python-flit-core, python-lxml, python-packaging, python-pip, python-pyelftools, python-setuptools, python-wheel, re2c, scdoc, source-highlight, swig, uid_wrapper, xmlto, xxhash | 终端复用、分区扩容、进程管理、编辑器、时间日期 |
### 1.3 用例运行状态统计
| 测试类型 | 测试套数 | 用例数 | 状态 |
|---------|:---:|:---:|:---:|
| Smoke | 100 | 100 | ✅ 全部通过 |
| Functional | 281 | 3216 | ✅ 全部通过 (566 pkgs + 2407 LTP + 211 kernel + 32 compiler) |
| Security | 113 | 113 | ✅ 全部通过 (98 CVE + 8 nmap + 7 openscap) |
| Compatibility | 188 | 188 | ✅ 通过 (LTP POSIX) |
| Performance | 32 | 84 | 已执行 (11 unixbench + 53 mmtests + 5 iozone + 6 fio + 4 stream + 4 lmbench + 5 sysbench) |
| Reliability | 12 | 12 | 已执行 (6 trinity + 6 stress-ng) |
| Feature | 0 | 0 | 🆕 |
| **合计** | **726** | **3708** | |
详情文档:
- [冒烟测试覆盖详情](docs/coverage/smoke-coverage.md)
- [功能测试覆盖详情](docs/coverage/functional-coverage.md)
- [安全测试覆盖详情](docs/coverage/security-coverage.md)
- [兼容性测试覆盖详情](docs/coverage/compatibility-coverage.md)
- [性能测试覆盖详情](docs/coverage/unixbench_results.md)
---
## 二、openruyi-autotest 用户指南
参见 [用户指南](docs/user_guide_zh.md) — 涵盖从克隆仓库、安装依赖到执行单个用例、测试套、测试类型全量用例以及全部测试的完整步骤。
---
## 三、openruyi-autotest 开发指南
参见 [开发指南](docs/development-guide_zh.md) — 涵盖如何添加新测试用例、目录约定、BeakerLib 生命周期、FMF 元数据规范以及命名规范。
---
## 四、openruyi-autotest 测试报告模版
参见 [测试报告模版](docs/test_reports_zh.md) — 涵盖测试概述、各类型测试的套数/用例数/通过/失败/跳过统计表格。
+162 -161
View File
@@ -1,13 +1,15 @@
# Commit & MR 规范
# Commit & MR Standards
> openruyi-autotest 项目的 Commit 信息规范和 Merge Request 规范。
> 遵循 [Conventional Commits](https://www.conventionalcommits.org/) 业界标准。
> Commit message and Merge Request standards for the openruyi-autotest project.
> Follows the [Conventional Commits](https://www.conventionalcommits.org/) industry standard.
> :cn: [中文版 (Chinese Version)](commit_guide_zh.md)
---
## 1. Commit 信息规范
## 1. Commit Message Standards
### 1.1 基本格式
### 1.1 Basic Format
```
<type>(<scope>): <short summary>
@@ -17,90 +19,90 @@
<optional footer>
```
- **type**: 提交类型(必填)
- **scope**: 影响范围(可选,建议填写)
- **short summary**: 简短描述,不超过 72 字符,英文小写,不以句号结尾
- **body**: 详细说明(可选),与 summary 之间空一行
- **footer**: 脚注(可选),如 `BREAKING CHANGE:` 或关联 issue
- **type**: Commit type (required)
- **scope**: Affected area (optional, recommended)
- **short summary**: Brief description, max 72 chars, lowercase English, no trailing period
- **body**: Detailed explanation (optional), separated from summary by a blank line
- **footer**: Footnotes (optional), e.g. `BREAKING CHANGE:` or related issue
### 1.2 Type 类型
### 1.2 Type Values
| Type | 说明 | 示例 |
|------|------|------|
| `feat` | 新功能 | `feat: add default hardware-require to all test suites` |
| `fix` | Bug 修复 | `fix: hw_check.sh awk pattern to match indented YAML keys` |
| `docs` | 文档变更 | `docs: enhance development guide with ACL walkthrough` |
| `style` | 代码格式(不影响逻辑) | `style: fix shellcheck warnings in lib.sh` |
| `refactor` | 重构(非新功能、非修 bug | `refactor: move config resolution into main()` |
| `perf` | 性能优化 | `perf: cache dnf metadata in test setup` |
| `test` | 测试用例变更 | `test: add getfacl error handling test cases` |
| `chore` | 构建/工具/依赖变更 | `chore: remove qemu_daemon.py` |
| `ci` | CI/CD 变更 | `ci: add shellcheck to pre-commit hooks` |
| `build` | 构建系统变更 | `build: update tmt to 1.75.0` |
| Type | Description | Example |
|------|-------------|---------|
| `feat` | New feature | `feat: add default extra-hardware-require to all test suites` |
| `fix` | Bug fix | `fix: hw_check.sh awk pattern to match indented YAML keys` |
| `docs` | Documentation changes | `docs: enhance development guide with ACL walkthrough` |
| `style` | Code formatting (no logic change) | `style: fix shellcheck warnings in lib.sh` |
| `refactor` | Refactoring (not feat or fix) | `refactor: move config resolution into main()` |
| `perf` | Performance optimization | `perf: cache dnf metadata in test setup` |
| `test` | Test case changes | `test: add getfacl error handling test cases` |
| `chore` | Build/tool/dependency changes | `chore: remove qemu_daemon.py` |
| `ci` | CI/CD changes | `ci: add shellcheck to pre-commit hooks` |
| `build` | Build system changes | `build: update tmt to 1.75.0` |
### 1.3 Scope 范围(可选)
### 1.3 Scope (Optional)
建议使用受影响的模块或目录名:
Use the affected module or directory name:
| Scope | 含义 |
|-------|------|
| `acl` | acl 测试套 |
| `kernel` | 内核测试 |
| `hw_check` | 硬件检查库 |
| `ltp` | LTP 测试套 |
| `plan` | 测试计划 |
| `tmt` | tmt 框架配置 |
| _(省略)_ | 影响范围不明确或跨模块时可不写 |
| Scope | Meaning |
|-------|---------|
| `acl` | ACL test suite |
| `kernel` | Kernel tests |
| `hw_check` | Hardware check library |
| `ltp` | LTP test suite |
| `plan` | Test plans |
| `tmt` | tmt framework config |
| _(omitted)_ | Use when scope is unclear or cross-module |
### 1.4 示例
### 1.4 Examples
```bash
# 基本格式
# Basic format
feat(acl): add chacl command test suite
# body
# With body
fix(kernel): resolve sched_attr redefinition in LTP 20260529
The sched_attr struct was redefined in the 20260529 tag. Use
range-based sed to patch only the conflicting definition without
affecting other uses of the struct.
# 破坏性变更
# Breaking change
feat(config)!: switch from YAML to TOML for topology config
BREAKING CHANGE: topology.env is now topology.toml.
All existing topology.env files must be migrated.
```
### 1.5 注意事项
### 1.5 Notes
- **summary 使用纯 ASCII 英文**Gitea 不支持中文 Commit 信息)
- summary 不超过 72 字符
- 使用祈使语气:`add` 而非 `added``fix` 而非 `fixed`
- 每个 commit 只做一件事,避免混合无关变更
- 提交前用 `git diff --cached` 检查暂存区
- **Use plain ASCII English for summary** (Gitea does not support Chinese commit messages)
- Summary must not exceed 72 characters
- Use imperative mood: `add` not `added`, `fix` not `fixed`
- Each commit does one thing; avoid mixing unrelated changes
- Check the staging area with `git diff --cached` before committing
---
## 2. Merge Request 规范
## 2. Merge Request Standards
### 2.1 MR 标题
### 2.1 MR Title
遵循与 Commit 相同的 Conventional Commits 格式:
Follow the same Conventional Commits format as commits:
```
<type>(<scope>): <short summary>
```
示例:
Examples:
```
docs: enhance development guide - hardware-require, test discovery, ACL walkthrough
docs: enhance development guide - extra-hardware-require, test discovery, ACL walkthrough
feat(ltp): add 65 functional test suites with kirk runner
fix(hw_check): correct awk field parsing for indented YAML
```
### 2.2 MR 描述模板
### 2.2 MR Description Template
```markdown
## Summary
@@ -125,7 +127,7 @@ Closes #123
Refs: #456
```
### 2.3 MR 描述示例
### 2.3 MR Description Example
```markdown
## Summary
@@ -138,7 +140,7 @@ verification checklist expansion, and an ACL development walkthrough.
- Section 3.3.1: New test discovery mechanism diagram
- Section 3.4: lib.sh design patterns with reference counting
- Section 4: FMF field table now includes framework, hardware-require, environment
- Section 4: FMF field table now includes framework, extra-hardware-require, environment
- Section 5.6: hwVerify placement documented (must be first line in Test Phase)
- Section 7: Verification checklist expanded from 5 to 8 items
- Section 8: FAQ expanded from 3 to 6 questions
@@ -151,202 +153,202 @@ verification checklist expansion, and an ACL development walkthrough.
- [x] Document renders correctly in VS Code Markdown preview
```
### 2.4 注意事项
### 2.4 Notes
- **MR 标题和描述使用纯英文**(Gitea 不支持中文字符,会显示为乱码 `?`
- MR 描述中避免使用反引号包裹的 Markdown 代码(Gitea 渲染可能异常),必要时用纯文本代替
- 一个 MR 聚焦一个主题,避免混合多个独立变更
- MR 合并前确保所有 CI 检查通过
- 合并方式推荐 **Rebase and Merge**(保持提交历史线性)
- **MR titles and descriptions must use plain English** (Gitea does not support Chinese characters; they render as mojibake `?`)
- Avoid backtick-wrapped Markdown code in MR descriptions (Gitea rendering may be abnormal); use plain text when necessary
- One MR focuses on one topic; avoid mixing multiple independent changes
- Ensure all CI checks pass before merging
- Recommended merge method: **Rebase and Merge** (keeps commit history linear)
---
## 3. 分支命名规范
## 3. Branch Naming Standards
| 分支 | 用途 |
|------|------|
| `main` | 稳定版本,只接受 MR 合并 |
| `dev` | 开发主线,日常提交目标 |
| `feat/<name>` | 功能分支(可选,大功能开发时使用) |
| `fix/<name>` | 修复分支(可选,紧急修复时使用) |
| Branch | Purpose |
|--------|---------|
| `main` | Stable version, only accepts MR merges |
| `dev` | Development mainline, daily commit target |
| `feat/<name>` | Feature branch (optional, for large features) |
| `fix/<name>` | Fix branch (optional, for urgent fixes) |
日常开发流程:
Daily development workflow:
```
git checkout dev
# ... 编码 ...
# ... code ...
git add <files>
git commit -m "feat(scope): description"
git push origin dev
# 然后在 Gitea 上创建 dev → main 的 MR
# Then create an MR from dev → main on Gitea
```
---
## 4. 相关文档
## 4. Related Documents
- [开发指南](development-guide.md) — 测试用例开发完整流程
- [用户指南](user_guide.md) — 测试执行和使用说明
- [Conventional Commits 规范](https://www.conventionalcommits.org/en/v1.0.0/)
- [Development Guide](development-guide.md) — Complete test case development workflow
- [User Guide](user_guide.md) — Test execution and usage instructions
- [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0/)
---
## 5. 实战演示:以 ACL 测试套为例
## 5. Practical Walkthrough: ACL Test Suite
以下以 `tests/functional/pkgs/acl/` 测试套为例,展示从新增、修改、修复到重构的完整 Commit MR 写法。
The following uses the `tests/functional/pkgs/acl/` test suite to demonstrate complete Commit and MR formats for adding, modifying, fixing, and refactoring.
ACL 测试套结构:
ACL test suite structure:
```
tests/functional/pkgs/acl/
├── main.fmf # 套件级元数据
├── lib.sh # 共享库(引用计数安装/卸载)
├── test_acl_getfacl_basic/ # getfacl 基本功能(7 个参数)
├── test_acl_setfacl_basic/ # setfacl 增删改查
├── test_acl_setfacl_advanced/ # default ACL--set-M
├── test_acl_setfacl_recursive/ # -R 递归设置
├── test_acl_setfacl_remove/ # -x/-X 批量删除
├── test_acl_setfacl_symlink/ # -L/-P 符号链接处理
├── test_acl_chacl_command/ # chacl 命令
├── test_acl_acl_inheritance/ # 默认 ACL 继承
├── test_acl_acl_permission_verify/ # ACL 权限实际生效验证
├── test_acl_error_handling/ # 错误路径(不存在文件/用户/无效权限)
└── test_acl_special_cases/ # 多用户多组、--test 试运行、备份恢复
├── main.fmf # Suite-level metadata
├── lib.sh # Shared library (reference-count install/uninstall)
├── test_acl_getfacl_basic/ # getfacl basic functionality (7 options)
├── test_acl_setfacl_basic/ # setfacl CRUD operations
├── test_acl_setfacl_advanced/ # default ACL, --set, -M
├── test_acl_setfacl_recursive/ # -R recursive set
├── test_acl_setfacl_remove/ # -x/-X batch remove
├── test_acl_setfacl_symlink/ # -L/-P symlink handling
├── test_acl_chacl_command/ # chacl command
├── test_acl_acl_inheritance/ # Default ACL inheritance
├── test_acl_acl_permission_verify/ # ACL permission enforcement verification
├── test_acl_error_handling/ # Error paths (nonexistent file/user, invalid permissions)
└── test_acl_special_cases/ # Multi-user/group, --test dry-run, backup/restore
```
### 5.1 场景一:新增测试用例
### 5.1 Scenario 1: Add a New Test Case
**场景**:为 ACL 套件新增 `getfacl` 基本功能测试,覆盖 7 个命令行参数。
**Scenario**: Add `getfacl` basic functionality test to the ACL suite, covering 7 CLI options.
**涉及文件**
**Files involved**:
| 操作 | 文件 |
|------|------|
| 新增 | `tests/functional/pkgs/acl/test_acl_getfacl_basic/main.fmf` |
| 新增 | `tests/functional/pkgs/acl/test_acl_getfacl_basic/test.sh` |
| Operation | File |
|-----------|------|
| New | `tests/functional/pkgs/acl/test_acl_getfacl_basic/main.fmf` |
| New | `tests/functional/pkgs/acl/test_acl_getfacl_basic/test.sh` |
**Commit**
**Commit**:
```bash
git add tests/functional/pkgs/acl/test_acl_getfacl_basic/
git commit -m "feat(acl): add getfacl basic test covering 7 CLI options"
```
**Commit 要点解析**
**Commit breakdown**:
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `feat` | 新增功能(新测试用例 = 新功能) |
| scope | `acl` | 影响 acl 测试套 |
| summary | `add getfacl basic test covering 7 CLI options` | 47 字符,祈使语气,说明覆盖面 |
| Element | Value | Explanation |
|---------|-------|-------------|
| type | `feat` | New feature (new test case = new feature) |
| scope | `acl` | Affects ACL test suite |
| summary | `add getfacl basic test covering 7 CLI options` | 47 chars, imperative, describes coverage |
### 5.2 场景二:修改/更新现有测试
### 5.2 Scenario 2: Modify/Update Existing Tests
**场景**:在 `test_acl_error_handling` 中增加两个新的错误路径:`setfacl` 设置无效 mask 值、`getfacl` 对无权限文件的处理。
**Scenario**: Add two new error paths to `test_acl_error_handling`: `setfacl` with invalid mask value, `getfacl` on a file without permissions.
**涉及文件**
**Files involved**:
| 操作 | 文件 |
|------|------|
| 修改 | `tests/functional/pkgs/acl/test_acl_error_handling/test.sh` |
| Operation | File |
|-----------|------|
| Modify | `tests/functional/pkgs/acl/test_acl_error_handling/test.sh` |
**Commit**
**Commit**:
```bash
git add tests/functional/pkgs/acl/test_acl_error_handling/test.sh
git commit -m "feat(acl): add invalid mask and permission-denied error cases"
```
**Commit 要点解析**
**Commit breakdown**:
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `feat` | 增加了新功能点(错误路径覆盖面扩大) |
| scope | `acl` | 影响 acl 测试套 |
| Element | Value | Explanation |
|---------|-------|-------------|
| type | `feat` | Added new capability (expanded error path coverage) |
| scope | `acl` | Affects ACL test suite |
> **注意**:如果只是修改测试描述文案、注释或格式,用 `style` `refactor` 而非 `feat`
> **Note**: If only changing test descriptions, comments, or formatting, use `style` or `refactor` instead of `feat`.
### 5.3 场景三:Bug 修复
### 5.3 Scenario 3: Bug Fix
**场景**:发现 `test_acl_setfacl_basic``rlRun "! getfacl ... | grep ..."` 的退出码逻辑错误 —— 反引号 `!``rlRun` 中不会如预期工作,导致用例误报 PASS
**Scenario**: Found that `rlRun "! getfacl ... | grep ..."` in `test_acl_setfacl_basic` has incorrect exit code logic — the `!` negation does not work as expected inside `rlRun`, causing false PASS.
**涉及文件**
**Files involved**:
| 操作 | 文件 |
|------|------|
| 修改 | `tests/functional/pkgs/acl/test_acl_setfacl_basic/test.sh` |
| Operation | File |
|-----------|------|
| Modify | `tests/functional/pkgs/acl/test_acl_setfacl_basic/test.sh` |
**Commit**
**Commit**:
```bash
git add tests/functional/pkgs/acl/test_acl_setfacl_basic/test.sh
git commit -m "fix(acl): correct exit code check in setfacl_basic negative tests"
```
**Commit 要点解析**
**Commit breakdown**:
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `fix` | 修复 bug |
| scope | `acl` | 影响 acl 测试套 |
| Element | Value | Explanation |
|---------|-------|-------------|
| type | `fix` | Bug fix |
| scope | `acl` | Affects ACL test suite |
### 5.4 场景四:重构
### 5.4 Scenario 4: Refactoring
**场景**:将 ACL 测试套从单一巨大脚本拆分为 11 个独立用例目录,每个用例拥有自己的 `main.fmf` `test.sh`。同时提取共享安装/卸载逻辑到 `lib.sh`
**Scenario**: Split the ACL test suite from a single large script into 11 independent per-case directories, each with its own `main.fmf` and `test.sh`. Also extract shared install/uninstall logic into `lib.sh`.
**涉及文件**
**Files involved**:
| 操作 | 数量 | 说明 |
|------|------|------|
| 删除 | ~5 | 旧的 `setup.sh``teardown.sh``test.sh` |
| 新增 | 12 | `lib.sh` + 11 `test_acl_*/main.fmf` |
| 修改 | 12 | 11 `test_acl_*/test.sh` + `main.fmf` |
| Operation | Count | Description |
|-----------|-------|-------------|
| Delete | ~5 | Old `setup.sh`, `teardown.sh`, `test.sh` |
| New | 12 | `lib.sh` + 11 `test_acl_*/main.fmf` |
| Modify | 12 | 11 `test_acl_*/test.sh` + `main.fmf` |
**Commit**
**Commit**:
```bash
git add tests/functional/pkgs/acl/
git commit -m "refactor(acl): split into per-case dirs with shared lib.sh"
```
**Commit 要点解析**
**Commit breakdown**:
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `refactor` | 重构,不改变测试逻辑 |
| scope | `acl` | 影响 acl 测试套 |
| Element | Value | Explanation |
|---------|-------|-------------|
| type | `refactor` | Refactoring, no test logic changed |
| scope | `acl` | Affects ACL test suite |
### 5.5 场景五:文档更新
### 5.5 Scenario 5: Documentation Update
**场景**:在开发指南中新增 ACL 开发实战示例章节。
**Scenario**: Add ACL development walkthrough examples to the development guide.
**Commit**
**Commit**:
```bash
git add docs/development-guide.md
git commit -m "docs: add ACL development walkthrough to developer guide"
```
**Commit 要点解析**
**Commit breakdown**:
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `docs` | 文档变更 |
| scope | _(省略)_ | 跨模块文档,无需 scope |
| Element | Value | Explanation |
|---------|-------|-------------|
| type | `docs` | Documentation change |
| scope | _(omitted)_ | Cross-module documentation, no scope needed |
---
### 5.6 场景六:ACL 套件的完整 MR
### 5.6 Scenario 6: Complete ACL Suite MR
以上 5 个 Commit 合在一起,创建一个 `dev → main` MR
Combining the 5 commits above into a single `dev → main` MR:
**MR 标题**
**MR Title**:
```
feat(acl): add getfacl and error-handling tests, fix exit code bug, refactor to per-case dirs
```
**MR 描述**
**MR Description**:
```markdown
## Summary
@@ -389,12 +391,11 @@ Related commits in this MR:
- [x] Error cases correctly report FAIL for invalid input
```
**MR 要点解析**
| 要素 | 说明 |
|------|------|
| 标题 | 概括 MR 主题,用逗号分隔各子主题 |
| Summary | 一句话概述 + 关联的 commit 列表 |
| Changes | 按类别分组(New / Fix / Refactor / Docs),每项具体说明 |
| Verification | 列出验证步骤和结果,每个 check 都具体可复现 |
**MR breakdown**:
| Element | Explanation |
|---------|-------------|
| Title | Summarizes MR topic, comma-separated subtopics |
| Summary | One-sentence overview + list of related commits |
| Changes | Grouped by category (New / Fix / Refactor / Docs), each item concrete |
| Verification | Lists verification steps and results, each check specific and reproducible |
+402
View File
@@ -0,0 +1,402 @@
# Commit & MR 规范
> openruyi-autotest 项目的 Commit 信息规范和 Merge Request 规范。
> 遵循 [Conventional Commits](https://www.conventionalcommits.org/) 业界标准。
> :us: [English Version (英文版)](commit_guide.md)
---
## 1. Commit 信息规范
### 1.1 基本格式
```
<type>(<scope>): <short summary>
<optional body>
<optional footer>
```
- **type**: 提交类型(必填)
- **scope**: 影响范围(可选,建议填写)
- **short summary**: 简短描述,不超过 72 字符,英文小写,不以句号结尾
- **body**: 详细说明(可选),与 summary 之间空一行
- **footer**: 脚注(可选),如 `BREAKING CHANGE:` 或关联 issue
### 1.2 Type 类型
| Type | 说明 | 示例 |
|------|------|------|
| `feat` | 新功能 | `feat: add default extra-hardware-require to all test suites` |
| `fix` | Bug 修复 | `fix: hw_check.sh awk pattern to match indented YAML keys` |
| `docs` | 文档变更 | `docs: enhance development guide with ACL walkthrough` |
| `style` | 代码格式(不影响逻辑) | `style: fix shellcheck warnings in lib.sh` |
| `refactor` | 重构(非新功能、非修 bug) | `refactor: move config resolution into main()` |
| `perf` | 性能优化 | `perf: cache dnf metadata in test setup` |
| `test` | 测试用例变更 | `test: add getfacl error handling test cases` |
| `chore` | 构建/工具/依赖变更 | `chore: remove qemu_daemon.py` |
| `ci` | CI/CD 变更 | `ci: add shellcheck to pre-commit hooks` |
| `build` | 构建系统变更 | `build: update tmt to 1.75.0` |
### 1.3 Scope 范围(可选)
建议使用受影响的模块或目录名:
| Scope | 含义 |
|-------|------|
| `acl` | acl 测试套 |
| `kernel` | 内核测试 |
| `hw_check` | 硬件检查库 |
| `ltp` | LTP 测试套 |
| `plan` | 测试计划 |
| `tmt` | tmt 框架配置 |
| _(省略)_ | 影响范围不明确或跨模块时可不写 |
### 1.4 示例
```bash
# 基本格式
feat(acl): add chacl command test suite
# 带 body
fix(kernel): resolve sched_attr redefinition in LTP 20260529
The sched_attr struct was redefined in the 20260529 tag. Use
range-based sed to patch only the conflicting definition without
affecting other uses of the struct.
# 破坏性变更
feat(config)!: switch from YAML to TOML for topology config
BREAKING CHANGE: topology.env is now topology.toml.
All existing topology.env files must be migrated.
```
### 1.5 注意事项
- **summary 使用纯 ASCII 英文**Gitea 不支持中文 Commit 信息)
- summary 不超过 72 字符
- 使用祈使语气:`add` 而非 `added``fix` 而非 `fixed`
- 每个 commit 只做一件事,避免混合无关变更
- 提交前用 `git diff --cached` 检查暂存区
---
## 2. Merge Request 规范
### 2.1 MR 标题
遵循与 Commit 相同的 Conventional Commits 格式:
```
<type>(<scope>): <short summary>
```
示例:
```
docs: enhance development guide - extra-hardware-require, test discovery, ACL walkthrough
feat(ltp): add 65 functional test suites with kirk runner
fix(hw_check): correct awk field parsing for indented YAML
```
### 2.2 MR 描述模板
```markdown
## Summary
Briefly describe what this MR does and why.
## Changes
- Change 1: description
- Change 2: description
- Change 3: description
## Verification
- [ ] Local bash test.sh passes
- [ ] tmt run passes for affected tests
- [ ] No regressions in existing tests
## Related Issues
Closes #123
Refs: #456
```
### 2.3 MR 描述示例
```markdown
## Summary
This PR comprehensively enhances `docs/development-guide.md` (+448/-36 lines),
covering structural additions, environment constraints documentation,
verification checklist expansion, and an ACL development walkthrough.
## Changes
- Section 3.3.1: New test discovery mechanism diagram
- Section 3.4: lib.sh design patterns with reference counting
- Section 4: FMF field table now includes framework, extra-hardware-require, environment
- Section 5.6: hwVerify placement documented (must be first line in Test Phase)
- Section 7: Verification checklist expanded from 5 to 8 items
- Section 8: FAQ expanded from 3 to 6 questions
- Section 9: Complete ACL development walkthrough with 3 full examples
## Verification
- [x] All examples syntax-checked with bash -n
- [x] tmt test ls confirms all referenced tests are discoverable
- [x] Document renders correctly in VS Code Markdown preview
```
### 2.4 注意事项
- **MR 标题和描述使用纯英文**(Gitea 不支持中文字符,会显示为乱码 `?`
- MR 描述中避免使用反引号包裹的 Markdown 代码(Gitea 渲染可能异常),必要时用纯文本代替
- 一个 MR 聚焦一个主题,避免混合多个独立变更
- MR 合并前确保所有 CI 检查通过
- 合并方式推荐 **Rebase and Merge**(保持提交历史线性)
---
## 3. 分支命名规范
| 分支 | 用途 |
|------|------|
| `main` | 稳定版本,只接受 MR 合并 |
| `dev` | 开发主线,日常提交目标 |
| `feat/<name>` | 功能分支(可选,大功能开发时使用) |
| `fix/<name>` | 修复分支(可选,紧急修复时使用) |
日常开发流程:
```
git checkout dev
# ... 编码 ...
git add <files>
git commit -m "feat(scope): description"
git push origin dev
# 然后在 Gitea 上创建 dev → main 的 MR
```
---
## 4. 相关文档
- [开发指南](development-guide_zh.md) — 测试用例开发完整流程
- [用户指南](user_guide_zh.md) — 测试执行和使用说明
- [Conventional Commits 规范](https://www.conventionalcommits.org/en/v1.0.0/)
---
## 5. 实战演示:以 ACL 测试套为例
以下以 `tests/functional/pkgs/acl/` 测试套为例,展示从新增、修改、修复到重构的完整 Commit 和 MR 写法。
ACL 测试套结构:
```
tests/functional/pkgs/acl/
├── main.fmf # 套件级元数据
├── lib.sh # 共享库(引用计数安装/卸载)
├── test_acl_getfacl_basic/ # getfacl 基本功能(7 个参数)
├── test_acl_setfacl_basic/ # setfacl 增删改查
├── test_acl_setfacl_advanced/ # default ACL、--set、-M
├── test_acl_setfacl_recursive/ # -R 递归设置
├── test_acl_setfacl_remove/ # -x/-X 批量删除
├── test_acl_setfacl_symlink/ # -L/-P 符号链接处理
├── test_acl_chacl_command/ # chacl 命令
├── test_acl_acl_inheritance/ # 默认 ACL 继承
├── test_acl_acl_permission_verify/ # ACL 权限实际生效验证
├── test_acl_error_handling/ # 错误路径(不存在文件/用户/无效权限)
└── test_acl_special_cases/ # 多用户多组、--test 试运行、备份恢复
```
### 5.1 场景一:新增测试用例
**场景**:为 ACL 套件新增 `getfacl` 基本功能测试,覆盖 7 个命令行参数。
**涉及文件**
| 操作 | 文件 |
|------|------|
| 新增 | `tests/functional/pkgs/acl/test_acl_getfacl_basic/main.fmf` |
| 新增 | `tests/functional/pkgs/acl/test_acl_getfacl_basic/test.sh` |
**Commit**
```bash
git add tests/functional/pkgs/acl/test_acl_getfacl_basic/
git commit -m "feat(acl): add getfacl basic test covering 7 CLI options"
```
**Commit 要点解析**
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `feat` | 新增功能(新测试用例 = 新功能) |
| scope | `acl` | 影响 acl 测试套 |
| summary | `add getfacl basic test covering 7 CLI options` | 47 字符,祈使语气,说明覆盖面 |
### 5.2 场景二:修改/更新现有测试
**场景**:在 `test_acl_error_handling` 中增加两个新的错误路径:`setfacl` 设置无效 mask 值、`getfacl` 对无权限文件的处理。
**涉及文件**
| 操作 | 文件 |
|------|------|
| 修改 | `tests/functional/pkgs/acl/test_acl_error_handling/test.sh` |
**Commit**
```bash
git add tests/functional/pkgs/acl/test_acl_error_handling/test.sh
git commit -m "feat(acl): add invalid mask and permission-denied error cases"
```
**Commit 要点解析**
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `feat` | 增加了新功能点(错误路径覆盖面扩大) |
| scope | `acl` | 影响 acl 测试套 |
> **注意**:如果只是修改测试描述文案、注释或格式,用 `style` 或 `refactor` 而非 `feat`。
### 5.3 场景三:Bug 修复
**场景**:发现 `test_acl_setfacl_basic``rlRun "! getfacl ... | grep ..."` 的退出码逻辑错误 —— 反引号 `!``rlRun` 中不会如预期工作,导致用例误报 PASS。
**涉及文件**
| 操作 | 文件 |
|------|------|
| 修改 | `tests/functional/pkgs/acl/test_acl_setfacl_basic/test.sh` |
**Commit**
```bash
git add tests/functional/pkgs/acl/test_acl_setfacl_basic/test.sh
git commit -m "fix(acl): correct exit code check in setfacl_basic negative tests"
```
**Commit 要点解析**
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `fix` | 修复 bug |
| scope | `acl` | 影响 acl 测试套 |
### 5.4 场景四:重构
**场景**:将 ACL 测试套从单一巨大脚本拆分为 11 个独立用例目录,每个用例拥有自己的 `main.fmf``test.sh`。同时提取共享安装/卸载逻辑到 `lib.sh`
**涉及文件**
| 操作 | 数量 | 说明 |
|------|------|------|
| 删除 | ~5 | 旧的 `setup.sh``teardown.sh``test.sh` |
| 新增 | 12 | `lib.sh` + 11 个 `test_acl_*/main.fmf` |
| 修改 | 12 | 11 个 `test_acl_*/test.sh` + `main.fmf` |
**Commit**
```bash
git add tests/functional/pkgs/acl/
git commit -m "refactor(acl): split into per-case dirs with shared lib.sh"
```
**Commit 要点解析**
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `refactor` | 重构,不改变测试逻辑 |
| scope | `acl` | 影响 acl 测试套 |
### 5.5 场景五:文档更新
**场景**:在开发指南中新增 ACL 开发实战示例章节。
**Commit**
```bash
git add docs/development-guide.md
git commit -m "docs: add ACL development walkthrough to developer guide"
```
**Commit 要点解析**
| 要素 | 值 | 说明 |
|------|-----|------|
| type | `docs` | 文档变更 |
| scope | _(省略)_ | 跨模块文档,无需 scope |
---
### 5.6 场景六:ACL 套件的完整 MR
以上 5 个 Commit 合在一起,创建一个 `dev → main` 的 MR
**MR 标题**
```
feat(acl): add getfacl and error-handling tests, fix exit code bug, refactor to per-case dirs
```
**MR 描述**
```markdown
## Summary
This MR enhances the ACL test suite with new test cases, bug fixes,
and a structural refactoring for better maintainability.
Related commits in this MR:
- feat(acl): add getfacl basic test covering 7 CLI options
- feat(acl): add invalid mask and permission-denied error cases
- fix(acl): correct exit code check in setfacl_basic negative tests
- refactor(acl): split into per-case dirs with shared lib.sh
- docs: add ACL development walkthrough to developer guide
## Changes
### New Tests
- getfacl basic: covers -a, -d, -c, -n, -t options (7 features)
- error handling: added invalid mask and permission-denied edge cases
### Bug Fixes
- Fixed rlRun exit code logic in setfacl_basic negative tests
(the ! negation operator does not work inside rlRun)
### Refactoring
- Split monolithic ACL test into 11 independent per-case directories
- Extracted shared package install/uninstall into lib.sh
- Each test case now has its own main.fmf with granular duration/tier
### Documentation
- Added Section 9 to development-guide.md with ACL walkthrough
## Verification
- [x] All 11 ACL test cases pass: tmt run plan --name /plans/functional test --name /tests/functional/pkgs/acl
- [x] Each case runs independently without side effects
- [x] lib.sh reference counting works correctly (acl installed once, uninstalled once)
- [x] No regressions in other functional test suites
- [x] getfacl basic covers all 7 CLI options
- [x] Error cases correctly report FAIL for invalid input
```
**MR 要点解析**
| 要素 | 说明 |
|------|------|
| 标题 | 概括 MR 主题,用逗号分隔各子主题 |
| Summary | 一句话概述 + 关联的 commit 列表 |
| Changes | 按类别分组(New / Fix / Refactor / Docs),每项具体说明 |
| Verification | 列出验证步骤和结果,每个 check 都具体可复现 |
+364 -560
View File
File diff suppressed because it is too large Load Diff
+910
View File
@@ -0,0 +1,910 @@
# openruyi-autotest 开发指南
> 如何为 openruyi-autotest 贡献新的测试用例。
>
> **相关文档**[Commit & MR 规范](commit_guide_zh.md) · [用户指南](user_guide_zh.md)
> :us: [English Version (英文版)](development-guide.md)
---
## 1. 测试框架概述
openruyi-autotest 基于 [tmt (Test Management Tool)](https://tmt.readthedocs.io/) 框架,使用 [BeakerLib](https://github.com/beakerlib/beakerlib) 编写测试脚本,通过 [FMF (Flexible Metadata Format)](https://fmf.readthedocs.io/) 管理元数据。
### 核心概念
| 概念 | 说明 | 文件 |
|------|------|------|
| **测试计划 (Plan)** | 定义如何发现、准备、执行和报告测试 | `plans/*.fmf` |
| **测试用例 (Test)** | 具体的测试脚本 + 元数据 | `tests/**/test.sh` + `main.fmf` |
| **FMF 元数据** | YAML 格式的测试描述信息 | `main.fmf` |
| **BeakerLib** | Shell 测试框架,提供 rlRun/rlAssertGrep 等原语 | 脚本中 `. /usr/share/beakerlib/beakerlib.sh` |
---
## 2. 目录约定
```
tests/
├── main.fmf # 全局共享配置(framework, duration 等)
├── smoke/ # 冒烟测试
│ ├── main.fmf # 冒烟级共享配置
│ └── <category>/ # 分类目录
│ ├── main.fmf # 分类共享配置
│ ├── lib.sh # 分类级共享库(可选)
│ └── test_smoke_<name>/ # 测试用例目录
│ ├── main.fmf # 用例元数据
│ └── test.sh # 用例脚本
├── functional/ # 功能测试
│ ├── main.fmf # 功能级共享配置
│ └── pkgs/ # RPM 软件包测试
│ └── <pkg>/ # 软件包目录
│ ├── main.fmf # 包级元数据
│ ├── lib.sh # 包级共享库(可选)
│ └── test_<pkg>_<feature>/ # 功能测试用例
│ ├── main.fmf
│ └── test.sh
├── security/ # 安全测试
├── compatibility/ # 兼容性测试
├── performance/ # 性能测试
├── feature/ # 特性测试
│ ├── main.fmf # 特性级共享配置
│ └── <xxx>/ # 特性名称(如 gpu、network
│ ├── main.fmf # 特性级元数据
│ └── test_feature_<aaa>/ # 特性测试用例(aaa 为具体描述)
│ ├── main.fmf
│ └── test.sh
└── reliability/ # 可靠性测试
```
---
## 3. 添加新测试用例
### 3.1 创建目录和文件
以在 acl 软件包下新增一个测试用例为例:
```bash
# 1. 创建测试用例目录
mkdir -p tests/functional/pkgs/acl/test_acl_my_feature
# 2. 创建元数据文件
cat > tests/functional/pkgs/acl/test_acl_my_feature/main.fmf << 'EOF'
summary: 功能测试 - acl - 我的功能
test: ./test.sh
framework: shell
tag:
- functional
- acl
duration: 2m
tier: 1
path: /tests/functional/pkgs/acl/test_acl_my_feature
require:
- acl
- coreutils
- beakerlib
EOF
```
> **字段说明**`framework: shell` 声明使用 Shell 测试框架;`tag: [functional, acl]` 确保被 functional plan 发现;`duration` 可覆盖父级默认值;`require` 除被测包外还需 `coreutils`(创建文件/目录等基础操作)和 `beakerlib`(测试框架)。
### 3.2 编写测试脚本
```bash
cat > tests/functional/pkgs/acl/test_acl_my_feature/test.sh << 'TESTEOF'
#!/bin/bash
# Functional test: acl - my feature
# Beakerlib-based test with lifecycle management
# Shared suite setup/cleanup via ../lib.sh (install once, uninstall once)
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$(dirname "$0")/../lib.sh"
rlJournalStart
rlPhaseStartSetup "环境准备"
aclSetup
TmpDir=$(mktemp -d)
rlRun "cd $TmpDir" 0 "进入临时测试目录"
rlRun "touch testfile" 0 "创建测试文件"
rlRun "mkdir testdir" 0 "创建测试目录"
rlPhaseEnd
rlPhaseStartTest "我的功能测试"
# 功能点 1: 基本验证
rlRun "getfacl testfile" 0 "查看文件默认 ACL"
# 功能点 2: 设置 ACL
rlRun "setfacl -m u:root:rwx testfile" 0 "设置用户 ACL"
rlRun "getfacl testfile 2>&1 | grep -q 'user:root:rwx'" 0 "确认 ACL 已设置"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
if [ -n "$TmpDir" ] && [ -d "$TmpDir" ]; then
rlRun "rm -rf $TmpDir" 0 "清理临时测试目录"
fi
# acl 软件包由 lib.sh 的引用计数机制自动管理卸载
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
TESTEOF
```
> **`rlRun` 退出码规则**:第二个参数 `0` 表示期望命令成功(退出码 0),`1` 表示期望命令失败(用于负向测试)。如果实际退出码与期望不符,rlRun 会报告 FAIL 并阻止后续 Phase 执行。
### 3.3 BeakerLib 生命周期
每个测试脚本遵循标准的三阶段结构:
| 阶段 | 函数 | 用途 |
|------|------|------|
| **Setup** | `rlPhaseStartSetup` | 环境准备:安装软件包、创建临时目录、调用 `*Setup()` 共享库函数 |
| **Test** | `rlPhaseStartTest` | 执行测试:调用被测试命令、断言结果。可包含多个 Phase,每个测试一个功能点 |
| **Cleanup** | `rlPhaseStartCleanup` | 清理环境:删除临时文件、返回原目录、共享库自动管理软件包卸载 |
> **注意**`rlPhaseStartSetup` 中调用的 `aclSetup()` 通过 `rlCleanupAppend` 向 BeakerLib 注册了清理回调,所以 Cleanup 阶段**不需要**手动卸载软件包。
### 3.3.1 测试如何被 tmt 发现?
tmt 的执行流程是:Plan 的 `discover` 阶段遍历 `tests/` 目录树,通过 FMF 的 `tag` 匹配找到所有符合条件的测试用例。
```
tmt run plan --name /plans/functional
├─ [discover] plans/functional.fmf → filter: "tag:functional"
│ │
│ ├─ 遍历 tests/ 树,匹配 tag 含 "functional" 的所有 main.fmf
│ │ ✓ tests/functional/pkgs/acl/test_acl_getfacl_basic/main.fmf
│ │ ✓ tests/functional/pkgs/acl/test_acl_setfacl_basic/main.fmf
│ │ ✗ tests/smoke/archive/main.fmf (tag: smoke)
│ │ ✗ tests/security/cve/main.fmf (tag: security)
│ │
│ └─ 输出: 202 个测试被发现
├─ [execute] 按顺序执行每个 test.sh
└─ [report] 汇总结果
```
**要点**
- `main.fmf` 中必须包含 `tag: [functional]`(或其他对应的计划标签)才能被对应 Plan 发现
- Plan 文件(如 `plans/functional.fmf`)通过 `filter: "tag:functional"` 声明匹配条件
- 不同 Plan 可以运行同一组测试(只需在 tag 中添加多个标签即可)
- 标签名来源于测试分类名:`smoke``functional``security``compatibility``performance``reliability``feature`
### 3.4 共享库(lib.sh
当同一个软件包下多个测试用例需要共享安装/卸载逻辑时,使用 `lib.sh`
**设计要点**
- **`library-prefix` 注解**:文件头 `# library-prefix = acl` 声明函数前缀,所有公共函数以 `acl` 开头。
- **引用计数机制**:使用标志文件(如 `/tmp/.beakerlib_acl_suite`)跟踪有多少个测试用例正在使用该套件。第一个测试安装软件包,最后一个测试卸载。
- **`rlCleanupAppend`**:在 Setup 阶段注册 cleanup 函数,无论测试成功/失败,BeakerLib 都会在 `rlJournalEnd` 时自动调用。
- **`sudo` 处理**:项目使用 `echo <password> | sudo -S <cmd>` 模式注入 sudo 密码,`lib.sh` 中的安装/卸载命令需要适配。
**`lib.sh` 示例**
```bash
# library-prefix = acl
#
# ACL suite-level shared library
# Usage in each test file:
# . "$(dirname "$0")/../lib.sh" # from test_acl_xxx/ subdirectories
#
# Then call: aclSetup in rlPhaseStartSetup
# The cleanup is auto-registered via rlCleanupAppend.
ACL_FLAG="/tmp/.beakerlib_acl_suite"
aclSetup() {
if [ ! -f "$ACL_FLAG" ]; then
if ! rpm -q acl 2>/dev/null; then
echo openruyi | sudo -S dnf install -y acl 2>/dev/null
echo "installed=1" > "$ACL_FLAG"
else
echo "installed=0" > "$ACL_FLAG"
fi
echo "ref=1" >> "$ACL_FLAG"
else
local ref=$(grep "^ref=" "$ACL_FLAG" | cut -d= -f2)
ref=$((ref + 1))
sed -i "s/^ref=.*/ref=$ref/" "$ACL_FLAG"
fi
rlCleanupAppend "aclCleanup"
}
aclCleanup() {
[ ! -f "$ACL_FLAG" ] && return 0
local ref=$(grep "^ref=" "$ACL_FLAG" | cut -d= -f2)
ref=$((ref - 1))
if [ "$ref" -le 0 ]; then
grep -q "^installed=1" "$ACL_FLAG" && echo openruyi | sudo -S dnf remove -y acl 2>/dev/null || true
rm -f "$ACL_FLAG"
else
sed -i "s/^ref=.*/ref=$ref/" "$ACL_FLAG"
fi
}
```
---
## 4. FMF 元数据字段说明
### 测试用例 (main.fmf)
| 字段 | 类型 | 必填 | 说明 |
|------|------|:---:|------|
| `summary` | string | ✅ | 测试简短描述,格式:`测试类型 - 软件包 - 功能` |
| `test` | string | ✅ | 测试脚本路径,通常 `./test.sh` |
| `framework` | string | | 测试框架,`shell` 表示 Shell 脚本(继承自 `tests/main.fmf` |
| `tag` | list | ✅ | 标签列表,如 `[functional, acl]`。Plan 通过 `filter: "tag:functional"` 匹配 |
| `duration` | string | ✅ | 预估执行时间,如 `2m``5m`。可覆盖父级默认值 |
| `tier` | int | ✅ | 优先级:0=冒烟(每次提交),1=核心功能(每日),2=扩展(发布前) |
| `path` | string | ✅ | 测试路径,格式 `/tests/<type>/pkgs/<pkg>/<test>` |
| `require` | list | ✅ | 依赖的 RPM 软件包(需含被测包 + `coreutils` + `beakerlib` |
| `contact` | string | | 测试负责人 |
| `environment` | dict | | 自定义环境变量,如 `{VAR1: val1, VAR2: val2}`,注入到测试执行环境 |
| `extra-hardware-require` | dict | | 硬件需求声明(详见图 5.3),如 `{cpu: ">= 4", memory: ">= 8 GiB"}` |
### 测试计划 (plans/*.fmf)
```yaml
summary: 功能测试计划
discover:
how: fmf
test:
- /tests/functional
provision:
how: local
prepare:
how: shell
script:
- echo ""
execute:
how: tmt
```
---
## 5. 硬件环境约束
本项目所有 Plan 使用 `how: local` 模式,通过 **FMF 元数据声明 + 环境变量注入 + 公共库自检** 实现硬件环境约束。当环境不满足声明时,测试自动 SKIP(`exit 0`),不阻塞其他用例。
### 5.1 组件总览
| 组件 | 文件 | 作用 |
|------|------|------|
| 拓扑配置模板 | `topology.env.example` | 仓库级模板,提交到版本控制 |
| 拓扑配置实例 | `topology.env` | 实际服务器信息,已 `.gitignore`,不提交 |
| 测试用例声明 | `main.fmf` 中的 `extra-hardware-require` | 每个用例声明自己的硬件需求 |
| Plan 加载 | `plans/*.fmf` 中的 `environment-file` | 将 `topology.env` 注入为环境变量 |
| 公共检查库 | `tests/lib/hw_check.sh` | 解析声明、对比环境、远程执行 |
### 5.2 拓扑配置 (`topology.env`)
`topology.env.example` 复制为 `topology.env`,按实际环境修改:
```bash
TEST_SERVER_COUNT=2
TEST_SERVER_1_HOST=10.20.237.192
TEST_SERVER_1_PORT=12055
TEST_SERVER_1_USER=openruyi
TEST_SERVER_1_PASSWORD=openruyi
TEST_SERVER_2_HOST=10.20.238.100
TEST_SERVER_2_PORT=22
TEST_SERVER_2_USER=openruyi
TEST_SERVER_2_PASSWORD=openruyi
```
### 5.3 测试用例声明 (`extra-hardware-require`)
#### 支持的字段
| 字段 | 含义 | 检查方式 | 示例值 |
|------|------|----------|--------|
| `server` | 需要的服务器数量 | 对比 `TEST_SERVER_COUNT` | `2` |
| `cpu` | 每台 CPU 核心数 | `nproc` | `">= 4"` |
| `memory` | 每台可用内存 | `free -g` | `">= 8 GiB"` |
| `disk` | 每台磁盘数量 | `lsblk -nd` | `">= 1"` |
| `net` | 每台 UP 状态网卡数 | `ip -o link show` | `">= 1"` |
支持的比较运算符:`=` `!=` `>=` `<=` `>` `<`
#### 层级继承
利用 FMF 的层级继承机制,在测试分类父级统一声明默认值,子套件无需重复:
```
tests/functional/main.fmf ← extra-hardware-require (默认值)
└─ pkgs/acl/main.fmf ← 无 extra-hardware-require → 继承父级
│ ├─ test_acl_getfacl_basic/ → 获得默认约束 ✅
│ └─ test_acl_setfacl/ → 获得默认约束 ✅
└─ kernel/realtime/main.fmf ← cpu: ">= 16" → 覆盖 cpu
└─ test_rt_latency/ → cpu>=16, 其余继承默认 ✅
```
#### 当前默认值
所有测试分类父级 `tests/*/main.fmf` 已统一声明:
```yaml
extra-hardware-require:
server: 1
cpu: ">= 4"
memory: ">= 8 GiB"
disk: ">= 1"
net: ">= 1"
```
#### 按需覆盖
子套件只需覆盖需要提升的字段,其余自动继承:
```yaml
# tests/functional/kernel/realtime/main.fmf
extra-hardware-require:
cpu: ">= 16" # 覆盖父级的 ">= 4"
memory: ">= 16 GiB" # 覆盖父级的 ">= 8 GiB"
# server/disk/net 未写,自动继承父级默认值
```
### 5.4 公共库函数 (`tests/lib/hw_check.sh`)
测试脚本中引入公共库后调用:
```bash
. "$(dirname "$0")/../../lib/hw_check.sh"
```
| 函数 | 用途 |
|------|------|
| `hwVerify [fmf]` | 综合检查所有字段,不满足则 `exit 0`tmt 视为 skip |
| `hwServerVerify [fmf]` | 仅检查服务器数量 |
| `hwCpuCheck [fmf]` | 仅检查 CPU 核心数 |
| `hwMemCheck [fmf]` | 仅检查内存大小 |
| `hwDiskCheck [fmf]` | 仅检查磁盘数量 |
| `hwNetCheck [fmf]` | 仅检查网卡数量(UP 状态,排除 lo) |
| `hwRunOnServer <idx> <cmd>` | 在指定索引的服务器上远程执行命令 |
| `hwGetServerInfo <idx> <field>` | 获取服务器连接信息 (`host`/`port`/`user`/`password`) |
### 5.5 Plan 配置
所有 `how: local` 的 Plan 需添加 `environment-file` 以加载拓扑环境变量:
```yaml
# plans/functional.fmf
environment-file:
- topology.env
```
当前项目所有 Plan 文件已统一配置:`functional``smoke``security``performance``reliability``compatibility``feature``all`
### 5.6 完整用例示例
**`main.fmf`**
```yaml
summary: 功能测试 - my_pkg - 多机主备切换
test: ./test.sh
tag:
- functional
- my_pkg
duration: 5m
tier: 2
extra-hardware-require:
server: 2
```
**`test.sh`**
```bash
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$(dirname "$0")/../../lib/hw_check.sh" # ← 引入公共库
rlJournalStart
rlPhaseStartSetup "环境准备"
rlRun "dnf install -y my-pkg" 0 "安装 my-pkg"
rlPhaseEnd
rlPhaseStartTest "主备切换测试"
# ⚠️ hwVerify 必须放在 Test Phase 第一行
# 放在 Setup 中会导致 Cleanup 被跳过(exit 0 绕过 rlJournalEnd
hwVerify
# 本机启动主服务
rlRun "my-server --start --role=master" 0 "启动主节点"
# server-2 启动备服务
hwRunOnServer 2 "my-server --start --role=standby"
# 从 server-2 连接 server-1 验证
local s1_host=$(hwGetServerInfo 1 host)
hwRunOnServer 2 "my-client --connect $s1_host --check-status"
rlPhaseEnd
rlPhaseStartCleanup "清理环境"
rlRun "my-server --stop" 0 "停止主节点"
hwRunOnServer 2 "my-server --stop"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
```
### 5.7 工作机制
```
tmt run plan --name /plans/functional
├─ environment-file 加载 topology.env → 环境变量就绪
├─ discover: 发现所有包含 tag:functional 的测试
├─ execute:
│ ├─ test_acl_basic: 继承默认 extra-hardware-require → hwVerify() 自动检查
│ ├─ test_multi_host:
│ │ ├─ hwVerify()
│ │ │ ├─ TEST_SERVER_COUNT=1, need=2 → "SKIP: need 2 servers"
│ │ │ └─ exit 0tmt 记录为 skip
│ │ └─ (不满足时不执行后续测试逻辑)
│ └─ ...
└─ report: 汇总所有 skip 状态及原因
```
> **设计原则**:利用 FMF 层级继承 + 环境变量注入 + 公共库自检,实现与上层 provision 插件一致的"不满足即跳过"语义,且避免在每个套件重复声明硬件需求。
---
## 6. 命名规范
| 规则 | 示例 |
|------|------|
| 测试用例目录:`test_{包名}_{功能描述}` | `test_acl_getfacl_basic` |
| 全小写,下划线分隔 | `test_coreutils_ls_command` |
| 功能描述用英文 | `test_bash_variable_expansion` |
| 简单检查包:`test_{包名}_basic_check` | `test_attr_basic_check` |
| 无分组包:`test_{包名}_main` | `test_filesystem_main` |
---
## 7. 执行和验证
### 本地验证
```bash
# 执行单个新测试用例
tmt run --all --verbose plan --name /plans/functional \
test --name /tests/functional/pkgs/acl/test_acl_my_feature \
provision --feeling-safe
# 查看结果
tmt run --last report -fvvv
```
### 验证清单
- [ ] `main.fmf` 包含所有必填字段(summary, test, tag, duration, tier, path, require
- [ ] `tag` 包含正确的计划标签(如 `functional`),确保能被 Plan 发现
- [ ] `require` 包含被测包 + `coreutils` + `beakerlib`
- [ ] `test.sh` 首行 `#!/bin/bash`sources beakerlib 和 lib.sh
- [ ] 手动执行可通过 (`bash test.sh`)
- [ ] 无硬编码路径,使用相对路径和 `$TmpDir`
- [ ] Cleanup 阶段正确清理临时文件,共享库自动管理软件包卸载
- [ ] 如有多机需求,调用 `hwVerify` 进行环境自检(放在 Test Phase 第一行)
---
## 8. 单元测试(代码质量检查)
`unittests/` 目录包含针对测试框架本身的单元测试,确保所有测试用例符合项目规范。提交 PR 前请在本地运行这些测试。
### 8.1 运行单元测试
```bash
# 运行所有单元测试
python -m unittest discover -s unittests -p "test_*.py" -v
# 运行单个测试文件
python -m unittest unittests.test_tests_quality -v
```
### 8.2 测试用例概览
所有测试位于 `unittests/test_tests_quality.py`,目前共 **10 个测试**,分为 5 大类:
| 类别 | 测试 | 描述 |
|------|------|------|
| **中文字符** | `test_no_chinese_in_tests` | 确保 `tests/` 目录下文件不含中文字符 |
| **乱码检测** | `test_no_mojibake_in_tests` | 检测 Latin-1 乱码(如 `ä½ å¥½` |
| **Shell 脚本规范** | `test_test_sh_compliance` | 验证 `test.sh` 文件符合 BeakerLib 结构(`rlJournalStart``rlPhaseStart*``rlJournalEnd``#!/bin/bash` |
| | `test_lib_sh_compliance` | 验证 `lib.sh` 文件符合共享库约定(`library-prefix` 注解、`*Setup()` 函数) |
| | `test_no_crlf_in_sh_files` | 确保所有 `.sh` 文件使用 LF 换行符,不含 CRLF |
| | `test_main_fmf_yaml_valid` | 验证 `main.fmf` 文件是合法的 YAML 且包含必填字段 |
| **可执行权限** | `test_sh_files_executable_in_git` | 确保 `.sh` 文件在 git 中具有可执行权限(`100755` |
| | `test_no_non_sh_executable_in_tests` | 确保 `tests/` 下非 `.sh` 文件没有可执行权限 |
| **缩进规范** | `test_no_tab_in_sh` | 确保 `.sh` 文件中没有 Tab 字符 |
| | `test_sh_indentation_multiple_of_4` | 确保缩进为 4 的倍数(每层嵌套 4 空格) |
### 8.3 关键设计说明
- **基于 Git 的检查**:大多数测试通过 `git show` 读取已提交内容,避免 `core.autocrlf=true` 的换行符转换干扰。
- **Heredoc 感知**:缩进测试会排除 heredoc 体内容(`<<WORD ... WORD`),避免嵌入式代码(C、Makefile 等)产生误报。
- **提交 PR 前确保 10 个测试全部通过**。
---
## 9. 常见问题
### Q: test.sh 需要可执行权限吗?
tmt 通过 `bash test.sh` 执行,不强制要求,但建议 `chmod +x`
### Q: 如何复用其他测试的安装逻辑?
使用 `lib.sh` 共享库 + 引用计数机制(参见 3.4 节)。
### Q: 我写了 main.fmf 但 tmt 执行时提示 0 tests discovered
1. 确认 `tag` 字段与 Plan 的 `filter` 匹配(如 `filter: "tag:functional"`
2. 确认 `main.fmf` 文件在正确路径下
3. 运行 `tmt test ls` 查看 tmt 发现了哪些测试:
```bash
cd openruyi-autotest
tmt test ls | grep <your_test_name>
```
### Q: rlRun 执行失败但命令本身是正确的?
可能是 rlRun 的 `expect` 参数不匹配。rlRun 第二个参数是期望退出码:
- `rlRun "cmd" 0`:期望命令成功(退出码 0
- `rlRun "cmd should fail" 1`:期望命令失败(退出码 1
- 如果实际退出码与期望不符,rlRun 报告失败
### Q: hwVerify 放在 Setup 还是 Test 阶段?
**必须在 Test Phase 第一行**。`hwVerify` 不满足时会 `exit 0`,如果放在 Setup 阶段,`exit 0` 会绕过 `rlJournalEnd`,导致 Cleanup 不执行、临时文件残留。
### Q: 如何调试失败的测试?
```bash
# 查看完整输出
cat /var/tmp/tmt/run-*/plans/functional/execute/data/guest/default-0/tests/.../output.txt
# 手动执行脚本(可直接调试)
bash tests/functional/pkgs/acl/test_acl_my_feature/test.sh
```
---
## 10. 实战示例:开发 ACL 测试套
本节完整演示如何从零开始为一个新的软件包开发测试套,以 `acl` 为例。
### 10.1 总体流程
```
需求分析 → 创建套件目录 → 编写 lib.sh → 编写 main.fmf → 编写 test.sh → 验证执行
```
ACL 测试套共 **11 个测试用例**,覆盖 getfacl、setfacl、chacl 三大命令的所有主要功能点。
### 10.2 第 1 步:创建套件目录结构
```bash
# 创建软件包级目录
mkdir -p tests/functional/pkgs/acl
# 创建包级元数据
cat > tests/functional/pkgs/acl/main.fmf << 'EOF'
summary: 功能测试 - acl 软件包功能验证
tag:
- functional
- acl
duration: 5m
tier: 1
path: /tests/functional/pkgs/acl
require:
- acl
- coreutils
- beakerlib
EOF
```
### 10.3 第 2 步:编写共享库 `lib.sh`
11 个测试用例都需要 `acl` 软件包,使用共享库 + 引用计数避免每个用例重复安装/卸载:
```bash
cat > tests/functional/pkgs/acl/lib.sh << 'EOF'
# library-prefix = acl
#
# ACL suite-level shared library
# Uses flag-file + reference counting to ensure the acl package
# is installed only ONCE and uninstalled only ONCE across all
# test cases.
ACL_FLAG="/tmp/.beakerlib_acl_suite"
aclSetup() {
if [ ! -f "$ACL_FLAG" ]; then
if ! rpm -q acl 2>/dev/null; then
echo openruyi | sudo -S dnf install -y acl 2>/dev/null
echo "installed=1" > "$ACL_FLAG"
rlLogInfo "已安装 acl 软件包(首次)"
else
echo "installed=0" > "$ACL_FLAG"
rlLogInfo "acl 软件包已存在"
fi
echo "ref=1" >> "$ACL_FLAG"
else
local ref=$(grep "^ref=" "$ACL_FLAG" | cut -d= -f2)
ref=$((ref + 1))
sed -i "s/^ref=.*/ref=$ref/" "$ACL_FLAG"
rlLogInfo "acl 已由其他测试安装,引用计数: $ref"
fi
rlCleanupAppend "aclCleanup"
}
aclCleanup() {
if [ ! -f "$ACL_FLAG" ]; then
return 0
fi
local ref=$(grep "^ref=" "$ACL_FLAG" | cut -d= -f2)
ref=$((ref - 1))
if [ "$ref" -le 0 ]; then
if grep -q "^installed=1" "$ACL_FLAG"; then
echo openruyi | sudo -S dnf remove -y acl 2>/dev/null || true
rlLogInfo "已卸载 acl 软件包(最后一个测试)"
fi
rm -f "$ACL_FLAG"
else
sed -i "s/^ref=.*/ref=$ref/" "$ACL_FLAG"
rlLogInfo "acl 保留(还有 $ref 个测试未完成)"
fi
}
EOF
```
### 10.4 第 3 步:逐功能点开发测试用例
以下按功能点分别创建目录、main.fmf 和 test.sh。
#### 9.4.1 用例 1: getfacl 基本功能
```bash
mkdir -p tests/functional/pkgs/acl/test_acl_getfacl_basic
```
**`main.fmf`**
```yaml
summary: 功能测试 - acl - getfacl 基本功能
test: ./test.sh
tag:
- functional
- acl
duration: 2m
tier: 1
path: /tests/functional/pkgs/acl/test_acl_getfacl_basic
require:
- acl
- beakerlib
```
**`test.sh`** — 覆盖 7 个功能点,每个功能点至少一个 `rlRun`
```bash
#!/bin/bash
# Functional test: acl - getfacl basic
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$(dirname "$0")/../lib.sh"
rlJournalStart
rlPhaseStartSetup "环境准备"
aclSetup
TmpDir=$(mktemp -d)
rlRun "cd $TmpDir" 0 "进入临时测试目录"
rlRun "touch testfile" 0 "创建测试文件"
rlRun "mkdir testdir" 0 "创建测试目录"
rlPhaseEnd
rlPhaseStartTest "getfacl 基本功能"
# 功能点 1: 查看文件默认 ACL(含基本权限条目)
rlRun "getfacl testfile 2>&1 | grep -qE \"user::|group::|other::\"" 0 \
"查看文件默认 ACL 含权限条目"
# 功能点 2: 查看目录默认 ACL
rlRun "getfacl testdir 2>&1 | grep -qE \"user::|group::|other::\"" 0 \
"查看目录默认 ACL 含权限条目"
# 功能点 3: -a 参数只显示 access ACL
rlRun "getfacl -a testfile 2>&1 | grep -qE \"user::|group::\"" 0 \
"使用 -a 参数查看 access ACL"
# 功能点 4: -d 参数只显示 default ACL
rlRun "getfacl -d testfile 2>&1 | grep -qE \"user::|default\"" 0 \
"使用 -d 参数查看 default ACL 含 default 条目"
# 功能点 5: -c 参数不显示注释头
rlRun "getfacl -c testfile 2>&1" 0 "使用 -c 参数不显示注释头"
rlAssertNotGrep "^# file:" "$(getfacl -c testfile 2>&1)" \
"-c 输出不包含注释头"
# 功能点 6: -n 参数显示数字用户/组 ID
rlRun "getfacl -n testfile 2>&1 | grep -qE \"[0-9]+\"" 0 \
"使用 -n 参数显示数字 ID"
# 功能点 7: -t 参数使用表格输出格式
rlRun "getfacl -t testfile 2>&1 | grep -qE \"[r-][w-][x-]\"" 0 \
"使用 -t 参数表格输出含权限位"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
if [ -n "$TmpDir" ] && [ -d "$TmpDir" ]; then
rlRun "rm -rf $TmpDir" 0 "清理临时测试目录"
fi
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
```
#### 9.4.2 用例 2: setfacl 基本功能
```bash
mkdir -p tests/functional/pkgs/acl/test_acl_setfacl_basic
```
**`test.sh`** — 侧重 setfacl 的基础增删改查:
```bash
#!/bin/bash
# Functional test: acl - setfacl basic
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$(dirname "$0")/../lib.sh"
rlJournalStart
rlPhaseStartSetup "环境准备"
aclSetup
TmpDir=$(mktemp -d)
rlRun "cd $TmpDir" 0 "进入临时测试目录"
rlRun "touch testfile" 0 "创建测试文件"
rlRun "mkdir testdir" 0 "创建测试目录"
rlPhaseEnd
rlPhaseStartTest "setfacl 基本功能"
# 功能点 1: -m 设置 user ACL
rlRun "setfacl -m u:root:rwx testfile" 0 "设置用户 ACL"
rlRun "getfacl testfile 2>&1 | grep -q 'user:root:rwx'" 0 "确认 user ACL 已设置"
# 功能点 2: -m 设置 group ACL
rlRun "setfacl -m g:root:r-- testfile" 0 "设置用户组 ACL"
# 功能点 3: -m 设置 mask
rlRun "setfacl -m m::rwx testfile" 0 "设置 mask"
rlRun "getfacl testfile 2>&1 | grep -q 'mask::rwx'" 0 "确认 mask 已设置"
# 功能点 4: -x 删除指定 ACL
rlRun "setfacl -x g:root testfile" 0 "删除组 ACL 条目"
rlRun "! getfacl testfile 2>&1 | grep -q 'group:root:'" 0 "确认组 ACL 已删除"
# 功能点 5: -b 删除所有扩展 ACL
rlRun "setfacl -b testfile" 0 "删除所有扩展 ACL"
rlRun "! getfacl testfile 2>&1 | grep -qE '(user:|group:)(?!:[:space:]|::)'" 0 \
"确认所有命名 ACL 已清除"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
[ -n "$TmpDir" ] && [ -d "$TmpDir" ] && rlRun "rm -rf $TmpDir" 0 "清理临时测试目录"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
```
#### 9.4.3 用例 3: 错误处理
```bash
mkdir -p tests/functional/pkgs/acl/test_acl_error_handling
```
**`test.sh`** — 使用 `rlRun` 的 `expect=1` 模式验证错误路径:
```bash
#!/bin/bash
# Functional test: acl - error handling
. /usr/share/beakerlib/beakerlib.sh || exit 1
. "$(dirname "$0")/../lib.sh"
rlJournalStart
rlPhaseStartSetup "环境准备"
aclSetup
TmpDir=$(mktemp -d)
rlRun "cd $TmpDir" 0 "进入临时测试目录"
rlRun "touch testfile" 0 "创建测试文件"
rlPhaseEnd
rlPhaseStartTest "错误处理"
# 功能点 1: 不存在的文件 — 期望失败 (exit 1)
rlRun "getfacl /nonexistent 2>&1 | grep -qiE \"error|Error|No such|无法|not found\" || echo expected-error" 1 \
"查看不存在的文件"
# 功能点 2: 不存在的用户 — 期望失败
rlRun "setfacl -m u:nobody_xxx:rwx testfile 2>&1 | grep -qiE \"error|Error|Invalid|无效\" || echo expected-error" 1 \
"设置不存在的用户"
# 功能点 3: 无效权限 — 期望失败
rlRun "setfacl -m u:root:abc testfile 2>&1 | grep -qiE \"error|Error|Invalid|无效\" || echo expected-error" 1 \
"设置无效权限字符串"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
[ -n "$TmpDir" ] && [ -d "$TmpDir" ] && rlRun "rm -rf $TmpDir" 0 "清理临时测试目录"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd
```
### 10.5 第 4 步:本地验证
```bash
cd ~/openruyi-autotest
# 1. 确认 tmt 能发现新测试
tmt test ls | grep acl
# 预期输出:
# /tests/functional/pkgs/acl/test_acl_getfacl_basic
# /tests/functional/pkgs/acl/test_acl_setfacl_basic
# /tests/functional/pkgs/acl/test_acl_error_handling
# 2. 先手动执行验证语法
bash tests/functional/pkgs/acl/test_acl_getfacl_basic/test.sh
# 3. 通过 tmt 执行
tmt run --all plan --name /plans/functional \
test --name /tests/functional/pkgs/acl \
provision --feeling-safe
# 4. 查看汇总结果
tmt run --last report
```
### 10.6 ACL 测试套完整清单
| # | 用例 | 功能点 | 覆盖命令 |
|---|------|--------|----------|
| 1 | `test_acl_acl_inheritance` | 默认 ACL 继承、目录下新建文件继承 | getfacl |
| 2 | `test_acl_acl_permission_verify` | ACL 权限实际生效(读/写/执行) | setfacl, getfacl |
| 3 | `test_acl_chacl_command` | chacl 命令基本操作 | chacl |
| 4 | `test_acl_error_handling` | 不存在的文件/用户、无效权限 | getfacl, setfacl |
| 5 | `test_acl_getfacl_basic` | 7 个 getfacl 参数 (-a/-d/-c/-n/-t) | getfacl |
| 6 | `test_acl_setfacl_advanced` | default ACL、--set、-M 从文件读取 | setfacl |
| 7 | `test_acl_setfacl_basic` | -m/-x/-b 增删改查 | setfacl |
| 8 | `test_acl_setfacl_recursive` | -R 递归设置 | setfacl |
| 9 | `test_acl_setfacl_remove` | -x 按条目删除、-X 文件批量删除 | setfacl |
| 10 | `test_acl_setfacl_symlink` | -L/-P 符号链接处理 | setfacl |
| 11 | `test_acl_special_cases` | 多用户多组、--test 试运行、备份恢复 | setfacl, getfacl |
> **关键设计决策**:每个用例只测试一个明确的主题(如 "getfacl 基本功能"),避免一个巨长脚本涵盖所有功能。这样单独执行/调试更方便,tmt 报告也更精确。
### 10.7 开发检查清单
对照第 7 节的验证清单,逐项确认:
- [x] 每个 `main.fmf` 包含 summary, test, tag, duration, tier, path, require
- [x] `tag` 包含 `functional` (Plan filter) 和 `acl` (软件包标签)
- [x] `require` 包含 `acl` + `coreutils` + `beakerlib`
- [x] 每个 `test.sh` 首行 `#!/bin/bash`sources beakerlib.sh 和 ../lib.sh
- [x] Setup: 调用 `aclSetup` → 创建 `$TmpDir` → `cd $TmpDir`
- [x] Test: 每个功能点至少一个 `rlRun` 或 `rlAssertGrep`
- [x] Cleanup: `cd /` → `rm -rf $TmpDir` → 共享库自动卸载
- [x] 错误路径用例使用 `rlRun "cmd" 1`(期望失败)
- [x] 所有用例独立可运行(依赖共享库但不需要其他用例的输出)
+48 -46
View File
@@ -1,31 +1,33 @@
# 测试报告
# Test Reports
> 测试执行时间:YYYY-MM-DD HH:MM
> 测试环境:openRuyi Creek, kernel xxx, riscv64
> Test execution time: YYYY-MM-DD HH:MM
> Test environment: openRuyi Creek, kernel xxx, riscv64
> :cn: [中文版 (Chinese Version)](test_reports_zh.md)
---
## 概述
## Overview
### 测试概要
### Summary
本次测试覆盖冒烟测试、功能测试、安全测试、性能测试、兼容性测试、可靠性测试和特性测试七大类,基于 tmt 框架 + BeakerLib 脚本执行。
This test run covers seven categories — Smoke, Functional, Security, Performance, Compatibility, Reliability, and Feature tests — executed via the tmt framework with BeakerLib scripts.
### 测试环境
### Test Environment
| 项目 | 描述 |
|------|------|
| **被测系统** | openRuyi Creek |
| **内核版本** | xxx |
| **架构** | riscv64 |
| **测试框架** | tmt x.x.x |
| **测试工具** | BeakerLib |
| **执行方式** | `tmt run --all provision --how local --feeling-safe` |
| Item | Description |
|------|-------------|
| **System Under Test** | openRuyi Creek |
| **Kernel Version** | xxx |
| **Architecture** | riscv64 |
| **Test Framework** | tmt x.x.x |
| **Test Tool** | BeakerLib |
| **Execution Mode** | `tmt run --all provision --how local --feeling-safe` |
### 测试总体结果
### Overall Results
| 测试类型 | 测试套数 | 用例数 | 通过 | 失败 | 跳过 | 通过率 |
|---------|:---:|:---:|:---:|:---:|:---:|:---:|
| Test Type | Suites | Cases | Pass | Fail | Skip | Pass Rate |
|-----------|:---:|:---:|:---:|:---:|:---:|:---:|
| Smoke | 100 | 100 | - | - | - | - |
| Functional | 202 | 566 | - | - | - | - |
| Security | 106 | 106 | - | - | - | - |
@@ -33,14 +35,14 @@
| Compatibility | 188 | 188 | - | - | - | - |
| Reliability | 1 | 1 | - | - | - | - |
| Feature | 0 | 0 | - | - | - | - |
| **合计** | **604** | **968** | - | - | - | - |
| **Total** | **604** | **968** | - | - | - | - |
---
## 冒烟测试
## Smoke Tests
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| Test Suite | Cases | Pass | Fail | Skip | Status |
|------------|:---:|:---:|:---:|:---:|:---:|
| archive | 5 | - | - | - | - |
| dev_tools | 6 | - | - | - | - |
| disk_fs | 6 | - | - | - | - |
@@ -58,56 +60,56 @@
| system_info | 6 | - | - | - | - |
| text_processing | 7 | - | - | - | - |
| user_mgmt | 6 | - | - | - | - |
| **合计** | **100** | - | - | - | - |
| **Total** | **100** | - | - | - | - |
---
## 功能测试
## Functional Tests
| 分类 | 软件包数 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|------|:---:|:---:|:---:|:---:|:---:|:---:|
| Category | Packages | Cases | Pass | Fail | Skip | Status |
|----------|:---:|:---:|:---:|:---:|:---:|:---:|
| pkgs | 202 | 566 | - | - | - | - |
| **合计** | **202** | **566** | - | - | - | - |
| **Total** | **202** | **566** | - | - | - | - |
---
## 安全测试
## Security Tests
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| Test Suite | Cases | Pass | Fail | Skip | Status |
|------------|:---:|:---:|:---:|:---:|:---:|
| CVE | - | - | - | - | - |
| Nmap | - | - | - | - | - |
| **合计** | **106** | - | - | - | - |
| **Total** | **106** | - | - | - | - |
---
## 性能测试
## Performance Tests
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| Test Suite | Cases | Pass | Fail | Skip | Status |
|------------|:---:|:---:|:---:|:---:|:---:|
| UnixBench | 7 | - | - | - | - |
| **合计** | **7** | - | - | - | - |
| **Total** | **7** | - | - | - | - |
---
## 兼容性测试
## Compatibility Tests
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| Test Suite | Cases | Pass | Fail | Skip | Status |
|------------|:---:|:---:|:---:|:---:|:---:|
| LTP POSIX | 188 | - | - | - | - |
| **合计** | **188** | - | - | - | - |
| **Total** | **188** | - | - | - | - |
---
## 可靠性测试
## Reliability Tests
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| 可靠性测试 | 1 | - | - | - | - |
| **合计** | **1** | - | - | - | - |
| Test Suite | Cases | Pass | Fail | Skip | Status |
|------------|:---:|:---:|:---:|:---:|:---:|
| Reliability | 1 | - | - | - | - |
| **Total** | **1** | - | - | - | - |
---
## 特性测试
## Feature Tests
待补充。
TBD.
+115
View File
@@ -0,0 +1,115 @@
# 测试报告
> 测试执行时间:YYYY-MM-DD HH:MM
> 测试环境:openRuyi Creek, kernel xxx, riscv64
> :us: [English Version (英文版)](test_reports.md)
---
## 概述
### 测试概要
本次测试覆盖冒烟测试、功能测试、安全测试、性能测试、兼容性测试、可靠性测试和特性测试七大类,基于 tmt 框架 + BeakerLib 脚本执行。
### 测试环境
| 项目 | 描述 |
|------|------|
| **被测系统** | openRuyi Creek |
| **内核版本** | xxx |
| **架构** | riscv64 |
| **测试框架** | tmt x.x.x |
| **测试工具** | BeakerLib |
| **执行方式** | `tmt run --all provision --how local --feeling-safe` |
### 测试总体结果
| 测试类型 | 测试套数 | 用例数 | 通过 | 失败 | 跳过 | 通过率 |
|---------|:---:|:---:|:---:|:---:|:---:|:---:|
| Smoke | 100 | 100 | - | - | - | - |
| Functional | 202 | 566 | - | - | - | - |
| Security | 106 | 106 | - | - | - | - |
| Performance | 7 | 7 | - | - | - | - |
| Compatibility | 188 | 188 | - | - | - | - |
| Reliability | 1 | 1 | - | - | - | - |
| Feature | 0 | 0 | - | - | - | - |
| **合计** | **604** | **968** | - | - | - | - |
---
## 冒烟测试
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| archive | 5 | - | - | - | - |
| dev_tools | 6 | - | - | - | - |
| disk_fs | 6 | - | - | - | - |
| filesystem | 6 | - | - | - | - |
| kernel | 6 | - | - | - | - |
| logging | 6 | - | - | - | - |
| network | 8 | - | - | - | - |
| package_mgmt | 5 | - | - | - | - |
| permissions | 6 | - | - | - | - |
| process | 6 | - | - | - | - |
| scripting | 7 | - | - | - | - |
| security | 6 | - | - | - | - |
| service_mgmt | 6 | - | - | - | - |
| shell_basics | 8 | - | - | - | - |
| system_info | 6 | - | - | - | - |
| text_processing | 7 | - | - | - | - |
| user_mgmt | 6 | - | - | - | - |
| **合计** | **100** | - | - | - | - |
---
## 功能测试
| 分类 | 软件包数 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|------|:---:|:---:|:---:|:---:|:---:|:---:|
| pkgs | 202 | 566 | - | - | - | - |
| **合计** | **202** | **566** | - | - | - | - |
---
## 安全测试
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| CVE | - | - | - | - | - |
| Nmap | - | - | - | - | - |
| **合计** | **106** | - | - | - | - |
---
## 性能测试
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| UnixBench | 7 | - | - | - | - |
| **合计** | **7** | - | - | - | - |
---
## 兼容性测试
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| LTP POSIX | 188 | - | - | - | - |
| **合计** | **188** | - | - | - | - |
---
## 可靠性测试
| 测试套 | 用例数 | 通过 | 失败 | 跳过 | 状态 |
|-------|:---:|:---:|:---:|:---:|:---:|
| 可靠性测试 | 1 | - | - | - | - |
| **合计** | **1** | - | - | - | - |
---
## 特性测试
待补充。
+140 -170
View File
@@ -1,72 +1,74 @@
# 用户指南
# User Guide
> 适用于**干净服务器**环境,从零开始执行测试。
> For **clean server** environments, getting started from scratch.
> :cn: [中文版 (Chinese Version)](user_guide_zh.md)
---
## 1. 环境准备
## 1. Environment Setup
### 1.1 安装 git
### 1.1 Install git
```bash
sudo dnf install -y git
```
### 1.2 克隆代码仓库
### 1.2 Clone the Repository
```bash
git clone https://git.openruyi.cn/woqidaideshi/openruyi-autotest.git
cd openruyi-autotest
```
### 1.3 安装 tmt beakerlib
### 1.3 Install tmt and beakerlib
测试用例使用 tmt (Test Management Tool) 框架管理和执行:
Test cases are managed and executed using the tmt (Test Management Tool) framework:
```bash
# 安装 tmt(基础版,支持本地执行)
# Install tmt (basic version, supports local execution)
sudo dnf install -y tmt
# 安装 beakerlib 测试框架
# Install beakerlib test framework
sudo dnf install -y beakerlib
# beakerlib 运行时依赖
# beakerlib runtime dependencies
sudo dnf install -y python-six
# 验证安装
# Verify installation
tmt --version
rpm -q beakerlib
```
> **riscv64 架构**:`tmt` 可能不在 dnf 仓库中,可通过 pip 安装:
> **riscv64 architecture**: `tmt` may not be in the dnf repo; install via pip:
> ```bash
> sudo dnf install -y python3 python3-pip rust gcc gcc-c++ beakerlib
> sudo pip3 install --break-system-packages tmt
> ```
### 1.4 配置测试拓扑(可选)
### 1.4 Configure Test Topology (Optional)
测试计划会自动检测当前机器硬件资源(CPU/内存/磁盘/网卡)是否满足测试用例的硬件需求。如需在多台服务器上执行测试,或者自定义服务器连接信息,可配置 `topology.env`
Test plans automatically detect whether the current machine's hardware (CPU/memory/disk/NICs) meets test case hardware requirements. To run tests across multiple servers, or customize server connection info, configure `topology.env`:
```bash
# 复制模板
# Copy template
cp topology.env.example topology.env
# 按实际环境修改
# Modify for your environment
vim topology.env
```
**配置变量说明:**
**Configuration variables:**
| 变量 | 说明 | 默认值 |
|------|------|--------|
| `TEST_SERVER_COUNT` | 可用服务器数量 | 1 |
| `TEST_SERVER_1_HOST` | 第 1 台服务器 IP/主机名 | (无) |
| `TEST_SERVER_1_PORT` | 第 1 台服务器 SSH 端口 | 22 |
| `TEST_SERVER_1_USER` | 第 1 台服务器登录用户名 | root |
| `TEST_SERVER_1_PASSWORD` | 第 1 台服务器登录密码 | (无) |
| Variable | Description | Default |
|----------|-------------|---------|
| `TEST_SERVER_COUNT` | Number of available servers | 1 |
| `TEST_SERVER_1_HOST` | Server 1 IP/hostname | (none) |
| `TEST_SERVER_1_PORT` | Server 1 SSH port | 22 |
| `TEST_SERVER_1_USER` | Server 1 login username | root |
| `TEST_SERVER_1_PASSWORD` | Server 1 login password | (none) |
多服务器示例(3 台):
Multi-server example (3 servers):
```ini
TEST_SERVER_COUNT=3
@@ -83,16 +85,16 @@ TEST_SERVER_2_PASSWORD=mypassword
TEST_SERVER_3_HOST=192.168.1.12
TEST_SERVER_3_USER=root
# 端口/密码未设置时使用默认值 22 / 无密码
# Port/password use defaults (22 / no password) when not set
```
> **未配置 `topology.env` 不影响单机测试**。系统将当前机器视为唯一服务器(`TEST_SERVER_COUNT` 默认为 1),硬件资源通过系统命令自动获取。
> **Not configuring `topology.env` does not affect single-machine testing**. The system treats the current machine as the only server (`TEST_SERVER_COUNT` defaults to 1), and hardware resources are auto-detected via system commands.
---
## 2. 执行单个测试用例
## 2. Running a Single Test Case
比如 acl 测试套中的 `test_acl_getfacl_basic`
Example: `test_acl_getfacl_basic` in the acl test suite:
```bash
cd openruyi-autotest
@@ -102,13 +104,13 @@ tmt run --all --verbose plan --name /plans/functional \
provision --feeling-safe
```
> **关于 `--feeling-safe`**tmt 默认会询问用户确认后才执行,加上此参数跳过交互式确认,适合自动化/无人值守场景。
> **About `--feeling-safe`**: tmt asks for user confirmation before execution by default; this flag skips interactive confirmation, suitable for automation/unattended scenarios.
---
## 3. 执行单个测试套
## 3. Running a Single Test Suite
比如 acl
Example: acl:
```bash
cd openruyi-autotest
@@ -120,9 +122,9 @@ tmt run --all plan --name /plans/functional \
---
## 4. 执行测试类型全量用例
## 4. Running All Cases of a Test Type
比如功能测试(functional),包含 202 个软件包,共 566 个测试用例:
Example: functional tests, covering 202 packages with 566 test cases:
```bash
cd openruyi-autotest
@@ -131,7 +133,7 @@ tmt run --all plan --name /plans/functional \
provision --feeling-safe
```
比如特性测试(feature):
Example: feature tests:
```bash
tmt run --all plan --name /plans/feature \
@@ -140,69 +142,69 @@ tmt run --all plan --name /plans/feature \
---
## 5. 查看测试结果和日志
## 5. Viewing Test Results and Logs
### 5.1 tmt 结果目录
### 5.1 tmt Results Directory
tmt 每次执行都会在 `/var/tmp/tmt/run-*` 下生成一个运行目录,包含所有测试用例的详细日志:
Each tmt run creates a run directory under `/var/tmp/tmt/run-*` containing detailed logs for all test cases:
```bash
# 列出所有历史运行
# List all historical runs
ls -lt /var/tmp/tmt/
# 进入最近一次运行目录
# Enter the most recent run directory
cd $(ls -dt /var/tmp/tmt/run-* | head -1)
```
运行目录结构:
Run directory structure:
```
/var/tmp/tmt/run-XXX/
├── plans/
│ └── {plan-name}/ # functional
│ └── {plan-name}/ # e.g. functional
│ └── execute/
│ └── data/
│ └── guest/ # 本地执行时为 guest
│ └── guest/ # local execution shows as guest
│ └── default-0/
│ └── tests/functional/pkgs/acl/
│ ├── test_acl_getfacl_basic-1/
│ │ └── output.txt # 该用例的完整输出
│ │ └── output.txt # Full output of this case
│ ├── test_acl_setfacl_basic-2/
│ │ └── output.txt
│ └── ...
└── run.yaml # 运行元数据
└── run.yaml # Run metadata
```
### 5.2 查看单个用例日志
### 5.2 Viewing a Single Case Log
```bash
# 进入最近一次运行目录
# Enter the most recent run directory
RUN_DIR=$(ls -dt /var/tmp/tmt/run-* | head -1)
# 路径包含 plans/ guest/default-0/ 层级
# Path includes plans/ and guest/default-0/ levels
BASE="$RUN_DIR/plans/functional/execute/data/guest/default-0"
# 查看某个测试用例的完整输出
# View full output of a specific test case
cat "$BASE/tests/functional/pkgs/acl/test_acl_getfacl_basic-1/output.txt"
```
### 5.3 查看汇总报告
### 5.3 Viewing Summary Report
```bash
# 简要报告
# Brief report
tmt run --last report
# 详细报告(含每个用例的 stdout/stderr
# Detailed report (with stdout/stderr for each case)
tmt run --last report -fvvv
```
### 5.4 查看所有用例的执行状态
### 5.4 Viewing Execution Status of All Cases
```bash
RUN_DIR=$(ls -dt /var/tmp/tmt/run-* | head -1)
BASE="$RUN_DIR/plans/functional/execute/data/guest/default-0"
# 列出所有用例的 output.txt 并显示最后几行(通常包含 PASS/FAIL
# List all output.txt files and show last few lines (usually contains PASS/FAIL)
find "$BASE" -name "output.txt" | sort | while read f; do
dir=$(dirname "$f")
echo "=== $(basename "$dir") ==="
@@ -213,9 +215,9 @@ done
---
## 6. 执行所有测试脚本
## 6. Running All Tests
从项目根目录执行全部测试(所有计划):
Run all tests (all plans) from the project root:
```bash
cd openruyi-autotest
@@ -225,128 +227,128 @@ tmt run --all provision --how local --feeling-safe
---
## 7. 目录结构速查
## 7. Directory Structure Quick Reference
```
tests/
├── smoke/ # 冒烟测试(100 个用例)
│ ├── archive/ # 归档工具(tar, gzip, xz
│ ├── dev_tools/ # 开发工具
│ ├── disk_fs/ # 磁盘/文件系统
│ ├── filesystem/ # 文件系统操作
│ ├── kernel/ # 内核功能
│ ├── logging/ # 日志系统
│ ├── network/ # 网络工具
│ ├── package_mgmt/ # 包管理
│ ├── permissions/ # 权限管理
│ ├── process/ # 进程管理
│ ├── scripting/ # 脚本语言
│ ├── security/ # 安全相关
│ ├── service_mgmt/ # 服务管理
│ ├── shell_basics/ # Shell 基础
│ ├── system_info/ # 系统信息
│ ├── text_processing/# 文本处理
│ └── user_mgmt/ # 用户管理
├── functional/pkgs/ # 功能测试(202 个包, 566 用例)
│ ├── acl/ # ACL 权限管理(参考标准)
│ ├── attr/ # 扩展属性
├── smoke/ # Smoke tests (100 cases)
│ ├── archive/ # Archive tools (tar, gzip, xz)
│ ├── dev_tools/ # Development tools
│ ├── disk_fs/ # Disk/filesystem
│ ├── filesystem/ # Filesystem operations
│ ├── kernel/ # Kernel functions
│ ├── logging/ # Logging system
│ ├── network/ # Network tools
│ ├── package_mgmt/ # Package management
│ ├── permissions/ # Permission management
│ ├── process/ # Process management
│ ├── scripting/ # Scripting languages
│ ├── security/ # Security-related
│ ├── service_mgmt/ # Service management
│ ├── shell_basics/ # Shell basics
│ ├── system_info/ # System information
│ ├── text_processing/# Text processing
│ └── user_mgmt/ # User management
├── functional/pkgs/ # Functional tests (202 packages, 566 cases)
│ ├── acl/ # ACL permission management (reference standard)
│ ├── attr/ # Extended attributes
│ ├── bash/ # Bash shell
│ ├── coreutils/ # 核心工具集
│ ├── ... # 更多软件包
├── security/ # 安全测试(106 个用例)
│ ├── cve/ # CVE 漏洞验证
│ └── nmap/ # Nmap 端口扫描
├── compatibility/ # 兼容性测试(188 个用例)
│ └── ltp_posix/ # LTP POSIX 接口兼容性
├── performance/ # 性能测试
│ └── unixbench/ # UnixBench 基准测试
├── feature/ # 特性测试
│ └── <xxx>/ # 特性名称
└── reliability/ # 可靠性测试
│ ├── coreutils/ # Core utilities
│ ├── ... # More packages
├── security/ # Security tests (106 cases)
│ ├── cve/ # CVE vulnerability verification
│ └── nmap/ # Nmap port scanning
├── compatibility/ # Compatibility tests (188 cases)
│ └── ltp_posix/ # LTP POSIX interface compatibility
├── performance/ # Performance tests
│ └── unixbench/ # UnixBench benchmarks
├── feature/ # Feature tests
│ └── <xxx>/ # Feature name
└── reliability/ # Reliability tests
└── test.sh
```
---
## 8. 常见问题
## 8. FAQ
### Q: 执行报错 `beakerlib.sh: No such file or directory`
### Q: Error `beakerlib.sh: No such file or directory`
```bash
sudo dnf install -y beakerlib
```
### Q: tmt 命令找不到
### Q: tmt command not found
```bash
# dnf 安装
# dnf install
sudo dnf install -y tmt
# pip 安装(riscv64
# Or pip install (riscv64)
sudo pip3 install --break-system-packages tmt
```
### Q: 测试因权限不足失败
### Q: Tests fail due to insufficient permissions
部分测试脚本使用 `sudo` 执行特权操作,需确保当前用户有 sudo 权限:
Some test scripts use `sudo` for privileged operations; ensure the current user has sudo access:
```bash
# 验证 sudo 可用
# Verify sudo works
sudo whoami
```
### Q: 只想查看某个计划包含哪些测试(不执行)
### Q: How to see which tests a plan includes (without executing)?
```bash
tmt plan show /plans/functional
tmt test ls /tests/functional/pkgs/acl
```
### Q: 查看上次执行的详细信息
### Q: View detailed results of the last run
```bash
tmt run --last report -fvvv
```
> **注意**`tmt run --last report` 有时会因 tmt 内部轮询历史数据而较慢。如果只是查看结果摘要,可以直接读取 `run.yaml` 或查看各用例的 `output.txt`
> **Note**: `tmt run --last report` can sometimes be slow due to tmt internally polling historical data. If you just want a summary, read `run.yaml` directly or check each case's `output.txt`.
### Q: 执行 tmt run 时报 `Synchronization lock ... is stale`
### Q: Error `Synchronization lock ... is stale` when running tmt
```bash
# 清理旧的 tmt 锁文件(通常由 root 拥有的旧运行残留)
# Clean up stale tmt lock files (usually left by root-owned runs)
sudo rm -f /var/tmp/tmt-test.pid.lock
```
---
## 9. 实战示例:ACL 测试套
## 9. Practical Example: ACL Test Suite
本节以 `acl` 测试套为例,完整展示从环境准备到查看结果的全流程。
This section uses the `acl` test suite as a complete walkthrough from environment setup to viewing results.
### 9.1 前提条件
### 9.1 Prerequisites
- 一台干净的 openRuyi 服务器(本示例:10.20.237.192:12055
- 已安装 gittmtbeakerlib(参考第 1 节)
- A clean openRuyi server (this example: 10.20.237.192:12055)
- git, tmt, beakerlib installed (see Section 1)
### 9.2 克隆仓库并安装依赖
### 9.2 Clone Repository and Install Dependencies
```bash
git clone https://git.openruyi.cn/woqidaideshi/openruyi-autotest.git
cd openruyi-autotest
# 安装 tmt 和测试依赖
# Install tmt and test dependencies
sudo dnf install -y tmt beakerlib python-six
sudo dnf install -y acl # ACL 测试目标软件包
sudo dnf install -y acl # ACL test target package
```
### 9.3 (可选)配置 topology.env
### 9.3 (Optional) Configure topology.env
```bash
cp topology.env.example topology.env
vim topology.env
```
写入内容:
Write:
```ini
TEST_SERVER_COUNT=1
@@ -356,17 +358,17 @@ TEST_SERVER_1_USER=openruyi
TEST_SERVER_1_PASSWORD=openruyi
```
> 如果当前用户就是 `openruyi` 且在本机执行,可以不配置 `topology.env`tmt 会自动检测。
> If the current user is already `openruyi` and running locally, you can skip configuring `topology.env`; tmt will auto-detect.
### 9.4 清理锁文件(重要)
### 9.4 Clean Up Lock Files (Important)
如果之前执行过 tmt 但异常中断,锁文件可能残留:
If tmt was previously run but interrupted abnormally, lock files may remain:
```bash
sudo rm -f /var/tmp/tmt-test.pid.lock
```
### 9.5 执行 ACL 测试套
### 9.5 Execute ACL Test Suite
```bash
cd ~/openruyi-autotest
@@ -376,20 +378,20 @@ tmt run --all plan --name /plans/functional \
provision --feeling-safe
```
**命令解析:**
**Command breakdown:**
| 参数 | 含义 |
|------|------|
| `--all` | 跳过交互确认(和 `--feeling-safe` 配合使用) |
| `plan --name /plans/functional` | 使用功能测试计划(定义在 `plans/functional.fmf` |
| `test --name /tests/functional/pkgs/acl` | 只执行 `tests/functional/pkgs/acl/` 下的用例 |
| `provision --feeling-safe` | 本地执行,跳过确认 |
| Parameter | Meaning |
|-----------|---------|
| `--all` | Skip interactive confirmation (use with `--feeling-safe`) |
| `plan --name /plans/functional` | Use the functional test plan (defined in `plans/functional.fmf`) |
| `test --name /tests/functional/pkgs/acl` | Only run cases under `tests/functional/pkgs/acl/` |
| `provision --feeling-safe` | Local execution, skip confirmation |
**预期输出关键行:**
**Expected output key lines:**
```
Found 1 plan.
summary: 功能测试 - 验证所有功能测试用例
summary: Functional Test - Verify all functional test cases
discover
how: fmf
directory: /home/openruyi/openruyi-autotest/tests/functional/pkgs/acl
@@ -398,62 +400,30 @@ discover
/tests/functional/pkgs/acl/test_acl_acl_inheritance
/tests/functional/pkgs/acl/test_acl_acl_permission_verify
...
total: 11 tests
```
执行过程大约需要 **20~30 分钟**(取决于服务器性能)。每个测试用例的输出会实时显示在终端中。
### 9.6 查看结果
#### 方式一:查看汇总报告
### 9.6 View Results
```bash
cd ~/openruyi-autotest
tmt run --last report
# Enter the most recent run directory
cd $(ls -dt /var/tmp/tmt/run-* | head -1)
# View results for a specific case
cat plans/functional/execute/data/guest/default-0/tests/functional/pkgs/acl/test_acl_getfacl_basic-1/output.txt
```
输出示例:
**Expected result**: All cases show `PASS` at the end of the output.
```
total: 11 tests passed
```
### 9.7 FAQ
#### 方式二:遍历所有 output.txt
**Q: `acl` package not found?**
```bash
RUN_DIR=$(ls -dt /var/tmp/tmt/run-* | head -1)
BASE="$RUN_DIR/plans/functional/execute/data/guest/default-0"
find "$BASE" -name "output.txt" | sort | while read f; do
echo "=== $(basename $(dirname "$f")) ==="
tail -3 "$f"
echo ""
done
sudo dnf install -y acl
```
预期每个用例最后一行都是 `EXIT_CODE=0``TESTS_RESULT=PASS`
#### 方式三:查看单个用例的输出
**Q: Which cases are available under the acl suite?**
```bash
BASE="/var/tmp/tmt/run-*/plans/functional/execute/data/guest/default-0"
cat "$BASE/tests/functional/pkgs/acl/test_acl_getfacl_basic-1/output.txt"
tmt test ls /tests/functional/pkgs/acl
```
### 9.7 ACL 测试套包含的用例
| 序号 | 用例名 | 说明 |
|------|--------|------|
| 1 | `test_acl_acl_inheritance` | ACL 权限继承验证 |
| 2 | `test_acl_acl_permission_verify` | ACL 权限正确性验证 |
| 3 | `test_acl_chacl_command` | chacl 命令功能测试 |
| 4 | `test_acl_error_handling` | 错误处理与边界情况 |
| 5 | `test_acl_getfacl_basic` | getfacl 基本功能 |
| 6 | `test_acl_getfacl_command` | getfacl 命令行选项 |
| 7 | `test_acl_setfacl_basic` | setfacl 基本功能 |
| 8 | `test_acl_setfacl_default_acl` | setfacl 默认 ACL |
| 9 | `test_acl_setfacl_modify_acl` | setfacl 修改已有 ACL |
| 10 | `test_acl_setfacl_recursive` | setfacl 递归操作 |
| 11 | `test_acl_tool_installation` | ACL 工具安装检查 |
> 共 11 个用例,全部通过即为 ACL 功能正常。此套件可作为其他软件包测试的参考模板。其他 `tests/functional/pkgs/<包名>/` 下的测试套执行方式与此完全相同,只需将 `test --name` 中的 `acl` 替换为目标包名即可。
+461
View File
@@ -0,0 +1,461 @@
# 用户指南
> 适用于**干净服务器**环境,从零开始执行测试。
> :us: [English Version (英文版)](user_guide.md)
---
## 1. 环境准备
### 1.1 安装 git
```bash
sudo dnf install -y git
```
### 1.2 克隆代码仓库
```bash
git clone https://git.openruyi.cn/woqidaideshi/openruyi-autotest.git
cd openruyi-autotest
```
### 1.3 安装 tmt 和 beakerlib
测试用例使用 tmt (Test Management Tool) 框架管理和执行:
```bash
# 安装 tmt(基础版,支持本地执行)
sudo dnf install -y tmt
# 安装 beakerlib 测试框架
sudo dnf install -y beakerlib
# beakerlib 运行时依赖
sudo dnf install -y python-six
# 验证安装
tmt --version
rpm -q beakerlib
```
> **riscv64 架构**`tmt` 可能不在 dnf 仓库中,可通过 pip 安装:
> ```bash
> sudo dnf install -y python3 python3-pip rust gcc gcc-c++ beakerlib
> sudo pip3 install --break-system-packages tmt
> ```
### 1.4 配置测试拓扑(可选)
测试计划会自动检测当前机器硬件资源(CPU/内存/磁盘/网卡)是否满足测试用例的硬件需求。如需在多台服务器上执行测试,或者自定义服务器连接信息,可配置 `topology.env`
```bash
# 复制模板
cp topology.env.example topology.env
# 按实际环境修改
vim topology.env
```
**配置变量说明:**
| 变量 | 说明 | 默认值 |
|------|------|--------|
| `TEST_SERVER_COUNT` | 可用服务器数量 | 1 |
| `TEST_SERVER_1_HOST` | 第 1 台服务器 IP/主机名 | (无) |
| `TEST_SERVER_1_PORT` | 第 1 台服务器 SSH 端口 | 22 |
| `TEST_SERVER_1_USER` | 第 1 台服务器登录用户名 | root |
| `TEST_SERVER_1_PASSWORD` | 第 1 台服务器登录密码 | (无) |
多服务器示例(3 台):
```ini
TEST_SERVER_COUNT=3
TEST_SERVER_1_HOST=192.168.1.10
TEST_SERVER_1_PORT=22
TEST_SERVER_1_USER=root
TEST_SERVER_1_PASSWORD=mypassword
TEST_SERVER_2_HOST=192.168.1.11
TEST_SERVER_2_PORT=12055
TEST_SERVER_2_USER=openruyi
TEST_SERVER_2_PASSWORD=mypassword
TEST_SERVER_3_HOST=192.168.1.12
TEST_SERVER_3_USER=root
# 端口/密码未设置时使用默认值 22 / 无密码
```
> **未配置 `topology.env` 不影响单机测试**。系统将当前机器视为唯一服务器(`TEST_SERVER_COUNT` 默认为 1),硬件资源通过系统命令自动获取。
---
## 2. 执行单个测试用例
比如 acl 测试套中的 `test_acl_getfacl_basic`
```bash
cd openruyi-autotest
tmt run --all --verbose plan --name /plans/functional \
test --name /tests/functional/pkgs/acl/test_acl_getfacl_basic \
provision --feeling-safe
```
> **关于 `--feeling-safe`**tmt 默认会询问用户确认后才执行,加上此参数跳过交互式确认,适合自动化/无人值守场景。
---
## 3. 执行单个测试套
比如 acl
```bash
cd openruyi-autotest
tmt run --all plan --name /plans/functional \
test --name /tests/functional/pkgs/acl \
provision --feeling-safe
```
---
## 4. 执行测试类型全量用例
比如功能测试(functional),包含 202 个软件包,共 566 个测试用例:
```bash
cd openruyi-autotest
tmt run --all plan --name /plans/functional \
provision --feeling-safe
```
比如特性测试(feature):
```bash
tmt run --all plan --name /plans/feature \
provision --feeling-safe
```
---
## 5. 查看测试结果和日志
### 5.1 tmt 结果目录
tmt 每次执行都会在 `/var/tmp/tmt/run-*` 下生成一个运行目录,包含所有测试用例的详细日志:
```bash
# 列出所有历史运行
ls -lt /var/tmp/tmt/
# 进入最近一次运行目录
cd $(ls -dt /var/tmp/tmt/run-* | head -1)
```
运行目录结构:
```
/var/tmp/tmt/run-XXX/
├── plans/
│ └── {plan-name}/ # 如 functional
│ └── execute/
│ └── data/
│ └── guest/ # 本地执行时为 guest
│ └── default-0/
│ └── tests/functional/pkgs/acl/
│ ├── test_acl_getfacl_basic-1/
│ │ └── output.txt # 该用例的完整输出
│ ├── test_acl_setfacl_basic-2/
│ │ └── output.txt
│ └── ...
└── run.yaml # 运行元数据
```
### 5.2 查看单个用例日志
```bash
# 进入最近一次运行目录
RUN_DIR=$(ls -dt /var/tmp/tmt/run-* | head -1)
# 路径包含 plans/ 和 guest/default-0/ 层级
BASE="$RUN_DIR/plans/functional/execute/data/guest/default-0"
# 查看某个测试用例的完整输出
cat "$BASE/tests/functional/pkgs/acl/test_acl_getfacl_basic-1/output.txt"
```
### 5.3 查看汇总报告
```bash
# 简要报告
tmt run --last report
# 详细报告(含每个用例的 stdout/stderr
tmt run --last report -fvvv
```
### 5.4 查看所有用例的执行状态
```bash
RUN_DIR=$(ls -dt /var/tmp/tmt/run-* | head -1)
BASE="$RUN_DIR/plans/functional/execute/data/guest/default-0"
# 列出所有用例的 output.txt 并显示最后几行(通常包含 PASS/FAIL)
find "$BASE" -name "output.txt" | sort | while read f; do
dir=$(dirname "$f")
echo "=== $(basename "$dir") ==="
tail -5 "$f"
echo ""
done
```
---
## 6. 执行所有测试脚本
从项目根目录执行全部测试(所有计划):
```bash
cd openruyi-autotest
tmt run --all provision --how local --feeling-safe
```
---
## 7. 目录结构速查
```
tests/
├── smoke/ # 冒烟测试(100 个用例)
│ ├── archive/ # 归档工具(tar, gzip, xz
│ ├── dev_tools/ # 开发工具
│ ├── disk_fs/ # 磁盘/文件系统
│ ├── filesystem/ # 文件系统操作
│ ├── kernel/ # 内核功能
│ ├── logging/ # 日志系统
│ ├── network/ # 网络工具
│ ├── package_mgmt/ # 包管理
│ ├── permissions/ # 权限管理
│ ├── process/ # 进程管理
│ ├── scripting/ # 脚本语言
│ ├── security/ # 安全相关
│ ├── service_mgmt/ # 服务管理
│ ├── shell_basics/ # Shell 基础
│ ├── system_info/ # 系统信息
│ ├── text_processing/# 文本处理
│ └── user_mgmt/ # 用户管理
├── functional/pkgs/ # 功能测试(202 个包, 566 用例)
│ ├── acl/ # ACL 权限管理(参考标准)
│ ├── attr/ # 扩展属性
│ ├── bash/ # Bash shell
│ ├── coreutils/ # 核心工具集
│ ├── ... # 更多软件包
├── security/ # 安全测试(106 个用例)
│ ├── cve/ # CVE 漏洞验证
│ └── nmap/ # Nmap 端口扫描
├── compatibility/ # 兼容性测试(188 个用例)
│ └── ltp_posix/ # LTP POSIX 接口兼容性
├── performance/ # 性能测试
│ └── unixbench/ # UnixBench 基准测试
├── feature/ # 特性测试
│ └── <xxx>/ # 特性名称
└── reliability/ # 可靠性测试
└── test.sh
```
---
## 8. 常见问题
### Q: 执行报错 `beakerlib.sh: No such file or directory`
```bash
sudo dnf install -y beakerlib
```
### Q: tmt 命令找不到
```bash
# dnf 安装
sudo dnf install -y tmt
# 或 pip 安装(riscv64
sudo pip3 install --break-system-packages tmt
```
### Q: 测试因权限不足失败
部分测试脚本使用 `sudo` 执行特权操作,需确保当前用户有 sudo 权限:
```bash
# 验证 sudo 可用
sudo whoami
```
### Q: 只想查看某个计划包含哪些测试(不执行)
```bash
tmt plan show /plans/functional
tmt test ls /tests/functional/pkgs/acl
```
### Q: 查看上次执行的详细信息
```bash
tmt run --last report -fvvv
```
> **注意**`tmt run --last report` 有时会因 tmt 内部轮询历史数据而较慢。如果只是查看结果摘要,可以直接读取 `run.yaml` 或查看各用例的 `output.txt`。
### Q: 执行 tmt run 时报 `Synchronization lock ... is stale`
```bash
# 清理旧的 tmt 锁文件(通常由 root 拥有的旧运行残留)
sudo rm -f /var/tmp/tmt-test.pid.lock
```
---
## 9. 实战示例:ACL 测试套
本节以 `acl` 测试套为例,完整展示从环境准备到查看结果的全流程。
### 9.1 前提条件
- 一台干净的 openRuyi 服务器(本示例:10.20.237.192:12055
- 已安装 git、tmt、beakerlib(参考第 1 节)
### 9.2 克隆仓库并安装依赖
```bash
git clone https://git.openruyi.cn/woqidaideshi/openruyi-autotest.git
cd openruyi-autotest
# 安装 tmt 和测试依赖
sudo dnf install -y tmt beakerlib python-six
sudo dnf install -y acl # ACL 测试目标软件包
```
### 9.3 (可选)配置 topology.env
```bash
cp topology.env.example topology.env
vim topology.env
```
写入内容:
```ini
TEST_SERVER_COUNT=1
TEST_SERVER_1_HOST=10.20.237.192
TEST_SERVER_1_PORT=12055
TEST_SERVER_1_USER=openruyi
TEST_SERVER_1_PASSWORD=openruyi
```
> 如果当前用户就是 `openruyi` 且在本机执行,可以不配置 `topology.env`tmt 会自动检测。
### 9.4 清理锁文件(重要)
如果之前执行过 tmt 但异常中断,锁文件可能残留:
```bash
sudo rm -f /var/tmp/tmt-test.pid.lock
```
### 9.5 执行 ACL 测试套
```bash
cd ~/openruyi-autotest
tmt run --all plan --name /plans/functional \
test --name /tests/functional/pkgs/acl \
provision --feeling-safe
```
**命令解析:**
| 参数 | 含义 |
|------|------|
| `--all` | 跳过交互确认(和 `--feeling-safe` 配合使用) |
| `plan --name /plans/functional` | 使用功能测试计划(定义在 `plans/functional.fmf` |
| `test --name /tests/functional/pkgs/acl` | 只执行 `tests/functional/pkgs/acl/` 下的用例 |
| `provision --feeling-safe` | 本地执行,跳过确认 |
**预期输出关键行:**
```
Found 1 plan.
summary: 功能测试 - 验证所有功能测试用例
discover
how: fmf
directory: /home/openruyi/openruyi-autotest/tests/functional/pkgs/acl
filter: tag:functional
tests:
/tests/functional/pkgs/acl/test_acl_acl_inheritance
/tests/functional/pkgs/acl/test_acl_acl_permission_verify
...
total: 11 tests
```
执行过程大约需要 **20~30 分钟**(取决于服务器性能)。每个测试用例的输出会实时显示在终端中。
### 9.6 查看结果
#### 方式一:查看汇总报告
```bash
cd ~/openruyi-autotest
tmt run --last report
```
输出示例:
```
total: 11 tests passed
```
#### 方式二:遍历所有 output.txt
```bash
RUN_DIR=$(ls -dt /var/tmp/tmt/run-* | head -1)
BASE="$RUN_DIR/plans/functional/execute/data/guest/default-0"
find "$BASE" -name "output.txt" | sort | while read f; do
echo "=== $(basename $(dirname "$f")) ==="
tail -3 "$f"
echo ""
done
```
预期每个用例最后一行都是 `EXIT_CODE=0``TESTS_RESULT=PASS`
#### 方式三:查看单个用例的输出
```bash
BASE="/var/tmp/tmt/run-*/plans/functional/execute/data/guest/default-0"
cat "$BASE/tests/functional/pkgs/acl/test_acl_getfacl_basic-1/output.txt"
```
### 9.7 ACL 测试套包含的用例
| 序号 | 用例名 | 说明 |
|------|--------|------|
| 1 | `test_acl_acl_inheritance` | ACL 权限继承验证 |
| 2 | `test_acl_acl_permission_verify` | ACL 权限正确性验证 |
| 3 | `test_acl_chacl_command` | chacl 命令功能测试 |
| 4 | `test_acl_error_handling` | 错误处理与边界情况 |
| 5 | `test_acl_getfacl_basic` | getfacl 基本功能 |
| 6 | `test_acl_getfacl_command` | getfacl 命令行选项 |
| 7 | `test_acl_setfacl_basic` | setfacl 基本功能 |
| 8 | `test_acl_setfacl_default_acl` | setfacl 默认 ACL |
| 9 | `test_acl_setfacl_modify_acl` | setfacl 修改已有 ACL |
| 10 | `test_acl_setfacl_recursive` | setfacl 递归操作 |
| 11 | `test_acl_tool_installation` | ACL 工具安装检查 |
> 共 11 个用例,全部通过即为 ACL 功能正常。此套件可作为其他软件包测试的参考模板。其他 `tests/functional/pkgs/<包名>/` 下的测试套执行方式与此完全相同,只需将 `test --name` 中的 `acl` 替换为目标包名即可。
+3 -3
View File
@@ -1,7 +1,7 @@
# 全量测试计划
# 执行所有测试用例
# Full Test Plan
# Execute all test cases
summary: 全量测试 - 执行所有测试用例
summary: Full Test - Execute all test cases
environment-file:
- topology.env
+3 -3
View File
@@ -1,7 +1,7 @@
# 兼容性测试计划
# 验证系统在不同环境下的兼容性
# Compatibility Test Plan
# Verify system compatibility across different environments
summary: 兼容性测试 - 验证系统兼容性
summary: Compatibility Test - Verify system compatibility
environment-file:
- topology.env
+1 -1
View File
@@ -1,4 +1,4 @@
summary: 特性测试计划
summary: Feature Test Plan
tier: 1
environment-file:
+5 -5
View File
@@ -1,14 +1,14 @@
# 功能测试计划
# 执行所有功能测试用例
# Functional Test Plan
# Execute all functional test cases
summary: 功能测试 - 验证所有功能测试用例
summary: Functional Test - Verify all functional test cases
environment-file:
- topology.env
discover:
how: fmf
# 发现所有标记为 functional 的测试
# Discover all tests tagged as functional
filter: "tag:functional"
provision:
@@ -20,7 +20,7 @@ execute:
prepare:
how: shell
script:
- echo "准备测试环境..."
- echo "Preparing test environment..."
- dnf install -y curl wget 2>/dev/null || true
report:
+5 -5
View File
@@ -1,14 +1,14 @@
# 集成测试计划
# 执行集成测试,可选在容器中运行
# Integration Test Plan
# Execute integration tests, optionally in containers
summary: 集成测试 - 验证系统集成功能
summary: Integration Test - Verify system integration features
discover:
how: fmf
filter: "tag:integration"
provision:
# 可选: 使用容器运行测试,也可改为 local
# Optional: Run tests in container, can also switch to local
how: container
image: fedora:latest
@@ -18,7 +18,7 @@ execute:
prepare:
how: shell
script:
- echo "准备集成测试环境..."
- echo "Preparing integration test environment..."
- dnf install -y curl wget git 2>/dev/null || true
report:
+3 -3
View File
@@ -1,7 +1,7 @@
# 性能测试计划
# 验证系统性能指标
# Performance Test Plan
# Verify system performance metrics
summary: 性能测试 - 验证系统性能指标
summary: Performance Test - Verify system performance metrics
environment-file:
- topology.env
+3 -3
View File
@@ -1,7 +1,7 @@
# 可靠性测试计划
# 验证系统稳定性和可靠性
# Reliability Test Plan
# Verify system stability and reliability
summary: 可靠性测试 - 验证系统稳定性和可靠性
summary: Reliability Test - Verify system stability and reliability
environment-file:
- topology.env
+3 -3
View File
@@ -1,7 +1,7 @@
# 安全测试计划
# 验证系统安全特性
# Security Test Plan
# Verify system security features
summary: 安全测试 - 验证系统安全特性
summary: Security Test - Verify system security features
environment-file:
- topology.env
+1 -1
View File
@@ -1,4 +1,4 @@
summary: 冒烟测试 - 快速验证系统基本功能(100个用例,17个套件)
summary: Smoke Test - Quick verification of basic system functionality (100 cases, 17 suites)
tier: 0
environment-file:
+7 -7
View File
@@ -1,12 +1,12 @@
summary: 兼容性测试 - LTP POSIX - aio
summary: Compatibility test - LTP POSIX - aio
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 15m
tier: 2
path: /tests/compatibility/ltp_posix/aio
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - aio/aio_cancel
summary: Compatibility test - LTP POSIX - aio/aio_cancel
test: ./test.sh
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/aio/test_ltp_posix_aio_aio_cancel
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: aio / aio_cancel"
rlRun "run_posix_iface_test 'aio_cancel'" 0 "aio/aio_cancel 接口一致性测试"
rlPhaseStartTest "POSIX Interface: aio / aio_cancel"
rlRun "run_posix_iface_test 'aio_cancel'" 0 "aio/aio_cancel Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - aio/aio_error
summary: Compatibility test - LTP POSIX - aio/aio_error
test: ./test.sh
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/aio/test_ltp_posix_aio_aio_error
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: aio / aio_error"
rlRun "run_posix_iface_test 'aio_error'" 0 "aio/aio_error 接口一致性测试"
rlPhaseStartTest "POSIX Interface: aio / aio_error"
rlRun "run_posix_iface_test 'aio_error'" 0 "aio/aio_error Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - aio/aio_fsync
summary: Compatibility test - LTP POSIX - aio/aio_fsync
test: ./test.sh
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/aio/test_ltp_posix_aio_aio_fsync
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: aio / aio_fsync"
rlRun "run_posix_iface_test 'aio_fsync'" 0 "aio/aio_fsync 接口一致性测试"
rlPhaseStartTest "POSIX Interface: aio / aio_fsync"
rlRun "run_posix_iface_test 'aio_fsync'" 0 "aio/aio_fsync Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - aio/aio_read
summary: Compatibility test - LTP POSIX - aio/aio_read
test: ./test.sh
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/aio/test_ltp_posix_aio_aio_read
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: aio / aio_read"
rlRun "run_posix_iface_test 'aio_read'" 0 "aio/aio_read 接口一致性测试"
rlPhaseStartTest "POSIX Interface: aio / aio_read"
rlRun "run_posix_iface_test 'aio_read'" 0 "aio/aio_read Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - aio/aio_return
summary: Compatibility test - LTP POSIX - aio/aio_return
test: ./test.sh
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/aio/test_ltp_posix_aio_aio_return
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: aio / aio_return"
rlRun "run_posix_iface_test 'aio_return'" 0 "aio/aio_return 接口一致性测试"
rlPhaseStartTest "POSIX Interface: aio / aio_return"
rlRun "run_posix_iface_test 'aio_return'" 0 "aio/aio_return Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - aio/aio_suspend
summary: Compatibility test - LTP POSIX - aio/aio_suspend
test: ./test.sh
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/aio/test_ltp_posix_aio_aio_suspend
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: aio / aio_suspend"
rlRun "run_posix_iface_test 'aio_suspend'" 0 "aio/aio_suspend 接口一致性测试"
rlPhaseStartTest "POSIX Interface: aio / aio_suspend"
rlRun "run_posix_iface_test 'aio_suspend'" 0 "aio/aio_suspend Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - aio/aio_write
summary: Compatibility test - LTP POSIX - aio/aio_write
test: ./test.sh
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/aio/test_ltp_posix_aio_aio_write
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: aio / aio_write"
rlRun "run_posix_iface_test 'aio_write'" 0 "aio/aio_write 接口一致性测试"
rlPhaseStartTest "POSIX Interface: aio / aio_write"
rlRun "run_posix_iface_test 'aio_write'" 0 "aio/aio_write Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - aio/lio_listio
summary: Compatibility test - LTP POSIX - aio/lio_listio
test: ./test.sh
tag:
- compatibility
- posix
- aio
- compatibility
- posix
- aio
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/aio/test_ltp_posix_aio_lio_listio
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: aio / lio_listio"
rlRun "run_posix_iface_test 'lio_listio'" 0 "aio/lio_listio 接口一致性测试"
rlPhaseStartTest "POSIX Interface: aio / lio_listio"
rlRun "run_posix_iface_test 'lio_listio'" 0 "aio/lio_listio Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,12 +1,12 @@
summary: 兼容性测试 - LTP POSIX - clocks
summary: Compatibility test - LTP POSIX - clocks
tag:
- compatibility
- posix
- clocks
- compatibility
- posix
- clocks
duration: 15m
tier: 2
path: /tests/compatibility/ltp_posix/clocks
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - clocks/clock
summary: Compatibility test - LTP POSIX - clocks/clock
test: ./test.sh
tag:
- compatibility
- posix
- clocks
- compatibility
- posix
- clocks
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/clocks/test_ltp_posix_clocks_clock
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: clocks / clock"
rlRun "run_posix_iface_test 'clock'" 0 "clocks/clock 接口一致性测试"
rlPhaseStartTest "POSIX Interface: clocks / clock"
rlRun "run_posix_iface_test 'clock'" 0 "clocks/clock Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - clocks/clock_getcpuclockid
summary: Compatibility test - LTP POSIX - clocks/clock_getcpuclockid
test: ./test.sh
tag:
- compatibility
- posix
- clocks
- compatibility
- posix
- clocks
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/clocks/test_ltp_posix_clocks_clock_getcpuclockid
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: clocks / clock_getcpuclockid"
rlRun "run_posix_iface_test 'clock_getcpuclockid'" 0 "clocks/clock_getcpuclockid 接口一致性测试"
rlPhaseStartTest "POSIX Interface: clocks / clock_getcpuclockid"
rlRun "run_posix_iface_test 'clock_getcpuclockid'" 0 "clocks/clock_getcpuclockid Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - clocks/clock_getres
summary: Compatibility test - LTP POSIX - clocks/clock_getres
test: ./test.sh
tag:
- compatibility
- posix
- clocks
- compatibility
- posix
- clocks
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/clocks/test_ltp_posix_clocks_clock_getres
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: clocks / clock_getres"
rlRun "run_posix_iface_test 'clock_getres'" 0 "clocks/clock_getres 接口一致性测试"
rlPhaseStartTest "POSIX Interface: clocks / clock_getres"
rlRun "run_posix_iface_test 'clock_getres'" 0 "clocks/clock_getres Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - clocks/clock_gettime
summary: Compatibility test - LTP POSIX - clocks/clock_gettime
test: ./test.sh
tag:
- compatibility
- posix
- clocks
- compatibility
- posix
- clocks
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/clocks/test_ltp_posix_clocks_clock_gettime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: clocks / clock_gettime"
rlRun "run_posix_iface_test 'clock_gettime'" 0 "clocks/clock_gettime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: clocks / clock_gettime"
rlRun "run_posix_iface_test 'clock_gettime'" 0 "clocks/clock_gettime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - clocks/clock_nanosleep
summary: Compatibility test - LTP POSIX - clocks/clock_nanosleep
test: ./test.sh
tag:
- compatibility
- posix
- clocks
- compatibility
- posix
- clocks
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/clocks/test_ltp_posix_clocks_clock_nanosleep
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: clocks / clock_nanosleep"
rlRun "run_posix_iface_test 'clock_nanosleep'" 0 "clocks/clock_nanosleep 接口一致性测试"
rlPhaseStartTest "POSIX Interface: clocks / clock_nanosleep"
rlRun "run_posix_iface_test 'clock_nanosleep'" 0 "clocks/clock_nanosleep Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - clocks/clock_settime
summary: Compatibility test - LTP POSIX - clocks/clock_settime
test: ./test.sh
tag:
- compatibility
- posix
- clocks
- compatibility
- posix
- clocks
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/clocks/test_ltp_posix_clocks_clock_settime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: clocks / clock_settime"
rlRun "run_posix_iface_test 'clock_settime'" 0 "clocks/clock_settime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: clocks / clock_settime"
rlRun "run_posix_iface_test 'clock_settime'" 0 "clocks/clock_settime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - clocks/nanosleep
summary: Compatibility test - LTP POSIX - clocks/nanosleep
test: ./test.sh
tag:
- compatibility
- posix
- clocks
- compatibility
- posix
- clocks
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/clocks/test_ltp_posix_clocks_nanosleep
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: clocks / nanosleep"
rlRun "run_posix_iface_test 'nanosleep'" 0 "clocks/nanosleep 接口一致性测试"
rlPhaseStartTest "POSIX Interface: clocks / nanosleep"
rlRun "run_posix_iface_test 'nanosleep'" 0 "clocks/nanosleep Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,12 +1,12 @@
summary: 兼容性测试 - LTP POSIX - filesystem
summary: Compatibility test - LTP POSIX - filesystem
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 15m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/access
summary: Compatibility test - LTP POSIX - filesystem/access
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_access
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / access"
rlRun "run_posix_iface_test 'access'" 0 "filesystem/access 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / access"
rlRun "run_posix_iface_test 'access'" 0 "filesystem/access Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/asctime
summary: Compatibility test - LTP POSIX - filesystem/asctime
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_asctime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / asctime"
rlRun "run_posix_iface_test 'asctime'" 0 "filesystem/asctime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / asctime"
rlRun "run_posix_iface_test 'asctime'" 0 "filesystem/asctime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/ctime
summary: Compatibility test - LTP POSIX - filesystem/ctime
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_ctime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / ctime"
rlRun "run_posix_iface_test 'ctime'" 0 "filesystem/ctime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / ctime"
rlRun "run_posix_iface_test 'ctime'" 0 "filesystem/ctime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/difftime
summary: Compatibility test - LTP POSIX - filesystem/difftime
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_difftime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / difftime"
rlRun "run_posix_iface_test 'difftime'" 0 "filesystem/difftime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / difftime"
rlRun "run_posix_iface_test 'difftime'" 0 "filesystem/difftime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/fork
summary: Compatibility test - LTP POSIX - filesystem/fork
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_fork
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / fork"
rlRun "run_posix_iface_test 'fork'" 0 "filesystem/fork 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / fork"
rlRun "run_posix_iface_test 'fork'" 0 "filesystem/fork Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/fsync
summary: Compatibility test - LTP POSIX - filesystem/fsync
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_fsync
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / fsync"
rlRun "run_posix_iface_test 'fsync'" 0 "filesystem/fsync 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / fsync"
rlRun "run_posix_iface_test 'fsync'" 0 "filesystem/fsync Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/getpid
summary: Compatibility test - LTP POSIX - filesystem/getpid
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_getpid
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / getpid"
rlRun "run_posix_iface_test 'getpid'" 0 "filesystem/getpid 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / getpid"
rlRun "run_posix_iface_test 'getpid'" 0 "filesystem/getpid Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/gmtime
summary: Compatibility test - LTP POSIX - filesystem/gmtime
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_gmtime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / gmtime"
rlRun "run_posix_iface_test 'gmtime'" 0 "filesystem/gmtime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / gmtime"
rlRun "run_posix_iface_test 'gmtime'" 0 "filesystem/gmtime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/localtime
summary: Compatibility test - LTP POSIX - filesystem/localtime
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_localtime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / localtime"
rlRun "run_posix_iface_test 'localtime'" 0 "filesystem/localtime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / localtime"
rlRun "run_posix_iface_test 'localtime'" 0 "filesystem/localtime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/mktime
summary: Compatibility test - LTP POSIX - filesystem/mktime
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_mktime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / mktime"
rlRun "run_posix_iface_test 'mktime'" 0 "filesystem/mktime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / mktime"
rlRun "run_posix_iface_test 'mktime'" 0 "filesystem/mktime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/strchr
summary: Compatibility test - LTP POSIX - filesystem/strchr
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_strchr
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / strchr"
rlRun "run_posix_iface_test 'strchr'" 0 "filesystem/strchr 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / strchr"
rlRun "run_posix_iface_test 'strchr'" 0 "filesystem/strchr Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/strcpy
summary: Compatibility test - LTP POSIX - filesystem/strcpy
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_strcpy
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / strcpy"
rlRun "run_posix_iface_test 'strcpy'" 0 "filesystem/strcpy 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / strcpy"
rlRun "run_posix_iface_test 'strcpy'" 0 "filesystem/strcpy Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/strftime
summary: Compatibility test - LTP POSIX - filesystem/strftime
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_strftime
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / strftime"
rlRun "run_posix_iface_test 'strftime'" 0 "filesystem/strftime 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / strftime"
rlRun "run_posix_iface_test 'strftime'" 0 "filesystem/strftime Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/strlen
summary: Compatibility test - LTP POSIX - filesystem/strlen
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_strlen
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / strlen"
rlRun "run_posix_iface_test 'strlen'" 0 "filesystem/strlen 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / strlen"
rlRun "run_posix_iface_test 'strlen'" 0 "filesystem/strlen Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/strncpy
summary: Compatibility test - LTP POSIX - filesystem/strncpy
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_strncpy
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / strncpy"
rlRun "run_posix_iface_test 'strncpy'" 0 "filesystem/strncpy 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / strncpy"
rlRun "run_posix_iface_test 'strncpy'" 0 "filesystem/strncpy Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - filesystem/time
summary: Compatibility test - LTP POSIX - filesystem/time
test: ./test.sh
tag:
- compatibility
- posix
- filesystem
- compatibility
- posix
- filesystem
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/filesystem/test_ltp_posix_filesystem_time
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: filesystem / time"
rlRun "run_posix_iface_test 'time'" 0 "filesystem/time 接口一致性测试"
rlPhaseStartTest "POSIX Interface: filesystem / time"
rlRun "run_posix_iface_test 'time'" 0 "filesystem/time Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
+218 -88
View File
@@ -1,130 +1,260 @@
# library-prefix = ltp_posix
#
# LTP POSIX 兼容性测试套件 — 共享库
# 合并原 setup.sh + helper.sh,使用 flag-file + 引用计数
# 确保 LTP 只 clone/build 一次,所有测试共享同一构建产物。
# LTP POSIX Compatibility test -- sharedlibrary
# and setup.sh + helper.sh, use flag-file + reference count
# Ensure LTP only clone/build once, All tests share the same build artifact.
#
# Usage in each test file:
# . "$(dirname "$0")/../../lib.sh" # from test_ltp_posix_xxx/ subdirectories
#. "$(dirname "$0")/../../lib.sh" # from test_ltp_posix_xxx/ subdirectories
LTP_FLAG="/tmp/.beakerlib_ltp_posix_suite"
LTP_DIR="/tmp/ltp-posix"
LTP_BUILD_DIR="$LTP_DIR/testcases/open_posix_testsuite"
SUDO_PASSWORD="openruyi"
# ── 引用计数 Setup ──
LTP_DIR="/tmp/ltp-posix"
LTP_BUILD_DIR="$LTP_DIR/testcases/open_posix_testsuite"
SUDO_PASSWORD="${TEST_SERVER_1_PASSWORD:-openruyi}"
# ── reference count Setup ──
ltpPosixSetup() {
if [ ! -f "$LTP_FLAG" ]; then
DEPS="git gcc make"
MISSING_DEPS=""
for dep in $DEPS; do
if ! rpm -q "$dep" 2>/dev/null; then
MISSING_DEPS="$MISSING_DEPS $dep"
fi
done
if [ -n "$MISSING_DEPS" ]; then
echo "$SUDO_PASSWORD" | sudo -S dnf install -y $MISSING_DEPS 2>/dev/null || true
echo "installed_deps=1" > "$LTP_FLAG"
else
echo "installed_deps=0" > "$LTP_FLAG"
fi
if [ ! -d "$LTP_DIR" ]; then
mkdir -p /tmp
cd /tmp
rm -rf ltp-posix
if git clone --depth 1 https://github.com/linux-test-project/ltp.git ltp-posix 2>/dev/null; then
cd "$LTP_DIR"
make autotools 2>/dev/null || true
cd "$LTP_BUILD_DIR"
./configure 2>/dev/null || true
make -j$(nproc) 2>/dev/null || true
make top_builddir="$LTP_DIR" -C conformance all 2>/dev/null || true
echo "installed_ltp=1" >> "$LTP_FLAG"
rlLogInfo "LTP POSIX 编译完成"
else
echo "installed_ltp=0" >> "$LTP_FLAG"
rlLogWarning "LTP clone 失败,测试将被跳过"
fi
else
echo "installed_ltp=0" >> "$LTP_FLAG"
rlLogInfo "LTP 已存在"
fi
echo "ref=1" >> "$LTP_FLAG"
else
local ref
ref=$(grep "^ref=" "$LTP_FLAG" | cut -d= -f2)
ref=$((ref + 1))
sed -i "s/^ref=.*/ref=$ref/" "$LTP_FLAG"
rlLogInfo "LTP POSIX 已由其他测试初始化,引用计数: $ref"
if [ ! -f "$LTP_FLAG" ]; then
DEPS="git gcc make"
MISSING_DEPS=""
for dep in $DEPS; do
if ! rpm -q "$dep" 2>/dev/null; then
MISSING_DEPS="$MISSING_DEPS $dep"
fi
done
if [ -n "$MISSING_DEPS" ]; then
echo "$SUDO_PASSWORD" | sudo -S dnf install -y $MISSING_DEPS 2>/dev/null || true
echo "installed_deps=1" > "$LTP_FLAG"
else
echo "installed_deps=0" > "$LTP_FLAG"
fi
if [ ! -d "$LTP_DIR" ]; then
mkdir -p /tmp
cd /tmp
rm -rf ltp-posix
if git clone --depth 1 https://github.com/linux-test-project/ltp.git ltp-posix 2>/dev/null; then
cd "$LTP_DIR"
make autotools 2>/dev/null || true
cd "$LTP_BUILD_DIR"
./configure 2>/dev/null || true
make -j$(nproc) 2>/dev/null || true
make top_builddir="$LTP_DIR" -C conformance all 2>/dev/null || true
echo "installed_ltp=1" >> "$LTP_FLAG"
rlLogInfo "LTP POSIX Compilation complete"
else
echo "installed_ltp=0" >> "$LTP_FLAG"
rlLogWarning "LTP clone failed, test will be skipped"
fi
else
echo "installed_ltp=0" >> "$LTP_FLAG"
rlLogInfo "LTP already exists"
fi
echo "ref=1" >> "$LTP_FLAG"
else
local ref
ref=$(grep "^ref=" "$LTP_FLAG" | cut -d= -f2)
ref=$((ref + 1))
sed -i "s/^ref=.*/ref=$ref/" "$LTP_FLAG"
rlLogInfo "LTP POSIX already initialized by other tests, reference count: $ref"
fi
rlCleanupAppend "ltpPosixCleanup"
}
ltpPosixCleanup() {
if [ ! -f "$LTP_FLAG" ]; then
return 0
return 0
fi
local ref
ref=$(grep "^ref=" "$LTP_FLAG" | cut -d= -f2)
ref=$((ref - 1))
if [ "$ref" -le 0 ]; then
rm -rf "$LTP_DIR" 2>/dev/null || true
if grep -q "^installed_deps=1" "$LTP_FLAG" 2>/dev/null; then
echo "$SUDO_PASSWORD" | sudo -S dnf remove -y git gcc make 2>/dev/null || true
fi
rm -f "$LTP_FLAG"
rlLogInfo "LTP POSIX 清理完成"
else
sed -i "s/^ref=.*/ref=$ref/" "$LTP_FLAG"
rlLogInfo "LTP POSIX 保留(还有 $ref 个测试未完成)"
rm -rf "$LTP_DIR" 2>/dev/null || true
if grep -q "^installed_deps=1" "$LTP_FLAG" 2>/dev/null; then
echo "$SUDO_PASSWORD" | sudo -S dnf remove -y git gcc make 2>/dev/null || true
fi
rm -f "$LTP_FLAG"
rlLogInfo "LTP POSIX Cleanup complete"
else
sed -i "s/^ref=.*/ref=$ref/" "$LTP_FLAG"
rlLogInfo "LTP POSIX Retain (still have $ref test(s) not completed)"
fi
}
# ── 原 helper.sh 函数 ──
# 在指定接口目录中编译并运行所有测试
# ── helper.sh function ──
# Compile and run all tests in specified interface directory
run_posix_iface_test() {
local iface="$1"
local dir="$IFACE_DIR/$iface"
local inc_dir="$LTP_BUILD_DIR/include"
local lib_common="$LTP_BUILD_DIR/lib/common.c"
if [ ! -d "$dir" ]; then
rlLogWarning "SKIP: 接口目录不存在 $iface"
return 0
rlLogWarning "SKIP: Interface directory does not exist $iface"
return 0
fi
cd "$dir"
# 1. 运行 .sh 脚本测试
for test_sh in $(find . -maxdepth 1 -type f -name "*.sh" ! -name "Makefile" 2>/dev/null | sort); do
local test_name="${iface}/$(basename "$test_sh")"
if rlRun "echo $SUDO_PASSWORD | sudo -S sh $test_sh" 0 "POSIX $test_name"; then
rlLogInfo "PASS: $test_name"
else
rlLogError "FAIL: $test_name"
fi
# 1. run.sh script test
for test_sh in $(find. -maxdepth 1 -type f -name "*.sh" ! -name "Makefile" 2>/dev/null | sort); do
local test_name="${iface}/$(basename "$test_sh")"
if rlRun "echo $SUDO_PASSWORD | sudo -S sh $test_sh" 0 "POSIX $test_name"; then
rlLogInfo "PASS: $test_name"
else
rlLogError "FAIL: $test_name"
fi
done
# 2. 编译 .c 文件并运行(每接口最多 3 个样本)
# 2. compile.c file and run (Max per interface 3 samples)
local c_count=0
for src in $(find . -maxdepth 1 -type f -name "*.c" 2>/dev/null | sort); do
local test_name="${iface}/$(basename "$src" .c)"
local bin="/tmp/posix_test_$$_${c_count}"
c_count=$((c_count + 1))
if gcc -std=gnu11 -I"$inc_dir" -Wno-error=incompatible-pointer-types -o "$bin" "$lib_common" "$src" -lpthread -lrt -lm 2>/dev/null; then
if rlRun "echo $SUDO_PASSWORD | sudo -S $bin" 0 "POSIX $test_name"; then
rlLogInfo "PASS: $test_name"
else
rlLogError "FAIL: $test_name"
fi
rm -f "$bin"
else
rlLogWarning "SKIP: 编译失败 $test_name"
fi
[ "$c_count" -ge 3 ] && break
for src in $(find. -maxdepth 1 -type f -name "*.c" 2>/dev/null | sort); do
local test_name="${iface}/$(basename "$src".c)"
local bin="/tmp/posix_test_$$_${c_count}"
c_count=$((c_count + 1))
if gcc -std=gnu11 -I"$inc_dir" -Wno-error=incompatible-pointer-types -o "$bin" "$lib_common" "$src" -lpthread -lrt -lm 2>/dev/null; then
if rlRun "echo $SUDO_PASSWORD | sudo -S $bin" 0 "POSIX $test_name"; then
rlLogInfo "PASS: $test_name"
else
rlLogError "FAIL: $test_name"
fi
rm -f "$bin"
else
rlLogWarning "SKIP: Compile failed $test_name"
fi
[ "$c_count" -ge 3 ] && break
done
return 0
}
+7 -7
View File
@@ -1,12 +1,12 @@
summary: 兼容性测试 - LTP POSIX (open_posix_testsuite)
summary: Compatibility test - LTP POSIX (open_posix_testsuite)
tag:
- compatibility
- posix
- ltp
- compatibility
- posix
- ltp
duration: 120m
tier: 2
path: /tests/compatibility/ltp_posix
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
+7 -7
View File
@@ -1,12 +1,12 @@
summary: 兼容性测试 - LTP POSIX - mmap
summary: Compatibility test - LTP POSIX - mmap
tag:
- compatibility
- posix
- mmap
- compatibility
- posix
- mmap
duration: 15m
tier: 2
path: /tests/compatibility/ltp_posix/mmap
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - mmap/mlock
summary: Compatibility test - LTP POSIX - mmap/mlock
test: ./test.sh
tag:
- compatibility
- posix
- mmap
- compatibility
- posix
- mmap
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/mmap/test_ltp_posix_mmap_mlock
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: mmap / mlock"
rlRun "run_posix_iface_test 'mlock'" 0 "mmap/mlock 接口一致性测试"
rlPhaseStartTest "POSIX Interface: mmap / mlock"
rlRun "run_posix_iface_test 'mlock'" 0 "mmap/mlock Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - mmap/mlockall
summary: Compatibility test - LTP POSIX - mmap/mlockall
test: ./test.sh
tag:
- compatibility
- posix
- mmap
- compatibility
- posix
- mmap
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/mmap/test_ltp_posix_mmap_mlockall
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: mmap / mlockall"
rlRun "run_posix_iface_test 'mlockall'" 0 "mmap/mlockall 接口一致性测试"
rlPhaseStartTest "POSIX Interface: mmap / mlockall"
rlRun "run_posix_iface_test 'mlockall'" 0 "mmap/mlockall Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - mmap/mmap
summary: Compatibility test - LTP POSIX - mmap/mmap
test: ./test.sh
tag:
- compatibility
- posix
- mmap
- compatibility
- posix
- mmap
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/mmap/test_ltp_posix_mmap_mmap
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: mmap / mmap"
rlRun "run_posix_iface_test 'mmap'" 0 "mmap/mmap 接口一致性测试"
rlPhaseStartTest "POSIX Interface: mmap / mmap"
rlRun "run_posix_iface_test 'mmap'" 0 "mmap/mmap Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - mmap/munlock
summary: Compatibility test - LTP POSIX - mmap/munlock
test: ./test.sh
tag:
- compatibility
- posix
- mmap
- compatibility
- posix
- mmap
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/mmap/test_ltp_posix_mmap_munlock
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: mmap / munlock"
rlRun "run_posix_iface_test 'munlock'" 0 "mmap/munlock 接口一致性测试"
rlPhaseStartTest "POSIX Interface: mmap / munlock"
rlRun "run_posix_iface_test 'munlock'" 0 "mmap/munlock Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - mmap/munlockall
summary: Compatibility test - LTP POSIX - mmap/munlockall
test: ./test.sh
tag:
- compatibility
- posix
- mmap
- compatibility
- posix
- mmap
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/mmap/test_ltp_posix_mmap_munlockall
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: mmap / munlockall"
rlRun "run_posix_iface_test 'munlockall'" 0 "mmap/munlockall 接口一致性测试"
rlPhaseStartTest "POSIX Interface: mmap / munlockall"
rlRun "run_posix_iface_test 'munlockall'" 0 "mmap/munlockall Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText
@@ -1,13 +1,13 @@
summary: 兼容性测试 - LTP POSIX - mmap/munmap
summary: Compatibility test - LTP POSIX - mmap/munmap
test: ./test.sh
tag:
- compatibility
- posix
- mmap
- compatibility
- posix
- mmap
duration: 3m
tier: 2
path: /tests/compatibility/ltp_posix/mmap/test_ltp_posix_mmap_munmap
require:
- beakerlib
- gcc
- make
- beakerlib
- gcc
- make
@@ -8,16 +8,16 @@
IFACE_DIR="$LTP_BUILD_DIR/conformance/interfaces"
rlJournalStart
rlPhaseStartSetup "环境准备"
ltpPosixSetup
rlPhaseStartSetup "Environment setup"
ltpPosixSetup
rlPhaseEnd
rlPhaseStartTest "POSIX 接口: mmap / munmap"
rlRun "run_posix_iface_test 'munmap'" 0 "mmap/munmap 接口一致性测试"
rlPhaseStartTest "POSIX Interface: mmap / munmap"
rlRun "run_posix_iface_test 'munmap'" 0 "mmap/munmap Interface conformance test"
rlPhaseEnd
rlPhaseStartCleanup "清理测试环境"
rlRun "cd /" 0 "离开测试目录"
rlPhaseStartCleanup "Clean up test environment"
rlRun "cd /" 0 "Leave test directory"
rlPhaseEnd
rlJournalPrintText

Some files were not shown because too many files have changed in this diff Show More