10323c4c22
Bench verification of the IO board needs an observation window: production build has no consumer of ioboard_di_snap_read(), so the DI values were invisible. Add TEST_SUITE_IOBOARD as a semi-automatic bench sequence and fix two real bugs found while wiring it in. New files: - test/board/ioboard_test.h, test/board/ioboard_test_task.c Test suite: - Owns its own thread (iobTest, 4096 words) instead of running in testTask: testTask is osPriorityBelowNormal, below defaultTask whose 1ms console drain loop can starve a blocking wait in a lower priority context. - Phases: bit-order self-check, DI eight-point bijection, DO point-by-point toggle with operator confirmation, release-all on every exit path. - Only exit is ioboard_release_all(); it is called from the entry guard, every phase failure, the write-failure branch and the thread tail. - Sample window is 20 reads x 2ms = 40ms and does overlap the 50ms production poll. That is stated as harmless in the header: the driver wraps the whole read in taskENTER_CRITICAL (26us, not the whole 40ms), both sides only read, and a torn cross-reader sample is caught by the debounce layer rather than acted upon. default_task.c fix: - DEFAULT_TASK_DI_PUBLISH_EN was defined twice: once at file scope and once inside default_task_func(). #define has no scope, so the second was a redefinition of the first. Collapsed to a single authoritative site. - Add TEST_SUITE_STORAGE to the disable list: the STORAGE suite owns the file system via testTask, and default_task_di_poll() referenced four statics that live inside an !TEST_SUITE_STORAGE block, which broke the STORAGE build with 11 errors. - Shrink the !TEST_SUITE_STORAGE block to cover only default_task_net_cfg_save_notify() and move the three declarations out; move edges/fails into the #else branch so the empty branch references none of the four statics. Registration and gates: - MDK-ARM/STM32F407-Demo.uvprojx and simulator/CMakeLists.txt entries. - scripts/check_test_suite.py: whitelist TEST_SUITE_IOBOARD. - scripts/stack_report.py: let a self-started thread that is not declared in Src/freertos.c osThreadAttr_t still be budget checked. - test/run_all_suites.py: bring the suite into the orchestrator view. Verified: six-build matrix all 0 errors 0 warnings. CH395F/STORAGE/GD5F/RTC and the product build are bit-identical at Code=257936; the IOBOARD build is Code=264640 (+6704), which is the evidence that the suite really enters the image. Host unit tests 100/100, stack report 1760/4096 words (57%).
test/ — 测试代码与主机端脚本
测试分两部分,物理隔离在两个子目录:
board/—— 板端测试套件(.c/.h,编入固件由 testTask 执行)host/—— 主机端脚本(.py,PC 侧驱动板子并判读结果)
目录结构
| 目录 | 内容 | README |
|---|---|---|
board/ |
板端测试套件(编入 Keil 工程,占 RAM) | board/README.md |
host/ |
PC 端测试/判读脚本(Python) | host/README.md |
run_all_suites.py |
多套件回归编排(改宏 → 构建 → 烧录 → 采集,try/finally 保证还原开关);--check-build = 只编译不烧录(纯离机) |
本文 §多套件回归 |
运行方式
# /serial-boot-test 一键闭环(推荐)
& '.venv\Scripts\python.exe' .dsh/skills/serial-boot-test/scripts/run_boot_test.py
# 单独校验日志
& '.venv\Scripts\python.exe' .dsh/skills/serial-boot-test/scripts/verify_log.py <日志文件>
# 多套件回归编排(需真机;自动改开关 + 构建 + 烧录 + 采集,结束后还原)
& '.venv\Scripts\python.exe' test/run_all_suites.py
& '.venv\Scripts\python.exe' test/run_all_suites.py --suites STORAGE,GD5F
& '.venv\Scripts\python.exe' test/run_all_suites.py --dry-run # 只看计划
# 只编译不烧录(不需要 MCU / 串口 / ST-LINK,验证 4 套件可编译性)
& '.venv\Scripts\python.exe' test/run_all_suites.py --check-build
退出码约定:0=PASS / 1=FAIL / 2=采集或烧录错误 / 3=用法或预检错误。
多套件回归(run_all_suites.py)
套件互斥(编译期 #error)意味着跑 4 个套件要手工循环 4 轮。本脚本把它编排成一条
命令,并且无条件还原 test_config.h——跑完忘还原 = 测试固件进库,这是它存在的
核心理由(与提交期门禁 test-suite-switch 互为独立防线)。
⚠️ 每轮要真机烧录 + 采集,4 套件约数分钟起;破坏性套件还会改设备持久状态。 仅回归窗口用,绝不挂 pre-commit。
--check-build 则相反:只改宏 + /keil-build,不烧录不采集,无需任何硬件,用于防止
"测试套件长期编不过而无人知"(2026-08~09 CH395F 套件实例)。改动 test/board/ 下测试
代码后建议先跑它——实测 4 套件均 BUILD_OK: 0 errors, 0 warnings。
⚠️ 注意
- 本目录被 pre-commit 门禁排除(测试代码不受 C 规范约束)
board/套件占用 RAM,启用前先核算预算(见docs/内存管理/)- Keil 工程已同步:
board/下 7 个.c编入MDK-ARM/STM32F4-Demo.uvprojx, IncludePath 含../test/board;移动文件须同步改工程文件 - 套件选择开关:
board/test_config.h的TEST_SUITE_*(互斥,一次只启用一个) - 测试缓冲用分 Phase 复用静态缓冲(避免
L6406E溢出)
相关文档
docs/测试说明/流程与规范/测试开发标准流程.md— 测试验证分层与门禁决策表docs/测试说明/流程与规范/自动化测试流程.md—/serial-boot-test细节与失败模式- 各模块测试指南:
docs/测试说明/板级测试/*_Test_Guide.md docs/测试说明/专项验证/链路延迟测试说明.md