bb76cfd779
规则定案:常量在右(a>5)、保护宏XXX_H(禁双下划线)、 头文件常量用#define、存储类前缀(g_/s_)优先、允许void返回值 全库32个.h头文件保护宏 __XXX_H → XXX_H 改名(字节级替换) S1检查规则同步更新(拒绝双下划线),Inc/gpio.h 反向验证被正确拦截 规范示例矛盾修复:K&R括号、标准类型、变量初始化、命名常量、注释字段补全
58 lines
1.6 KiB
C
58 lines
1.6 KiB
C
/*
|
||
* 模块名称:Storage Test Suite
|
||
* 模块功能:FTL + FatFS 存储测试的声明与断言宏。实现见 storage_test_task.c,
|
||
* 统一由 testTask 调度;正常产品构建下由 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 */
|