Skip to content

Commit b118ec4

Browse files
author
unit-test-impl-leader
committed
docs(spec): English version of Stage-6 Phase-7 integration review (FU-U-7)
Translates the zh_cn Phase-7 review (FU-CB-DPDKIF-INTEGRATION) and places it at docs/unit_test_spec/ root, completing the English spec set: 00-overview-and-glossary.md 01-requirements-spec.md 02-current-architecture-and-targets.md 04-cmocka-framework-and-impl.md 06-test-cases-and-acceptance.md 99-review-report.md 99-stage6-coverage-boost-review.md 99-stage6-phase7-integration-review.md (NEW) Tables, IDs (G-CB-* / FU-CB-*), file paths, command snippets, and section numbering are preserved verbatim.
1 parent c10dd27 commit b118ec4

1 file changed

Lines changed: 158 additions & 0 deletions

File tree

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Stage-6 Phase-7 Review — FU-CB-DPDKIF-INTEGRATION
2+
3+
**Date**: 2026-06-10
4+
**Local commit**: (see git log)
5+
**Scope**: Stage-6 deferred gates G-CB-3 / G-CB-4
6+
7+
---
8+
9+
## 1. Background
10+
11+
After Stage-6 Phase 5 lifted `ff_dpdk_if.c` from 3.2% to 5.1% line coverage, the remaining ~970 lines (the `ff_dpdk_init` / `ff_dpdk_run` / `ff_dpdk_if_send` body) were unreachable inside the unit-test boundary because they require a real DPDK ethdev plus a live main-loop runtime. At the close of Phase 5 the gates G-CB-3 (`ff_dpdk_if` line ≥25%) and G-CB-4 (project line ≥50%) were marked deferred and filed as follow-up `FU-CB-DPDKIF-INTEGRATION`.
12+
13+
This phase (Phase 7) implements that follow-up: a standalone integration-test binary under `tests/integration/` that boots a real EAL with `--vdev=net_null0` and lets `ff_dpdk_init()` run end-to-end, exercising the six core init subsystems — `init_lcore_conf` / `init_mem_pool` / `init_dispatch_ring` / `init_msg_ring` / `init_port_start` / `init_clock`.
14+
15+
---
16+
17+
## 2. Deliverables
18+
19+
| File | Type | Purpose |
20+
|---|---|---|
21+
| `tests/integration/Makefile` | NEW | Standalone build system (mirrors unit/Makefile) |
22+
| `tests/integration/test_ff_dpdk_if_integration.c` | NEW | 7 TCs, cmocka style |
23+
| `tests/integration/common/rte_stub.{c,h}` | COPY | Reuses unit's rte_exit / rte_panic wraps |
24+
| `tests/integration/valgrind.supp` | NEW | EAL init-time still-reachable suppression (does NOT mask definite leaks) |
25+
| `tests/run_full_coverage.sh` | NEW | One-shot script that merges unit + integration coverage |
26+
27+
---
28+
29+
## 3. Test Matrix (7 TCs)
30+
31+
| TC ID | Name | Verifies |
32+
|---|---|---|
33+
| INT-DPDKIF-01 | init_succeeded_with_one_port | `nb_dev_ports==1`; `rte_eth_link_get_nowait` returns sane |
34+
| INT-DPDKIF-02 | eth_dev_socket_id_post_init | `rte_eth_dev_socket_id` does not crash |
35+
| INT-DPDKIF-03 | ff_dpdk_register_deregister_roundtrip | register returns non-NULL ctx; deregister leak-free |
36+
| INT-DPDKIF-04 | ff_get_tsc_ns_monotonic | Monotonically non-decreasing |
37+
| INT-DPDKIF-05 | ff_get_traffic_post_init | Smoke: function executes without crash |
38+
| INT-DPDKIF-06 | ff_dpdk_if_send_zero_total | `total=0` path |
39+
| INT-DPDKIF-07 | eal_process_type_primary | `rte_eal_process_type()==PRIMARY` |
40+
41+
**Result**: 7/7 PASS / 0 SKIP / 0 FAIL / runtime 0.4 s + valgrind 2.3 s
42+
43+
---
44+
45+
## 4. Coverage Outcome (merged unit + integration)
46+
47+
### Per-file (merged)
48+
49+
| File | unit-only line | merged line | Δ |
50+
|---|---|---|---|
51+
| ff_dpdk_if.c | 5.1% | **30.5%** | **+25.4pp** |
52+
| ff_log.c | 100.0% | 100.0% | 0 |
53+
| ff_ini_parser.c | 97.3% | 97.3% | 0 |
54+
| ff_host_interface.c | 100.0% | 100.0% | 0 |
55+
| ff_epoll.c | 100.0% | 100.0% | 0 |
56+
| ff_config.c | 76.3% | 76.3% | 0 |
57+
| ff_thread.c | 100.0% | 100.0% | 0 |
58+
| ff_init.c | 100.0% | 100.0% | 0 |
59+
| ff_dpdk_pcap.c | 100.0% | 100.0% | 0 |
60+
| ff_dpdk_kni.c | 47.2% | 47.2% | 0 |
61+
62+
### Project-level (merged)
63+
64+
| Metric | Stage-6 Phase 6 final | Stage-6 Phase 7 final | Δ |
65+
|---|---|---|---|
66+
| **line cov** | 47.1% | **58.3%** | **+11.2pp** |
67+
| **branch cov** | 47.2% | **54.5%** | **+7.3pp** |
68+
| **func cov** | 63.9% | **72.9%** | **+9.0pp** |
69+
| TC count | 130 | **137** | +7 |
70+
71+
---
72+
73+
## 5. Stage-6 G-CB Gates — All Closed
74+
75+
| Gate | Target | Phase 6 status | Phase 7 measured | Status |
76+
|---|---|---|---|---|
77+
| G-CB-0 | gap-analysis complete | ✅ PASS |||
78+
| G-CB-1 | 8 files line ≥85% / branch ≥70% | ✅ PASS |||
79+
| G-CB-2 | ff_dpdk_kni line ≥40% | ✅ PASS (47.2%) |||
80+
| **G-CB-3** | **ff_dpdk_if line ≥25%** | ⚠ deferred (5.1%) | **30.5%** |**PASS** |
81+
| **G-CB-4** | **project line ≥50%** | ⚠ deferred (47.1%) | **58.3%** |**PASS** |
82+
| G-CB-5 | lib safe-patches ≤5 sites | 0 used | 0 used ||
83+
| G-CB-6 | reviewer 4-dim score ≥A | ✅ PASS |||
84+
85+
---
86+
87+
## 6. Key Design Decisions
88+
89+
### 6.1 cmocka group_setup boots EAL once
90+
- Same EAL bring-up flags as `test_ff_dpdk_kni` (`--no-huge --no-pci --no-shconf --vdev=net_null0 -l 0 -m 64`)
91+
- If group_setup fails, all 7 TCs `skip()` rather than failing the build
92+
- `rte_eal_cleanup` is intentionally NOT called: cmocka TCs may still hold lcore TLS references; the OS reclaims on process exit
93+
94+
### 6.2 Build ff_global_cfg programmatically (no ff_load_config)
95+
- Direct `memset(&ff_global_cfg, 0, ...)` plus targeted field assignment
96+
- Required fields: `dpdk.{nb_procs, proc_id, proc_lcore, nb_ports, max_portid, portid_list, port_cfgs[i].{port_id, nb_lcores, lcore_list[0]}}` plus `freebsd.hz` (otherwise `init_clock` divides by zero)
97+
- More compact than INI fixtures and decouples cfg state from `ff_dpdk_init`'s parsing path
98+
99+
### 6.3 Bridge-stub strategy
100+
- 25 ff_* / kernel-side bridge functions (`ff_veth_*` / `ff_mbuf_*` / `ff_close` / `ff_rtioctl` etc.) — reuse the stub bodies from `unit/test_ff_dpdk_if`
101+
- Link real `ff_log.o` / `ff_config.o` / `ff_ini_parser.o` / `ff_host_interface.o` (no bridge needed)
102+
103+
### 6.4 NULL ctx TC promoted to follow-up (FU-CB-DPDKIF-NULLGUARD)
104+
- `ff_dpdk_if_send` does not guard NULL ctx; dereferencing `ctx->port_id` segfaults
105+
- Replaced with the legal `total=0` path; the NULL guard is parked under the Stage-6 lib safe-patch capacity for later consumption
106+
107+
---
108+
109+
## 7. New Follow-ups Logged
110+
111+
| ID | Description | Priority | Notes |
112+
|---|---|---|---|
113+
| **FU-CB-DPDKIF-NULLGUARD** | Add NULL ctx guard at the entry of `ff_dpdk_if_send` (safe-patch ≤5 lines) | P3 | Stage-6 lib safe-patch capacity still untriggered |
114+
| FU-CB-INT-MORE-TC | Extend integration suite: rss_tbl_init / promiscuous / link-state combinations | P3 | Headroom beyond current 30.5% |
115+
| FU-CB-FULL-COV-CI | Wire `run_full_coverage.sh` into CI to prevent regression | P2 | Merges with Phase 6 review item D2 |
116+
117+
---
118+
119+
## 8. Engineering Compliance
120+
121+
- ✅ 0 direct rm / kill / chmod (script +x via `chmod_modify.sh`)
122+
- ✅ Temporary `.info` / `coverage_report` cleanup via `rm_tmp_file.sh` wrapper
123+
- ✅ valgrind: 0 definite leaks (only EAL still-reachable suppressed)
124+
- ✅ ahead-of-upstream feature/1.26 counter updated
125+
126+
---
127+
128+
## 9. One-Shot Reproducibility
129+
130+
```bash
131+
cd /data/workspace/f-stack/tests
132+
./run_full_coverage.sh
133+
# Output:
134+
# per-file merged line/branch
135+
# project Summary: line 58.3% / branch 54.5% / func 72.9%
136+
# G-CB-3 ff_dpdk_if line 30.5% [PASS]
137+
# G-CB-4 project line 58.3% [PASS]
138+
# merged HTML at tests/full_coverage_report/index.html
139+
```
140+
141+
```bash
142+
cd /data/workspace/f-stack/tests/integration
143+
make # build only
144+
make test # 7/7 PASS / ~0.4s
145+
make check # valgrind / 0 definite leak / ~2.3s
146+
make coverage # standalone integration coverage
147+
```
148+
149+
---
150+
151+
## 10. 4-Dimension Score
152+
153+
| Dimension | Score | Note |
154+
|---|---|---|
155+
| Coverage gain | **A+** | Project line +11.2pp / ff_dpdk_if +25.4pp — beyond target |
156+
| Boundary completeness | A | 7 TCs cover legal and abnormal paths; NULL guard deferred to follow-up |
157+
| Lib-patch safety | A+ | 0 lib changes (full capacity preserved) |
158+
| Valgrind no-regression | A+ | 0 definite leaks / EAL still-reachable reasonably suppressed |

0 commit comments

Comments
 (0)