已合并
fix: validate build help option combinations #2353
fix: validate build help option combinations #2353
已合并
Robell创建于 5月20日
Robell
5月20日

## 描述
修复 #710 中记录的 build.sh help 参数预检 Top 3 功能/质量问题:

  • 修正 check_help_combinations 遍历变量,从 ${arg[@]} 改为 ${args[@]},确保 help 预检真正读取调用参数。
  • 修正 --cov 组合判断:单独使用 --cov 时报错,-t/--test 或测试分片配合 --cov 时允许进入对应帮助输出。
  • 将 -j8、-j16 等短参数带值形式归一化为 -j 后再做重复检测,避免同一次调用出现多个线程数配置。

关联的Issue

关联Issue #710

测试

已在本地执行并通过。由于 Windows checkout 下 build.sh 为 CRLF,直接 bash build.sh 会先撞换行问题;本次测试使用去除 CR 的 LF 临时副本验证脚本逻辑,不修改仓库文件。

bash -n <LF临时副本>
bash <LF临时副本> -h --cov
bash <LF临时副本> -h -t --cov
bash <LF临时副本> -h -t --adv_test
bash <LF临时副本> -h -j8 -j16
git diff --check
git commit -m "fix: validate build help option combinations"

结果:

  • 语法检查通过,EXIT:0。
  • -h --cov 正确报错,EXIT:1。
  • -h -t --cov 正确输出 Test Options,EXIT:0。
  • -h -t --adv_test 正确报互斥错误,EXIT:1。
  • -h -j8 -j16 正确报重复 -j,EXIT:1。
  • git diff --check 通过,无 whitespace error。
  • 提交钩子执行 clang-format(无 C/C++ 文件,跳过)和 OAT Compliance Check;OAT 因 Windows 环境未安装 Maven 提示跳过后返回通过。

文档更新

N/A

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Robell 的贡献)
RRobell
5月20日 创建了 pull request,commit 1721bcc6
RRobell
5月20日 关联了issue:[Bug-Report|缺陷反馈]: 修复 build.sh help 参数组合校验异常
CANN-robot
CANN-robot成员
5月20日 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/asc-devkit ✅ gao_dafa, DragonBornHD84 (2/2) ✅ gao_dafa (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

gcw_oroHQZs3, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
5月20日 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
5月20日 将zengjuan,zhanghao_0689,wulinyu,zhuliangying,kong0808,dengjing_aoe,YeZZzzz1,bluesky901,yangbinhua,gao_dafa,chenyiyuan,xun_zhuge,bianque,houyuyang,shi_nanxiang,wuyang_hw,ascendhjh,DragonBornHD84,jiangZD设为评审人
CANN-robotCANN-robot成员
5月20日 将zengjuan,zhanghao_0689,wulinyu,zhuliangying,kong0808,dengjing_aoe,YeZZzzz1,bluesky901,yangbinhua,gao_dafa,chenyiyuan,xun_zhuge,bianque,houyuyang,shi_nanxiang,wuyang_hw,ascendhjh,DragonBornHD84,jiangZD设为审查人
Robell
5月20日 评论:

本地验证结果(中文说明):

  • bash -n <LF临时副本>:通过,EXIT:0。
  • bash <LF临时副本> -h --cov:正确报错 --cov must be used with test(-t, --test) or a test part option.,EXIT:1。
  • bash <LF临时副本> -h -t --cov:正确输出 Test Options,EXIT:0。
  • bash <LF临时副本> -h -t --adv_test:正确报错 --adv_test cannot be used with test(-t, --test).,EXIT:1。
  • bash <LF临时副本> -h -j8 -j16:正确报错 -j can only be input one.,EXIT:1。
  • git diff --check:通过,仅有 Windows 工作区 LF/CRLF 提示,无 whitespace error。
  • 提交钩子:clang-format 无适用 C/C++ 文件,跳过;OAT Compliance Check 在 Windows 环境缺少 Maven 时提示跳过后返回通过。

说明:当前 Windows checkout 下 build.sh 为 CRLF,直接 bash build.sh 会先因换行失败;上述命令使用去除 CR 的 LF 临时副本验证脚本逻辑,未修改仓库文件。

likedislike
Robell
5月20日 评论:

compile

likedislike
RRobell
5月20日 预合并成功(commit_id: 4f97338212cf008eb755b2b2d38c0482fc6296be)
gao_dafa成员
5月20日 评论:

gcw_oroHQZs3,感谢您的提交,建议在完成PR充分自验证后,再触发线上构建任务。

若您的PR已具备检视条件,可根据下表的责任田,@对应的committer进行代码检视,我们会在第一时间对您的提交进行处理。

代码责任田:

module committer
adv_api chenyiyuan, wuyang_hw
basic_api chenyiyuan, wuyang_hw
c_api pangfd, yue_mo_du_qian
cmake xun_zhuge, DragonBornHD84
docs munanhw, ai_xin
examples changxianyu, bianque
simt_api wulinyu, zhanghao_0689
scripts xun_zhuge, kevin365
tools YANXI_ZHAO, XuebinYang, sjtulxh

💡 如您不确定可以@谁,可以直接@我或者ascend-c sig的maintainer,xun_zhuge和ascendhjh,我们会为您分配合适的committer进行代码检视。

再次感谢您参与CANN的社区贡献。

likedislike
CANN-robotCANN-robot成员
5月20日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
5月20日 评论:

流水线任务触发成功
任务链接 [a73aa10cfa094d88a4f9532cc3a4b99d][流水线指导]

任务名称状态日志下载链接
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ⚠️ WARNING
codecheck_precommit ✅ SUCCESS >>>>> >>>>>

[2026-05-20 16:25:56]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
5月20日 评论:

流水线任务触发成功
任务链接 [80e16498475a4c40aa8786bd098b2c8c][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>>
pre_comment ✅ SUCCESS >>>>>
UT_Test_adv_test_one ✅ SUCCESS
UT_Test_adv_test_two ✅ SUCCESS
UT_Test_basic_test_one ✅ SUCCESS
UT_Test_basic_test_two ✅ SUCCESS
UT_Test_basic_test_three ✅ SUCCESS
UT_Test_basic_test_four ✅ SUCCESS
UT_Test_basic_test_five ✅ SUCCESS
UT_Test_arm ✅ SUCCESS
API_Check ✅ SUCCESS >>>>>
UT_Test_report ✅ SUCCESS >>>>>

[2026-05-20 16:32:31]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
5月20日 评论:

流水线任务触发成功
任务链接 [fca133b1d5c74ed785d690672d26813d][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-05-20 16:46:16]    CI执行结束

likedislike
CANN-robotCANN-robot成员
5月20日 添加了label:api-check-pass
CANN-robotCANN-robot成员
5月20日 删除了label:api-check-pass
CANN-robotCANN-robot成员
5月20日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
5月20日 添加了label:ci-pipeline-passed
DragonBornHD84成员
5月21日 评论:

/lgtm

likedislike
gao_dafa成员
5月21日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
5月21日 添加了label:lgtmapproved
CANN-robot
CANN-robot成员
5月21日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: gao_dafa.
Reviewers who wrote a comment of /lgtm are: gao_dafa, DragonBornHD84.

likedislike
CANN-robotCANN-robot成员
5月21日 合入了pull request