Skip to content

Commit 7ce7072

Browse files
author
branch-coverage-leader
committed
docs+thresh(stage8): final review + ratchet G8 thresholds
Ratchets coverage_threshold.sh per-file branch gates to Stage-8 actual: ff_config branch 73 -> 80 (actual 85.4%) ff_dpdk_pcap branch 89 -> 95 (actual 100%) ff_epoll branch 92 -> 95 (actual 100%) ff_ini_parser branch 84 -> 86 (actual 91.2%) Adds 89-stage8-review. Project merged branch 60.5% -> 63.7%. 68% gated structurally by ff_dpdk_if.c (integration, Stage-9). KNI process/alloc: rte_eth_*_burst static inline -> --wrap infeasible, deferred to FU-S9-KNI-PROCESS-INTEG. G8 11/11 PASS, valgrind 12/12.
1 parent dc44b86 commit 7ce7072

3 files changed

Lines changed: 121 additions & 8 deletions

File tree

docs/unit_test_spec/zh_cn/82-stage8-test-cases-and-acceptance.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
## Acceptance(执行后填实测)
1414
| Gate | 目标 | actual | 状态 |
1515
|---|---|---|---|
16-
| G-S8-1 ff_config branch | ≥88% | - | - |
17-
| G-S8-2 ff_dpdk_kni branch | ≥70% | - | - |
18-
| G-S8-3 project merged branch | ≥68% | - | - |
19-
| G-S8-5 valgrind | 0 leak | - | - |
16+
| G-S8-1 ff_config branch | ≥88% | 85.4% | ⚠ MISS(剩余 1br/TC OOM/dataflow)|
17+
| G-S8-2 ff_dpdk_kni branch | ≥70% | 51.6% | ✗ MISS(inline-wrap 不可行→S9)|
18+
| G-S8-3 project merged branch | ≥68% | 63.7% | ✗ MISS(ff_dpdk_if 结构性受限)|
19+
| G-S8-4 pcap/epoll 收尾 | 100% | 100%/100% | ✅ PASS |
20+
| G-S8-5 valgrind | 0 leak | 12/12 0 leak | ✅ PASS |
21+
22+
详见 89-stage8-review.md。
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Stage-8 残余分支攻坚 Review(v1.0-final)
2+
3+
> 执行窗口:2026-06-11
4+
> 起点:Stage-7+ 收尾(merged branch 60.5%,ahead=22)
5+
> 终点:merged branch **63.7%**,ahead=**26**(本期 4 commits)
6+
> 口径:`run_coverage.sh`(unit + G8)/ `run_full_coverage.sh`(merged),区分 taken=0 / taken=- / LCOV_EXCL
7+
8+
---
9+
10+
## §1 战果总览
11+
12+
| 文件 | baseline branch | final branch | Δ | 手段 |
13+
|---|---|---|---|---|
14+
| **ff_config.c** | 78.5% (561/715) | **85.4% (612/717)** | **+6.9pp / +51 br** | P2 argv/fixtures(13TC) + P3 OOM wrap(5TC) + vlan-vip leak fix |
15+
| **ff_dpdk_pcap.c** | 94.4% (17/18) | **100% (14/14)** | +5.6pp | P5 多段 mbuf TC + L118 死腿 LCOV_EXCL |
16+
| **ff_epoll.c** | 97.8% (45/46) | **100% (46/46)** | +2.2pp | P5 L113 idx2 (data=0 no-EOF) TC |
17+
| **ff_ini_parser.c** | 89.7% (61/68) | **91.2% (62/68)** | +1.5pp | BOM L107 third-byte TC |
18+
| ff_host_interface.c | 98.1% (104/106) | 98.1% | 0 | clock assert 见 §3 |
19+
| ff_dpdk_kni.c | 51.6% (48/93) | 51.6% | 0 | process/alloc 见 §3 |
20+
| **Project merged** | **60.5%** | **63.7% (1025/1610)** | **+3.2pp** ||
21+
22+
测试数:unit TC ff_config 32→50 / pcap 8→9 / epoll 20→21 / ini 24→25。valgrind 11/11 + integ 1/1,**0 definite leak**
23+
24+
---
25+
26+
## §2 验收门禁结果
27+
28+
| Gate | 目标 | actual | 状态 |
29+
|---|---|---|---|
30+
| G-S8-1 ff_config branch ≥88% | 88% | 85.4% | ⚠ MISS(差 2.6pp,剩余皆 1br/TC 的 OOM/dataflow 单腿,ROI 极低)|
31+
| G-S8-2 ff_dpdk_kni branch ≥70% | 70% | 51.6% | ✗ MISS(inline-wrap 不可行,见 §3.1)|
32+
| G-S8-3 project merged ≥68% | 68% | 63.7% | ✗ MISS(结构性受限 ff_dpdk_if,见 §3.4)|
33+
| G-S8-4 pcap/epoll 收尾 | 100% | **100%/100%** | ✅ PASS |
34+
| G-S8-5 valgrind 0 leak | 0 | 12/12 0 leak | ✅ PASS |
35+
| G-S8-6 G8 ratchet up | PASS | 11/11 PASS | ✅ PASS |
36+
| G-S8-7 lib safe-patch ≤30 行 | ≤30 | vlan leak fix 10 行 | ✅ PASS |
37+
| G-S8-8 真死代码标注 || pcap L118 EXCL + ini×6/kni 文档化 | ✅ PASS |
38+
39+
G8 阈值 ratchet:ff_config br 73→80、pcap br 89→95、epoll br 92→95、ini br 84→86。
40+
41+
---
42+
43+
## §3 未达目标的根因(交叉验证,以实际代码为准)
44+
45+
### 3.1 FU-S8-KNI-PROCESS(L142/148/149/161/163/181/183/185)→ 降级 Stage-9
46+
**实测结论**`rte_eth_tx_burst`(rte_ethdev.h:6395)、`rte_eth_rx_burst``rte_ring_dequeue_burst`(rte_ring.h:811) 均为 `static inline``-Wl,--wrap` 仅对链接期未解析符号有效,对已内联进 `ff_dpdk_kni.o` 的函数**无效**(已验证)。
47+
**继任**:FU-S9-KNI-PROCESS-INTEG — 需真 PMD(net_null/net_ring vdev)+ rte_eal_hotplug_add 整合套件。
48+
49+
### 3.2 FU-S8-KNI-ALLOC(L426/435/466/476/480/486)→ 降级 Stage-9
50+
ff_kni_alloc 内部依赖 rte_eal_hotplug_add 真 vdev 注册 + rte_ring_create + rte_eth_macaddr_get。需 root/vhost-net 整合环境。并入 FU-S9-KNI-PROCESS-INTEG。
51+
52+
### 3.3 FU-S8-HIF-CLOCK-WRAP(L176/L209)→ accepted-gap
53+
`clock_gettime` 非 inline(可 wrap),但 `assert(0==rv)` 是 glibc assert;`expect_assert_failure` 需用 cmocka mock_assert override **重编译** ff_host_interface.o(侵入式)。与用户「工作量>价值」判断一致 → 文档化为 accepted-gap(仅内核时钟失败可触发的防御性断言)。
54+
55+
### 3.4 G-S8-3 project ≥68% → 结构性受限
56+
merged 分母含 **ff_dpdk_if.c:552 branches 仅 125 hit(22.6%)**,单文件拖累全局。该文件覆盖率提升属 integration 范畴(Stage-6 Phase-7 已闭环 unit-mock 可达部分),plan §7 明确 out-of-scope。即便 ff_config 提至 92%,项目仍约 66%,无法仅靠 unit 达 68%。**真实可达上限受 ff_dpdk_if 结构性约束**
57+
58+
### 3.5 FU-S8-{INI}-DEAD(L121×3/133/155/158)→ 真死,文档化
59+
`INI_STOP_ON_FIRST_ERROR=1``if(error) break`(L165),首次 error 即退出循环 → `&& !error` / `else if(!error)` 的 false 腿(error!=0)永不可达。6 腿数据流真死,未 EXCL(避免误删同行 legit 腿),文档记录。
60+
61+
---
62+
63+
## §4 Lib 改动(safe-patch)
64+
65+
| 改动 | 文件 | 行数 | 说明 |
66+
|---|---|---|---|
67+
| FU-S8-CFG-VLAN-VIP-LEAK | ff_config.c | +8 | ff_cfg_free_vlan_one 补 free(vip_addr_array),修 24B 真实 leak |
68+
| FU-S8-PCAP-DEAD | ff_dpdk_pcap.c | +5 | L118 死腿 LCOV_EXCL_BR_LINE 注释(无行为变更)|
69+
70+
---
71+
72+
## §5 Commits(本期 4 个,ahead 22→26)
73+
74+
```
75+
dc44b863a test(ff_ini_parser): Stage-8 +1 TC for BOM third-byte mismatch (L107)
76+
ea0bd9ab8 test(ff_config): Stage-8 P3 OOM wrap — 5 calloc-fail TCs
77+
79a932638 test+lib(epoll+pcap): Stage-8 P5 dead-branch audit -> both 100%
78+
597c499f1 test+lib(ff_config): Stage-8 P2 branch boost — 13 TCs + vlan-vip leak fix
79+
```
80+
81+
---
82+
83+
## §6 继任 Follow-ups(Stage-9)
84+
85+
| ID | 内容 | 预期增量 |
86+
|---|---|---|
87+
| **FU-S9-KNI-PROCESS-INTEG** | net_null/net_ring vdev 整合套件覆盖 kni_process_tx/rx + ff_kni_alloc(L142-185 + L426-486,~21 br)| kni → ~80% |
88+
| FU-S9-DPDKIF-INTEG-BOOST | ff_dpdk_if.c integration 扩容(427 missing br,项目级最大杠杆)| project → ≥68% |
89+
| FU-S9-CFG-OOM-MORE | ff_config 剩余 OOM/dataflow 单腿(vip arrays / rss / L132 huge-mask),ROI 低 | ff_config → ~90% |
90+
| FU-S9-HIF-ASSERT-WRAP | --wrap=__assert_fail + longjmp 覆盖 clock assert(仅当值得)| hif → 100% |
91+
92+
---
93+
94+
## §7 Bounce Counter
95+
```
96+
Phase 0 baseline : 0
97+
Phase 1 spec skeleton : 0
98+
Phase 2 cfg-argv : 1 (kni fixtures 缺 broadcast → 补字段重跑)
99+
Phase 3 cfg-oom : 0 (calloc ordinal 一次命中)
100+
Phase 5 dead-audit : 1 (pcap/epoll 首版 TC 未命中目标腿 → 改 data=0/EXCL)
101+
Phase 8 gating : 0
102+
Phase 9 review : 0
103+
total : 2 / 30 budget
104+
```
105+
106+
## §8 工作区合规
107+
- ✅ 0 直接 rm/kill/chmod
108+
- ✅ valgrind 12/12 0 definite leak(含新 --wrap=calloc)
109+
- ✅ G8 ratchet 后全 PASS
110+
- ✅ Commit message 英文

tests/unit/coverage_threshold.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ BEGIN {
6363
# change bumps any actual upward, raise the threshold accordingly.
6464
#
6565
# P0 (spec 06 §6.1; Stage-7 ratcheted up post 70-stage7 plan)
66-
tline["ff_ini_parser.c"] = 92; tbr["ff_ini_parser.c"] = 84 # actual: line=98.7% branch=89.7% (Stage-7)
66+
tline["ff_ini_parser.c"] = 92; tbr["ff_ini_parser.c"] = 86 # actual: line=98.7% branch=91.2% (Stage-8: BOM L107)
6767
tline["ff_log.c"] = 100; tbr["ff_log.c"] = 100 # actual: line=100% branch=100% (capped)
6868
# P1 (spec 06 §6.1; Stage-7 ratcheted)
6969
tline["ff_host_interface.c"]= 95; tbr["ff_host_interface.c"]= 93 # actual: line=100% branch=98.1% (Stage-7)
70-
tline["ff_epoll.c"] = 95; tbr["ff_epoll.c"] = 92 # actual: line=100% branch=97.8% (Stage-7)
71-
tline["ff_config.c"] = 78; tbr["ff_config.c"] = 73 # actual: line=83.5% branch=78.5% (Stage-7 vlan-OOB + free-before-strdup)
70+
tline["ff_epoll.c"] = 95; tbr["ff_epoll.c"] = 95 # actual: line=100% branch=100% (Stage-8: L113 idx2)
71+
tline["ff_config.c"] = 85; tbr["ff_config.c"] = 80 # actual: line=89.9% branch=85.4% (Stage-8 argv/fixtures + OOM wrap)
7272
# P2
7373
tline["ff_thread.c"] = 95; tbr["ff_thread.c"] = 95 # actual: line=100% branch=100%
7474
tline["ff_init.c"] = 95; tbr["ff_init.c"] = 95 # actual: line=100% branch=100%
75-
tline["ff_dpdk_pcap.c"] = 95; tbr["ff_dpdk_pcap.c"] = 89 # actual: line=100% branch=94.4% (Stage-7; L118 br=3 unreachable upper-bound)
75+
tline["ff_dpdk_pcap.c"] = 95; tbr["ff_dpdk_pcap.c"] = 95 # actual: line=100% branch=100% (Stage-8: L118 dead-leg LCOV_EXCL)
7676
# P3 (subset by design — most of these files need a real DPDK ethdev runtime)
7777
# Integration suite at tests/integration/ pushes ff_dpdk_if.c to ~30.5%
7878
# line via real EAL --vdev=net_null0; the unit number below is the

0 commit comments

Comments
 (0)