Files
STM32F4-Base/test/host/ui_data/run_unit_test.py
T
wandering1 b7a3e18dca docs(ui): UI_数据供给设计改为现状设计并去「说明」,引用与注释全仓校准
- 改名走 rename_ref.py:22 文件 55 处路径引用随迁;764 行规划态
  重写为 584 行现状设计,删落地步骤/验收判据两章与全部历史注
- 新增 §6.4:维护动作/遥测整定/通讯参数/录波回放四条常驻注入
  通道写成现状表;§7.4 SOE 改「已绑定」现状
- ui_data.h 注释修正:rt 帧 212 B→216 B 两处(uint64 位图使整帧
  按 8 对齐,单测 021g 钉 216);录波注入「通道六」改「通道七」
  (与通讯参数撞号)
- 既有断链债清 4 处:屏板链路旧 §9.1/§9.2 ×3、覆盖率口径
  §4.5→§4.4、登记簿标注已删除;check_doc_links 外部名单加
  IEC 60870
- 并发会话的 UI_时间响应分析.md 及其四篇修订不在本笔:README
  行级拆分只暂存数据供给摘要行

验证:keil-build 0 错误 0 警告;pre_commit --all-files 全过;
check_doc_links --all 237 篇零问题;ui_data 主机单测 303/303。
2026-11-17 11:59:45 +08:00

50 lines
2.2 KiB
Python
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.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""UI 数据快照层(ui_data)主机侧纯逻辑单元测试运行器(纯标准库)。
做什么:
用本机 MSVC 编译 test/host/ui_data/ui_data_test.c(它以 #include 纳入
**生产源文件** Drivers/BSP/UI/ui_data.c,并同时 include 契约另一侧的
App/algo 头),在 PC 上离线跑"快照存储 + 发布盖章 + 跨层下标一致性",
失败即非 0 退出。零硬件、零烧录、毫秒级。
工具链探测 / 编译运行全部委托 test/host/common/unit_test_harness.py。
为什么要主机侧单测(而不是只用模拟器像素回归):
快照层是页面看到的整个世界,但 ui-golden 只覆盖"已接线的页面"——遥信 27 点、
定值 40 项、遥测 9 路这类"还没接线的通道"错了不会让任何一张参考图变红。
跨层不透明下标(yc 序 = adc_semantic_t、q10 序 = prot_set_id_t)正是解耦换来
的风险面,契约把它钉在编译/测试期(docs/UI设计/UI_数据供给设计.md §9.4)。
用法(仓库根目录):
python test/host/ui_data/run_unit_test.py
退出码:0=PASS / 1=测试失败 / 2=环境错误。
设计依据:docs/UI设计/UI_数据供给设计.md §9.1(主机单测判据)/ §9.4(一致性测试);
创建日期:2026-10-25
"""
import os
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(HERE)))
sys.path.insert(0, os.path.join(ROOT, "test", "host", "common"))
from unit_test_harness import TestBuild, run_host_unit_test # noqa: E402
# 被测侧(BSP/UI)与契约另一侧(App/algo)都要在包含路径里:测试单元在同一 TU
# 里同时看到两侧头,才有资格断言"页面表的下标指向预期枚举"。
BUILD = TestBuild(
name="UI Data Snapshot Tests",
src=os.path.join(HERE, "ui_data_test.c"),
include_dirs=[
HERE,
os.path.join(ROOT, "Drivers", "BSP", "UI"),
os.path.join(ROOT, "App", "algo"),
os.path.join(ROOT, "App", "log"), # soe_rec.h:SOE 事件类型编号真源
],
summary_marker="=== UI Data Snapshot Tests:",
)
if __name__ == "__main__":
sys.exit(run_host_unit_test(BUILD))