3e80c301e5
The suite ran on the bench and reset the target every 56 seconds, right after the last Phase 3 assertion. Root cause was the suite itself: the worker thread entry function returned instead of calling vTaskDelete. Returning from a FreeRTOS task function is undefined behaviour, and on the Cortex-M4F port the saved LR points at prvTaskExitError, so the return trips configASSERT. This project routes configASSERT to vApplicationAssertFailed, which resets the MCU. The assert banner never reached the console because the reset happened 0.27 s after the last line, while its bytes were still queued. Two assertions were also wrong in ways that hid real state: - The "which relay is commanded" mask was computed as MASK_ALL & ~bit, i.e. the complement of what the comment claimed, so the suite reported the three idle relays as commanded and failed every Phase 3 row even though the shadow register was correct. - The "other relays stay released" check was written as (a|b)==b, which is the same predicate as "at least bit b set" and therefore duplicated the check above it instead of testing the remaining channels. It now asserts (active & ~only)==0. Phase counters are also reset on entry to each phase. The report macro only prints, so without a reset each phase summary carried every earlier phase's failures and Phase 2 read 44/62 with no failures of its own. Hard-coded 0x0F masks are replaced by IOBOARD_TEST_DO_MASK_ALL. Bench result after the fix: the suite completes in about 54 s with one reset cause line (boot only), and prints Phase 4, the final release check and "IOBOARD Tests: 17/17 PASSED". Phase 2 moves to 21/21 and Phase 3 to 16/16. Still unverified, and not claimed as passing: the eight DI channel order needs a person to short the terminals, and the relay polarity needs a person to hear the contacts. Note that ioboard_do_read_level reads ODR, so the Phase 3 level assertions prove write intent propagation, not electrical actuation. Keil build with the suite enabled: Code=264880, 0 errors 0 warnings. Product build after the suite switch is restored: Code=257932, unchanged.
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 |
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
添加新测试套件
- 在
test_config.h加开关(并入互斥#error检查) - 新建
<模块>_test_task.c/h - 注册进 Keil 工程(
<FilePath>..\test\board\xxx.c</FilePath>) - 跑回归:
/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-suiteskill(套件互斥、破坏性开关代价、跑后恢复产品构建) - 容量恢复:
docs/测试说明/专项验证/存储维护与容量恢复.md