test(S6): 补齐 app 层与 HTTP 第二组集成测试,行覆盖率 72.2%→80.3%(NFR-05 达标)

新增
- tests/integration/test_menu.c:菜单 14 项全分派、命令全集正/负例、参数解析、脚本化 stdin 主循环
- tests/integration/test_http_api.c:其余 11 个接口 + 错误路径(400/404/协议层 400)
- src/app/app_options.c:app_parse_args/app_print_usage 从 main.c 迁入静态库(app.h 声明此前无实现)
- app_clear_stop():复用主循环时清除退出标志
- tools/coverage.sh:A10 覆盖率门限自动判定;acceptance 扩到 A1~A10 共 25 项

修复(本轮集成测试暴露)
- menu_render 漏渲染首项「设备列表」(行号 0 既当标题又当表项 0)
- http_server_stop 只置标志不关套接字,导致同进程无法二次启动(聚合运行 70 项失败)
- POST /api/config 未匹配到字段时假成功(现返回 400)
- CRC/I2C 字节序、采样路数、离线设备负例等此前已在集成阶段修复

实测:CTest 19/19;聚合运行 19 套件 2450 断言 0 失败;ASan 19/19;覆盖率 80.3%
This commit is contained in:
sambu committed 2026-09-14 22:23:17 +08:00
1 parent 870a16f25a
commit 3e10ee8488
22 files changed
+1418 -244

No files matched your search

+11
View File
@@ -84,6 +84,7 @@ set(SHS_APP_SOURCES
src/app/cli.c
src/app/commands.c
src/app/replay.c
src/app/app_options.c
src/app/web_app.c)
add_library(shs_core STATIC ${SHS_CORE_SOURCES})
@@ -118,6 +119,7 @@ if(SHS_BUILD_TESTS)
tests/unit/test_bitops.c
tests/unit/test_branch.c
tests/unit/test_errors.c
tests/unit/test_array.c
tests/unit/test_file.c
tests/unit/test_func.c
tests/unit/test_hal.c
@@ -129,6 +131,10 @@ if(SHS_BUILD_TESTS)
tests/unit/test_string.c
tests/unit/test_struct.c
tests/integration/test_http.c
tests/integration/test_system.c
tests/integration/test_fault.c
tests/integration/test_http_api.c
tests/integration/test_menu.c
)
add_executable(shs_tests ${SHS_TEST_SOURCES})
@@ -143,6 +149,7 @@ if(SHS_BUILD_TESTS)
unit.loop
unit.bitops
unit.errors
unit.array
unit.file
unit.func
unit.struct
@@ -150,6 +157,10 @@ if(SHS_BUILD_TESTS)
unit.hal
unit.json
integration.http
integration.system
integration.fault
integration.http_api
integration.menu
)
foreach(suite IN LISTS SHS_TEST_SUITES)
add_test(NAME ${suite} COMMAND shs_tests --suite ${suite})