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%).
55 lines
1.8 KiB
C
55 lines
1.8 KiB
C
/******************************************************************************
|
||
* 模块名称:统一测试任务调度器(Test Config)
|
||
* 模块功能:所有测试任务的唯一入口。FreeRTOS 的 testTask 仅调用本文件
|
||
* 的 start_test_task(),由本文件根据 test_config.h 中启用的
|
||
* TEST_SUITE_* 宏,将测试分发到对应套件的运行函数。
|
||
*
|
||
* 各套件运行函数(ch395f_test_run / storage_test_run / gd5f_test_run
|
||
* / sd2506_test_run / ioboard_test_run)各自实现具体测试逻辑,本文件
|
||
* 只负责"选哪个跑",不掺杂任何具体测试细节,使测试入口界限清晰、易于维护。
|
||
* 作者:王建锋
|
||
* 创建日期:2026-08-29
|
||
******************************************************************************/
|
||
|
||
#define DBG_TAG "[TEST_CFG]"
|
||
#include "cmsis_os.h"
|
||
#include "dbg_log.h"
|
||
|
||
#include "test_config.h"
|
||
|
||
#include "ch395f_test_task.h"
|
||
#include "storage_test.h"
|
||
#include "gd5f_test.h"
|
||
#include "sd2506_test.h"
|
||
#include "ioboard_test.h"
|
||
|
||
/*
|
||
* 测试任务统一入口(FreeRTOS start_test_task 线程函数)。
|
||
* 根据编译期选中的 TEST_SUITE_* 调度对应套件,其余时间挂起。
|
||
*/
|
||
void start_test_task(void *argument)
|
||
{
|
||
(void)argument;
|
||
|
||
DBG_INFO("Test task started, suite=%s", TEST_SUITE_NAME);
|
||
|
||
#if defined(TEST_SUITE_CH395F)
|
||
ch395f_test_run();
|
||
#elif defined(TEST_SUITE_STORAGE)
|
||
storage_test_run();
|
||
#elif defined(TEST_SUITE_GD5F)
|
||
gd5f_test_run();
|
||
#elif defined(TEST_SUITE_RTC)
|
||
sd2506_test_run();
|
||
#elif defined(TEST_SUITE_IOBOARD)
|
||
/* ioboard_test_run() 自起 Normal 优先级线程后立即返回(理由见 ioboard_test_task.c) */
|
||
ioboard_test_run();
|
||
#else
|
||
DBG_INFO("No test suite selected (normal product build)");
|
||
#endif
|
||
|
||
for (;;) {
|
||
osDelay(1000);
|
||
}
|
||
}
|