feat(ioboard): board test suite for DI/DO, fix default_task conditional compile
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%).
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
* TEST_SUITE_CH395F : CH395F 测试(沿用 ch395f_test.h 阶段宏,HW 1~5 / NET 6~11)
|
||||
* TEST_SUITE_STORAGE : FTL + FatFS 存储测试(从 defaultTask 迁入)
|
||||
* TEST_SUITE_GD5F : GD5F2GQ5UE NAND 驱动测试
|
||||
* TEST_SUITE_RTC : SD2506 RTC 测试
|
||||
* TEST_SUITE_IOBOARD : 开入开出板测试(8 路 DI 位序 + 4 路 DO 点动,半自动)
|
||||
*/
|
||||
|
||||
#ifndef TEST_CONFIG_H
|
||||
@@ -22,7 +24,7 @@ extern "C" {
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* === 选择当前构建的测试套件(三选一,或都注释 = 正常产品构建)===
|
||||
/* === 选择当前构建的测试套件(五选一,或都注释 = 正常产品构建)===
|
||||
* ⚠️ 默认必须是**产品构建**(全部注释)——pre-commit 钩子 `test-suite-switch` 会拦截
|
||||
* 未显式放行的测试构建(`--allow-test-build` / `ALLOW_TEST_BUILD=1`)。
|
||||
* 跑套件回归时取消注释所需套件;跑完务必改回、或直接用 `test/run_all_suites.py`
|
||||
@@ -31,6 +33,7 @@ extern "C" {
|
||||
//#define TEST_SUITE_STORAGE
|
||||
//#define TEST_SUITE_GD5F
|
||||
//#define TEST_SUITE_RTC
|
||||
//#define TEST_SUITE_IOBOARD
|
||||
|
||||
/* === 破坏性测试总开关(默认关闭)===
|
||||
* 破坏性用例会改变设备的**持久状态**,跑一次即有代价(2026-09-21 实测:GD5F 整轮
|
||||
@@ -42,7 +45,7 @@ extern "C" {
|
||||
* 仅在**产品首次上电/产线首启**或明确需要时打开;打开跑完建议做一次恢复。 */
|
||||
//#define ENABLE_DESTRUCTIVE_TESTS
|
||||
|
||||
#if defined(TEST_SUITE_CH395F) + defined(TEST_SUITE_STORAGE) + defined(TEST_SUITE_GD5F) + defined(TEST_SUITE_RTC) > 1
|
||||
#if defined(TEST_SUITE_CH395F) + defined(TEST_SUITE_STORAGE) + defined(TEST_SUITE_GD5F) + defined(TEST_SUITE_RTC) + defined(TEST_SUITE_IOBOARD) > 1
|
||||
#error "测试套件互斥:一次构建只能启用一个 TEST_SUITE_*"
|
||||
#endif
|
||||
|
||||
@@ -54,8 +57,10 @@ extern "C" {
|
||||
* 创建"的旧疑点不成立(实测 RTC 套件正常执行;RTC 已计入下方析取,故 RTC 构建下本
|
||||
* 标记亦置位、testTask 正常保留)。
|
||||
* 4 个套件(含 RTC)在此补齐:若将来再引入"测试构建下 defaultTask 空闲"等分支而复用
|
||||
* 本标记,可避免重演"漏 RTC"的隐患。详见 docs/测试说明/板级测试/实机测试实施指南.md §8.3。 */
|
||||
#if defined(TEST_SUITE_CH395F) || defined(TEST_SUITE_STORAGE) || defined(TEST_SUITE_GD5F) || defined(TEST_SUITE_RTC)
|
||||
* 本标记,可避免重演"漏 RTC"的隐患。IOBOARD 同批补入(本标记的另一消费点 =
|
||||
* `Src/freertos.c` 对 testTask 的回收,漏一个套件就等于该套件的 testTask 被回收、
|
||||
* 套件永不执行,且不报错)。详见 docs/测试说明/板级测试/实机测试实施指南.md §8.3。 */
|
||||
#if defined(TEST_SUITE_CH395F) || defined(TEST_SUITE_STORAGE) || defined(TEST_SUITE_GD5F) || defined(TEST_SUITE_RTC) || defined(TEST_SUITE_IOBOARD)
|
||||
#define TEST_SUITE_SELECTED
|
||||
#endif
|
||||
|
||||
@@ -100,6 +105,13 @@ extern "C" {
|
||||
#define TEST_SUITE_NAME "RTC"
|
||||
#endif
|
||||
|
||||
#ifdef TEST_SUITE_IOBOARD
|
||||
/* 开入开出板套件:行序/点动序列全在 ioboard_test_task.c;
|
||||
* 本块只做"选它 + 给它一个名字"。 */
|
||||
#include "ioboard_test.h"
|
||||
#define TEST_SUITE_NAME "IOBOARD"
|
||||
#endif
|
||||
|
||||
#ifndef TEST_SUITE_NAME
|
||||
#define TEST_SUITE_NAME "NONE"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user