存储测试通过
This commit is contained in:
57
test/storage_test.h
Normal file
57
test/storage_test.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 模块名称:Storage Test Suite
|
||||
* 模块功能:FTL + FatFS 存储测试的声明与断言宏。实现见 storage_test_task.c,
|
||||
* 统一由 ch395fTestTask 调度;正常产品构建下由 defaultTask 调用,
|
||||
* 行为与原 defaultTask 内联逻辑一致。
|
||||
* 适用平台:STM32F4 系列
|
||||
* 作者:王建锋
|
||||
* 创建日期:2026-08-26
|
||||
*/
|
||||
|
||||
#ifndef __STORAGE_TEST_H
|
||||
#define __STORAGE_TEST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
uint16_t total;
|
||||
uint16_t passed;
|
||||
uint16_t failed;
|
||||
} storage_test_stats_t;
|
||||
|
||||
extern storage_test_stats_t g_storage_stats;
|
||||
|
||||
#define STORAGE_TEST_CHECK(cond, fmt, ...) do { \
|
||||
g_storage_stats.total++; \
|
||||
if (cond) { \
|
||||
g_storage_stats.passed++; \
|
||||
DBG_INFO(" [PASS] " fmt, ##__VA_ARGS__); \
|
||||
} else { \
|
||||
g_storage_stats.failed++; \
|
||||
DBG_ERROR(" [FAIL] " fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define STORAGE_TEST_REPORT(name) do { \
|
||||
DBG_INFO("=== %s: %d/%d PASSED (failed=%d) ===", \
|
||||
name, g_storage_stats.passed, g_storage_stats.total, \
|
||||
g_storage_stats.failed); \
|
||||
} while (0)
|
||||
|
||||
/* 存储测试入口:FTL + FatFS 文件系统与性能测试 */
|
||||
void storage_test_run(void);
|
||||
|
||||
/* 存储套件恢复测试(默认关闭):取消注释并编译 STORAGE 套件运行一次,
|
||||
* 即可重建 BBT(清除 TC-STO-03 等注入的坏块)并重新格式化,恢复设备干净态。
|
||||
* 恢复完成后建议重新注释并编译正常构建。 */
|
||||
//#define ENABLE_STORAGE_RECOVERY_TESTS
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STORAGE_TEST_H */
|
||||
Reference in New Issue
Block a user