跳转到内容

测试

套件数量框架覆盖范围
单元测试786GoogleTest解析器、执行器、目录遍历器
属性测试124RapidCheck模糊测试、不变量
兼容性测试52GoogleTestApache 行为匹配
配置转换器测试55GoogleTest配置转换器
总计1,036
Terminal window
# 全部测试
ctest --test-dir build --output-on-failure -j$(nproc)
# 特定套件
ctest --test-dir build -R "unit_tests" --output-on-failure
ctest --test-dir build -R "property_tests" --output-on-failure
ctest --test-dir build -R "compat_tests" --output-on-failure
ctest --test-dir build -R "confconv_tests" --output-on-failure

验证全部 83 种指令类型在解析器、打印器、执行器、目录遍历器、释放和生成器中均有实现:

Terminal window
bash tests/check_consistency.sh
Terminal window
# 使用 libFuzzer 构建解析器模糊测试器
clang -g -O1 -fsanitize=fuzzer,address -I include \
-DHTACCESS_UNIT_TEST \
tests/fuzz/fuzz_parser.cpp \
src/htaccess_parser.c src/htaccess_directive.c src/htaccess_expires.c \
-lstdc++ -lm -o fuzz_parser
# 运行 5 分钟
mkdir -p fuzz_corpus && cp tests/fuzz/corpus/* fuzz_corpus/
timeout 300 ./fuzz_parser fuzz_corpus/ -max_len=4096 -timeout=5
Terminal window
# 基于 Docker 的 OLS 指令测试
docker build -t ols-e2e -f tests/e2e/Dockerfile .
docker run -d --name ols-e2e -p 8088:8088 ols-e2e
bash tests/e2e/test_directives.sh
# 集成测试(WordPress、Laravel、Nextcloud、Drupal)
docker compose -f integration-tests/docker-compose.yml up -d --build
bash integration-tests/apps/wordpress/verify.sh
  • PR 门禁 (ci.yml):构建、单元/属性/兼容性测试、ASan/UBSan、Apache 对比、OLS E2E
  • 手动发布门禁:runtime image 构建、heavy apps-matrix 和 DO VPS 验证只通过显式 workflow 运行
  • 发布 (release.yml):x86_64 平台构建、RPM 打包和发布资产上传