Files
STM32F4-Base/test/board/README.md
T
wandering1 e4981aa2f6 refactor(docs): point entry-file references at their new homes
AGENTS.md stopped being the store of record for build steps, Python env,
hardware pins, doc conventions, log cost and task ownership. Those facts
already live in docs, skills and role files; the entry file now only
points at them. This commit moves every reference that used to name the
entry file to the authoritative landing point, so a reader who follows a
link arrives at the fact instead of at a sentence that no longer exists.

What changed is links and prose, not behaviour. Code, scripts and tests
only have comment and docstring lines touched; the only non-comment edit
in the whole changeset is one note string inside the generated pin table
JSON, and its generator was changed in the same step so the two stay
byte-identical.

New landing points created before the references were retargeted:
- The console single-writer log design doc, section 7.1, is now the single
  authority for log cost: about 90 B flash and 216 B stack per DBG_ line,
  and the rule that deep call chains must predefine DBG_LINE_BUF_MAX.
  It also carries the full list of the twelve translation units that have
  tightened it, plus the grep command that decides the truth if the list
  and the code ever disagree.
- The document writing standard, section 2, now holds the BOM list.
- keil-build skill gains an exit code table: 0 success, 1 build failure,
  2 BuildEnvError, 3 usage, 4 build lock held. This corrects a belief
  that was never actually written down anywhere: exit 2 does not simply
  mean environment error, argparse also exits 2 and the wrapper script
  was remapped so the two no longer collide.

Regenerated and checked byte for byte:
- The end-to-end architecture SVG in docs/images from its generator.
- tools/netlist_semantics/pinout_kb.json from gen_kb.py.
Both are idempotent; running the generators again produces no diff.

Deliberately not touched, because machines read them:
- scripts/check_bom_drift.py joins every line containing BOM and asserts
  four paths are present, so the entry file BOM line must stay one line.
- scripts/gen_task_table.py reads the TASK_TABLE anchors directly.
- scripts/rename_maps and scripts/archive keep their historical wording;
  they describe what happened, not what is true now.

Verified: doc links report the same six pre-existing findings as the base
commit and no new ones, generated-fresh passes, bom drift is clean across
101 files, and AGENTS.md itself is unchanged in this commit.
2026-11-16 19:38:27 +08:00

46 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# test/board/ — 板端测试套件
> ⚠️ **编入固件**的测试代码(由 testTask 执行)。这些 `.c` 已注册到 Keil 工程
> `MDK-ARM/STM32F4-Demo.uvprojx`,占用 MCU 的 RAM/Flash。
## 文件一览
| 文件 | 测试对象 / 作用 |
|---|---|
| `test_config.c/h` | **测试任务配置**:`TEST_SUITE_*` 套件选择开关(互斥)+ `ENABLE_DESTRUCTIVE_TESTS` |
| `test_common.h` | **公共断言内核**:`test_stats_t` + `TEST_CHECK_IMPL`/`TEST_REPORT_IMPL`;各套件用一行宏绑定自身统计变量 |
| `ch395f_test_task.c/h` + `ch395f_test.h` | CH395F 以太网(硬件层 Phase 1~5 / NET 层 Phase 6~11) |
| `gd5f_test_task.c/h` + `gd5f_test.h` | GD5F2GQ5UE SPI NAND 存储 |
| `sd2506_test_task.c/h` + `sd2506_test.h` | SD2506 RTC |
| `storage_test_task.c/h` + `storage_test.h` | 存储性能 |
| `net_test_task.c/h` | 网络层测试 |
| `net_latency_test.c/h` | 链路时延探针(DWT CYCCNT 时基,MCU 专属) |
## ⚠️ 构建约束(详见本节与 `test_config.h`)
- **套件互斥**:`test_config.h` 的 `TEST_SUITE_CH395F/STORAGE/GD5F/RTC` 一次只能启用一个
(违反则 `#error`);**全部注释 = 产品构建**
- ⚠️ **测试固件不得静默提交**:`TEST_SUITE_*` 开关受 pre-commit 钩子 `test-suite-switch`
门禁——默认要求全部注释。跑完套件回归**务必改回产品构建**再提交(2026-10-01 实测已提交
HEAD 里 `TEST_SUITE_CH395F` 就是开启状态,纯靠人记得改;故补此门禁)。确需提交测试构建时用
`ALLOW_TEST_BUILD=1 git commit ...` 或 `python scripts/check_test_suite.py --allow-test-build` 显式放行
- **破坏性用例默认关闭**:`ENABLE_DESTRUCTIVE_TESTS`(默认注释)控制写/擦 NAND、格式化、
坏块注入。关闭时为**只读模式**(横幅 `mode: READ-ONLY`),可随时在在用设备上跑
- ⚠️ 实测一轮破坏性 GD5F 运行即让 dhara **多记一个坏块**(容量下降且需全片擦除恢复)——
只在产线首启或明确需要时打开
- CH395F 套件:硬件层与 NET 层模式互斥
- **总线独占**:CH395F 硬件层模式下 netTask 自挂起,testTask 独占 CH395F
## 添加新测试套件
1. 在 `test_config.h` 加开关(并入互斥 `#error` 检查)
2. 新建 `<模块>_test_task.c/h`
3. **注册进 Keil 工程**(`<FilePath>..\test\board\xxx.c</FilePath>`)
4. 跑回归:`/serial-boot-test`(`.dsh/skills/serial-boot-test/scripts/run_boot_test.py`)
## 相关文档
- 测试指南:`docs/测试说明/板级测试/CH395F_Test_Guide.md`、`GD5F2GQ5UE_Test_Guide.md`、`SD2506_Test_Guide.md`、`FTP_Test_Guide.md`
- 套件配置:本节「构建约束」+ `board-test-suite` skill(套件互斥、破坏性开关代价、跑后恢复产品构建)
- 容量恢复:`docs/测试说明/专项验证/存储维护与容量恢复.md`