test(host): P2 覆盖率批次,5 套主机单测与共享假 FatFs
P2 五个文件全部进分母(三名队友并行,写范围互斥、零越界):
net_socket 420 条 / 881-883=99.8%、52-52 函数(S1~S6 分片)
sys_log_mcu 75 条 / 310-313=99.0%、12-12
console_log 104 条 / 188-189=99.5%、15-15
cfg_file_store_mcu 34 条 / 97-97=100%、10-10
soe_store 26 条 / 78-79=98.7%、4-4
合计 659 条断言,P2 本体 1554-1561=99.6%、93-93 函数。
账:套件 28→33 全绿;files_tested 32→37;未触及 112→107(.c 34→29,
恒等式 29 = 0(P1剩) + 0(P2) + 29(P3) 咬合,§9 终点判据达成);分母
4684→6245 插桩行;line 85.8%→89.3%;func 90.1%→92.2%(这批 5 个文件
全都以 ≥98.7% 进分母,故未摊薄)。--update-baseline 前后逐文件比对:
下降 0 个文件。
基建:新建 test/host/common/fatfs_fake.{h,c}(以真实 ff.h 为声明源、只
定义三文件实际调用的 9 个 f_*,缺哪个链接期响;卷忙/短写/FR_DENIED
可注入;短名违规分档);扩展 ch395f_fake 为纯新增(g_fx/g_fxchip 另开
一份世界 + ext_reset 挂进既有复位,既有三套面一字不动),并按真头修正
两个错值常量(SOCKET_OPEN 0x01→0x05、TCP_ESTABLISHED 0x05→0x04),
另在 net_socket runner 加真头/假件同名常量文本核对闸(负例验证过)。
存量回归:net_listener 34、net_events 34、net_pending 43、net_select 22、
nand_port 149、lftpd_io 33、vol_lock 33、soe 32、cfg_file 151 全绿。
编号:补 TC-HOST-{NETSOCK,SYSLOG,CFGFST,SOESTORE,CONLOG} 五族(22→27,
先补族再引号);net_socket 模块码由自取的两字母 NS 正名为 NETSOCK;
id-check 增量拦截无台账外新账,可判定比例 83.27%(基线 82.6%)。
文档:覆盖率口径 §9 新增「P2 落地」(含两套分母口径差、10 条现状表、
12 条可复用手法与并发红线),§8 第 1 条改「清单已吃穿」,补变更记录。
本提交未改任何生产代码(App/Drivers/Src/Lib/MDK-ARM 零触碰)。
10 条现状已逐条登记在 §9(含 sys_log_mcu.c:509~537 卷忙整批丢日志、
net_socket.c 同文件两套 IP 字节序、UDP 两 API 绕过 netTask),已获指示
全部修复,另开一轮(含测试字面量统一纯 ASCII)。
gate: pre-commit run --all-files → 39 hooks, 38 Passed; only mem-numbers
Failed(本工作树从未 @build,无 .map 事实源,属分支期已知陷阱);
mem-budget Passed;test-coverage 与 id-check Passed。RAM/Flash 增量 = 0
(纯测试批次)。按仓内分支约定走 --no-verify,台账回填留待主树合并后。
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 模块名称:NET 层兄弟模块桩的观测面(net_socket 主机侧单测专用)
|
||||
* 模块功能:声明 ns_peers.c 的记录结构与复位入口。原型层面的约束(必须与真实头逐字
|
||||
* 一致)在 ns_peers.c 里由"include 真实头 + 直接实现同名函数"保证:
|
||||
* 签名漂移 = 本套编译期红。
|
||||
* ⚠ 仅供 test/host/net_socket/ 使用,不参与 MCU 构建。
|
||||
* 创建日期:2026-10-24
|
||||
*/
|
||||
#ifndef NS_PEERS_H
|
||||
#define NS_PEERS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "net_types.h"
|
||||
|
||||
typedef struct {
|
||||
/* —— net_listener —— */
|
||||
int listener_req_calls;
|
||||
int last_req_fd;
|
||||
int last_req_reason;
|
||||
int listener_clear_calls;
|
||||
int last_clear_fd;
|
||||
int listener_tick_calls;
|
||||
int listener_settle_calls;
|
||||
int last_settle_fd;
|
||||
int last_settle_level;
|
||||
int req_armed[NET_MAX_SOCKETS]; /* 登记未清=1(clear/tick 后归 0) */
|
||||
int req_reason[NET_MAX_SOCKETS];
|
||||
|
||||
/* —— net_pending(recv) —— */
|
||||
int pending_capture_calls;
|
||||
int pending_reg_calls;
|
||||
int pend_register_rc; /* 注入登记结果(默认 NET_PENDING_REGISTERED) */
|
||||
int last_pend_fd;
|
||||
uint32_t last_pend_to;
|
||||
TaskHandle_t last_pend_caller;
|
||||
int pending_tick_calls;
|
||||
int pending_clear_calls;
|
||||
int last_pend_clear_fd;
|
||||
int pending_cancel_calls;
|
||||
int pending_cancel_all_calls;
|
||||
int last_pend_cancel_err;
|
||||
int pending_settle_calls;
|
||||
int pending_notified; /* 经由桩真实发出通知的次数(必通知契约) */
|
||||
int pend_active_now[NET_MAX_SOCKETS];
|
||||
|
||||
/* —— net_pending(send) —— */
|
||||
int send_reg_calls;
|
||||
int send_register_rc;
|
||||
int last_snd_fd;
|
||||
int last_snd_sent;
|
||||
int last_snd_len;
|
||||
int send_tick_calls;
|
||||
int send_clear_calls;
|
||||
int send_cancel_calls;
|
||||
int send_cancel_all_calls;
|
||||
int last_snd_cancel_err;
|
||||
int send_notified;
|
||||
|
||||
/* —— net_events —— */
|
||||
int evt_connect_calls;
|
||||
int evt_disconnect_calls;
|
||||
int evt_recv_calls;
|
||||
int evt_send_calls;
|
||||
int evt_timeout_calls;
|
||||
int reconcile_calls;
|
||||
int lost_probe_calls;
|
||||
int lost_probe_hit; /* 1=让探针命中(补 accept) */
|
||||
int last_probe_state;
|
||||
} ns_peers_obs_t;
|
||||
|
||||
extern ns_peers_obs_t g_peers;
|
||||
|
||||
void ns_peers_reset(void);
|
||||
void ns_peers_arm_pending_done(int sockfd, int result);
|
||||
void ns_peers_arm_send_pending_done(int sockfd, int result);
|
||||
|
||||
/* 由 ns_peers.c 调用,把"桩内部完成的通知"接到假内核的通知面上 */
|
||||
void ns_peers_note_notify(TaskHandle_t to, uint32_t v);
|
||||
|
||||
#endif /* NS_PEERS_H */
|
||||
Reference in New Issue
Block a user