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

+2 -2
View File
@@ -66,13 +66,13 @@ const char *http_status_text(int status);
/* ---------------------------------------------------------------- 服务器 */
/** 启动服务:bind_addr 传 NULL 用配置值,port 传 0 由系统分配(便于测试) */
shs_err_t http_server_start(const char *bind_addr, uint16_t port);
/** 实际监听端口(port=0 启动后用于回读随机端口) */
/** 实际监听端口(port=0 启动后用于回读随机端口);未启动或已停止返回 0 */
uint16_t http_server_port(void);
/** 处理一次请求(单步:便于集成测试逐帧驱动) */
shs_err_t http_server_handle_once(const HttpRoute routes[], int route_count);
/** 进入服务主循环(项目四 while) */
shs_err_t http_server_serve_forever(const HttpRoute routes[], int route_count);
/** 请求停止(由信号处理或测试调用) */
/** 请求停止:置停止标志并关闭监听套接字(停止后可在同一进程内重新启动) */
void http_server_stop(void);
/** 是否已停止 */
bool http_server_is_stopped(void);