Files
STM32F4-Base/test/host/cfg_file/stub/dbg_log.h
T
wandering1 fe963e7d91
CI / L0 静态门禁 (pre-commit) (push) Successful in 49s
CI / L0.5 主机侧单测 (MSVC) (push) Successful in 17s
测试:新增 cfg_file 主机侧单测并修复外科手术保存死码缺陷(S1-b+S2)
2026-10-02 13:00:54 +08:00

32 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 主机侧单测桩:dbg_log.h
* 模块功能:为 cfg_file.c 提供主机可编译的日志宏(映射到 printf / 计数)。
*
* ⚠ 仅供 test/host/cfg_file/ 使用,不参与 MCU 构建。
*
* MCU 版依赖 sys_clock(RTC 时间戳)与 USART;主机侧替换为计数/直通,
* 使"非法键值是否留痕"(DBG_ERROR)与"注册/加载成功日志"(DBG_INFO)
* 成为可观测行为——单测据此断言既有留痕、又不被噪声淹没。
*
* 创建日期:2026-10-02
*/
#ifndef DBG_LOG_H
#define DBG_LOG_H
#include <stdio.h>
/* 测试观测计数(在 cfg_file_test.c 实现):
* g_cfgtest_err_count —— DBG_ERROR 次数(如非法键值留痕)
* g_cfgtest_info_count —— DBG_INFO 次数(如 load 成功)
* g_cfgtest_debug_count—— DBG_DEBUG 次数 */
extern int g_cfgtest_err_count;
extern int g_cfgtest_info_count;
extern int g_cfgtest_debug_count;
#define DBG_INFO(fmt, ...) do { g_cfgtest_info_count++; } while (0)
#define DBG_DEBUG(fmt, ...) do { g_cfgtest_debug_count++; } while (0)
#define DBG_ERROR(fmt, ...) do { g_cfgtest_err_count++; } while (0)
#endif /* DBG_LOG_H */