docs(测试说明): 按用途分六个子目录并同步全库引用
分层:流程与规范/ 单元测试/ 板级测试/ 专项验证/ 测试工具/ 测试数据/, 顶层只留新增的目录导航 README.md(归层判据 + 硬约束 + 本次处置记录)。 - 搬迁 28 个路径:测试数据三个目录 58 个文件为纯改名(R100,内容逐字节不变) - 全库引用同步 124 个文件:AGENTS / docs 索引 / skills / 门禁注释 / scripts - 门禁面:scripts/check_test_traceability.py 的 glob 改 rglob (分层后不递归扫描=追溯门禁直接瞎掉) - scripts/rename_ref.py:收尾的 ℹ 提示在 GBK 代码页抛 UnicodeEncodeError, 让进程以退出码 1 收场而改写其实已落盘(RC 与真实结果相反);改为把 stdout/stderr reconfigure 成 UTF-8,与 check_doc_links.py 等同法 - docs/文档规范.md §1.1 补「子目录文件过多时再分一层」;§3.6 补 rename_ref 搬整目录的两个实测坑:① 会改写目录内部文件的内容 ② 内部文件的 ../ 出链 不补层级(本次 23 个被误改的证据文件已按 HEAD 原始字节逐字节还原) - docs/README.md §6 改为与六个子目录一一对应,并补登原先漏登记的 「启动日志原子性复验流程」一行 - .cubemx_survival_baseline.json:App/util/task_watchdog.c 的注释路径也随分层更新, 该文件是存活审计的 watchdog-module 漂移锚点,按脚本自己的提示跑 --write 重建基线 (实测重建后仅 watchdog-module 一条哈希变化) - 铁律 4 例外(本次在任务树里改了单写者文件):AGENTS.md 与 .pre-commit-config.yaml 只被 rename_ref 改写路径字面量(后者全在注释行), 任务表块与钩子声明一字未动 验证:check_doc_links.py --sections-strict 覆盖全部 88 个改动 .md 全绿; check_test_traceability.py 输出与主树逐行一致;196 个文本文件无 BOM、无新增 CR、无 U+FFFD、无行尾空白;陈旧引用面由主树 25 处降到 6 处(无新增断链)。
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""check_test_traceability.py - 用例追溯校验(默认仅告警,不阻断提交)。
|
||||
|
||||
背景(docs/测试说明/实机测试实施指南.md §8.2;原复审项 S4,已闭环):
|
||||
背景(docs/测试说明/板级测试/实机测试实施指南.md §8.2;原复审项 S4,已闭环):
|
||||
文档声称 91 个 TC、代码有 222 个 TEST_CHECK(断言点数 > 用例数正常),
|
||||
但**双向是否一一对应无人校验**——某个 TC 可能"文档写了、代码没实现",
|
||||
或"代码实现了、文档没登记"。纯靠人肉比对。
|
||||
@@ -12,7 +12,8 @@
|
||||
|
||||
① 代码侧:`test/board/*.c`(含 `*_test_task.c` 与 `net_latency_test.c`)
|
||||
里出现的 `TC-<PFX>-<NNN>`(注释、DBG_INFO 串皆计入);
|
||||
② 文档侧:`docs/测试说明/*_Test_Guide.md` 里出现的 `TC-<PFX>-<NNN>`。
|
||||
② 文档侧:`docs/测试说明/**/*_Test_Guide.md` 里出现的 `TC-<PFX>-<NNN>`
|
||||
(2026-10-30 测试说明目录分层后改**递归**匹配,板级指南现居 `板级测试/`)。
|
||||
|
||||
[DOC-ONLY] 文档有、代码无 -> 未实现(或代码未标注)
|
||||
[CODE-ONLY] 代码有、文档无 -> 未登记(或文档漏写)
|
||||
@@ -41,7 +42,7 @@
|
||||
& '.venv\\Scripts\\python.exe' scripts/check_test_traceability.py --strict
|
||||
& '.venv\\Scripts\\python.exe' scripts/check_test_traceability.py --verbose
|
||||
|
||||
设计依据:docs/测试说明/实机测试实施指南.md §8.2(S4 用例追溯,原复审项已闭环)
|
||||
设计依据:docs/测试说明/板级测试/实机测试实施指南.md §8.2(S4 用例追溯,原复审项已闭环)
|
||||
创建日期:2026-10-03
|
||||
"""
|
||||
|
||||
@@ -189,11 +190,14 @@ def main():
|
||||
host_dir = REPO_ROOT / "test" / "host"
|
||||
|
||||
code_files = sorted(code_dir.glob("*.c")) if code_dir.is_dir() else []
|
||||
doc_files = sorted(doc_dir.glob("*_Test_Guide.md")) if doc_dir.is_dir() else []
|
||||
# 2026-10-30:docs/测试说明 按用途分了子目录(板级测试/ 单元测试/ …,见
|
||||
# docs/测试说明/README.md),文档侧一律**递归**找,否则分层等于静默放行——
|
||||
# 这里若还是 glob 单层,doc_files 会变成空表并直接 return 2(门禁瞎掉)。
|
||||
doc_files = sorted(doc_dir.rglob("*_Test_Guide.md")) if doc_dir.is_dir() else []
|
||||
if not args.board_only:
|
||||
# 主机侧单测一侧:7 篇「单元测试说明.md」+ test/host 下的测试代码(*.c / *_test.py /
|
||||
# run_unit_test.py)——TC 编号在两侧都是**追溯链的锚点**,缺一侧就是断链。
|
||||
doc_files += sorted(doc_dir.glob("*单元测试说明.md"))
|
||||
doc_files += sorted(doc_dir.rglob("*单元测试说明.md"))
|
||||
if host_dir.is_dir():
|
||||
code_files += sorted(host_dir.rglob("*.c"))
|
||||
code_files += sorted(host_dir.rglob("*.py"))
|
||||
@@ -202,7 +206,7 @@ def main():
|
||||
print(f"[ERR] 未找到代码侧文件:{code_dir}/*.c", file=sys.stderr)
|
||||
return 2
|
||||
if not doc_files:
|
||||
print(f"[ERR] 未找到文档侧文件:{doc_dir}/*_Test_Guide.md", file=sys.stderr)
|
||||
print(f"[ERR] 未找到文档侧文件:{doc_dir}/**/*_Test_Guide.md", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
code_ids, code_counts, code_intents = collect(code_files, "code", want_intent=True)
|
||||
|
||||
Reference in New Issue
Block a user