已合并
feat: 新增 LLVM 工具自动发现脚本与步骤零输入校验门禁 #39
feat: 新增 LLVM 工具自动发现脚本与步骤零输入校验门禁 #39
已合并
fangzy0823创建于 11 天前
fangzy0823
11 天前

一、内容说明(相关的Issue)

#37 分析报告对比

本 PR 包含两项独立改进,均针对 01-fault-analysis/cppcrash-analysis/ 技能。

1. LLVM 工具自动定位(ohos_llvm_tools.py)

之前 SKILL.md 步骤四和 README.md 中直接调用裸 llvm-addr2line / llvm-objdump 命令,要求用户手动确保工具在 PATH 中。新增 scripts/ohos_llvm_tools.py(纯标准库实现),按 DEVECO_HOME / DEVECO_SDK_HOME / OHOS_SDK
环境变量自动定位 OHOS SDK 自带的 LLVM 工具,覆盖两种 SDK 目录布局(standalone OHOS SDK 带 platform 段 vs command-line-tools 不带)。未找到时按报错提示设置环境变量或加入 PATH。

2. 步骤零输入校验(日志类型 + 堆栈信息门禁)

之前脚本对非 CppCrash 日志和缺失堆栈信息的 CppCrash 日志不做前置拦截,直接进入解析流程,产出无意义报告或误导性分析。现在在 build_report 中新增两条门禁:

  • 日志类型校验collector.py 已有的识别逻辑(文件名 cppcrash- + 内容嗅探 Reason:Signal: / Reason:GWP-ASAN / *** GWP-ASan detected a memory error ***,排除其他故障类型)未改动;SKILL.md 新增 item 5
    描述该行为及脚本报错后的用户沟通策略。
  • 堆栈信息校验:解析后检查 fault_stack.frames(CppCrash 的 #NN pc 帧)或 gwp_asan_text 中的真实帧行(GWP-ASan 的 #N 0xADDR 帧),两者皆空时抛 ValueError 并退出。SKILL.md 新增 item 6 描述该行为。

GWP-ASan 日志没有 Fault thread info: 区段,其调用栈在 *** GWP-ASan detected a memory error *** 区块中使用不同帧格式,因此校验逻辑覆盖两条路径,不会误杀有效的 GWP-ASan 日志或放过截断的 GWP-ASan 日志(仅头部标记无实际栈帧)。

二、建议测试周期和提测地址

建议测试完成时间:xxxx.xx.xx
投产上线时间:xxxx.xx.xx
提测地址:CI环境/压测环境
测试账号:

三、变更内容

文件 变更
scripts/ohos_llvm_tools.py 新增(265 行)。按环境变量自动定位并执行 llvm-addr2line -pCfie / llvm-objdump -dS -l -C,支持两种 SDK 目录布局 + 递归模糊搜索 + PATH 回退
scripts/main.py build_report 新增堆栈校验(+9 行):has_gwp_asan_frames 逐行扫描 gwp_asan_text 确认有 #N 0xADDR 帧;fault_stack.frameshas_gwp_asan_frames 皆空时抛 ValueError
SKILL.md 步骤零新增 items 5-6(+10 行):日志类型校验 + 堆栈信息校验;步骤四裸命令改为 ohos_llvm_tools.py 调用(+2 行)
scripts/report.py 堆栈提示文本中 llvm-addr2line 改为 ohos_llvm_tools.py addr2line(1 行)
references/gwp_asan.md 缺失信息表中 llvm-addr2line 改为 ohos_llvm_tools.py addr2line(1 行)
README.md 可选深入分析步骤改为通过 ohos_llvm_tools.py 执行(1 行)
changelog/cppcrash-analysis.md [Unreleased] - 2026-08-26 新增 2 条新增 + 2 条变更(+10 行)

四、研发自测点(自测哪些?冒烟用例全部自测?)

输入校验通过 6 条测试日志验证:

日志类型 标记 栈内容 预期 Exit
JS Crash Error name: collector 排除 1 ✓
AppFreeze eventLog_action = collector 排除 1 ✓
CppCrash 有效 Reason:Signal: #NN pc 正常输出 0 ✓
CppCrash 无栈 Reason:Signal: 无帧 堆栈校验拒绝 1 ✓
GWP-ASan 有效 Reason:GWP-ASAN #N 0xADDR 正常输出 0 ✓
GWP-ASan 截断 Reason:GWP-ASAN 仅头无帧 堆栈校验拒绝 1 ✓

五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)

检查点:

需求名称 是否影响xx公共模块 是否需要xx功能 需求升级是否依赖其他子产品
xxx 需要 不需要

接口测试:

性能测试:

并发测试:

其他:

likedislike
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 fangzy0823 的贡献)
openharmony_ci
openharmony_ci成员
11 天前 评论:

感谢提交 Pull Requests !此PR未通过DCO校验。
校验失败可能原因:

1. 未签署“DCO协议”(开发者原创声明协议),在线签署、查看签署状态

2. Commits 中未包含 Signed-off-by信息,参考FAQ处理

修复上述问题后,在PR的评论框输入“check dco” ,单击”评论”,系统将再次进行DCO校验。

当前检测到如下Commits 未包含Signed-off-by信息:


Thanks for submitting a pull request. This pull request has not passed the DCO check.
Possible causes:

1. You have not signed the Developer Certificate of Origin (DCO). Sign the DCO and check DCO status.

2. The commits do not contain the Signed-off-by information. To resolve this issue, see FAQs.

After resolving the preceding issues, enter check dco in the comment box of this pull request and click Comment. The system will check DCO status again.

The following commits do not contain the Signed-off-by information:

likedislike
openharmony_ciopenharmony_ci成员
11 天前 添加了label:dco检查失败
openharmony_ci
openharmony_ci成员
5 天前 评论:

感谢提交 Pull Requests !此PR未通过DCO校验。
校验失败可能原因:

1. 未签署“DCO协议”(开发者原创声明协议),在线签署、查看签署状态

2. Commits 中未包含 Signed-off-by信息,参考FAQ处理

修复上述问题后,在PR的评论框输入“check dco” ,单击”评论”,系统将再次进行DCO校验。

当前检测到如下Commits 未包含Signed-off-by信息:


Thanks for submitting a pull request. This pull request has not passed the DCO check.
Possible causes:

1. You have not signed the Developer Certificate of Origin (DCO). Sign the DCO and check DCO status.

2. The commits do not contain the Signed-off-by information. To resolve this issue, see FAQs.

After resolving the preceding issues, enter check dco in the comment box of this pull request and click Comment. The system will check DCO status again.

The following commits do not contain the Signed-off-by information:

likedislike
Ffangzy0823
5 天前 强制推送  2 个提交:b04b9130-feat: 新增 ohos_llvm_tools.py 并替换 skill 中的裸 llvm 命令,486b7613-feat: 步骤零新增输入校验——日志类型与堆栈信息门禁
openharmony_ci
openharmony_ci成员
5 天前 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
此处折叠了41条消息 查看更多
openharmony_ciopenharmony_ci成员
1 天前 通过测试
openharmony_ci
openharmony_ci成员
1 天前 评论:

代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a9eabe364650f998be1f3fe/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

likedislike
openharmony_ciopenharmony_ci成员
1 天前 关闭了关联的issue
openharmony_ciopenharmony_ci成员
1 天前 合入了pull request,合并节点 SHA:6a4bcd6c7908435db9c8b96e9d1bce21715298e2
openharmony_dcp
openharmony_dcp成员
1 天前 评论:

你因提交次数过多被限制提交,为保障上库效率、避免资源浪费,请先观看学习视频:https://dcp.openharmony.cn/workbench/video/videoDisplay

likedislike