Pull Request已成功合入, 合并人@CANN-robot
(感谢 shengnan 的贡献)变更摘要
此 PR 将项目中的单元测试 (UT) 和系统测试 (ST) 的执行方式从直接运行测试二进制文件,统一迁移至 ctest 框架管理。在 scripts/test/run_autofuse_test.sh 脚本中,多个测试函数不再直接调用各自的可执行文件,而是改为使用 ctest 命令配合正则筛选和测试目录参数来统一调度运行。同时移除了两个不再需要的辅助函数 run_codegen_one_e2e_st 和 run_backend_one_e2e_st。
主要改动
-
build_test改用ctest执行: 原先切换到tests/ut/目录直接运行test_main可执行文件;现改为通过ctest --output-on-failure -j${THREAD_NUM} -R '^test_main_ut_aggregate$' --test-dir ${AUTOFUSE_BUILD_PATH}/tests --no-tests=error执行,同时移除了cd切换目录的逻辑。 -
build_test_ascir_st、build_ut_optimize、build_ut_common、build_kernel_tool、build_ut_att统一使用ctest: 这五个测试函数原先均通过直接调用各自测试二进制(如test_ascir_st、optimize_ut、test_common、test_kernel、att_ut)的方式运行;统一改为ctest命令,分别使用对应的正则模式(如^ascir_st_aggregate$、^optimize_ut_aggregate$等)进行测试筛选和执行。 -
移除
run_codegen_one_e2e_st与run_backend_one_e2e_st函数: 删除了这两个负责复制并运行 e2e 测试可执行文件的辅助函数,表明相关 e2e 测试也已纳入ctest统一管理或以其他方式替代。


代码审查
All confirmed — the removed functions have zero references across the entire project. The removal is safe.
关闭总结
本次审查覆盖了全部 7 个变更文件:
| 文件 | 审查结论 |
|---|---|
autofuse/tests/st/ascir/CMakeLists.txt |
新增 add_test(ascir_st_aggregate) 及标签,无独立问题 |
autofuse/tests/st/codegen/CMakeLists.txt |
发现 1 个 P2 问题(kernel_tool 工作目录变更) |
autofuse/tests/ut/CMakeLists.txt |
发现 2 个 P3 问题(test_main 双重注册 + 缺少 LABELS) |
autofuse/tests/ut/att/CMakeLists.txt |
无问题 |
autofuse/tests/ut/common/CMakeLists.txt |
无问题 |
autofuse/tests/ut/optimize/CMakeLists.txt |
无问题 |
scripts/test/run_autofuse_test.sh |
变更模式一致,移除的函数为死代码,无独立问题 |
问题统计:
- P0: 0
- P1: 0
- P2: 1(
kernel_tool_st_aggregate工作目录从kernel_tool/变为父目录,若测试依赖相对路径可能失败) - P3: 2(
test_main双重 CTest 注册、UT 聚合测试缺少 LABELS 标签)
整体风险评估:低。 核心重构(直接执行 → ctest 统一管理)模式一致且正确。P2 问题是 kernel_tool 工作目录变更,属于边界场景,触发概率取决于 test_kernel 是否使用相对文件路径;其余为 P3 设计改进建议,不影响功能正确性。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


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/graph-autofusion | ✅ zhanj, xchu42, zhang_shengjie (3/2) | ✅ zhanj (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
shengnan666, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [fc046e6ba6b64bbd8458709b5af870eb][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| UT_Test_Python_superkernel | ✅ SUCCESS | >>>>> | |
| ST_Test_Python_superkernel | ✅ SUCCESS | >>>>> | |
| UT_Test_superkernel | ✅ SUCCESS | >>>>> | |
| UT_Test_autofuse_framework | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_framework | ✅ SUCCESS | >>>>> | |
| UT_Test_autofuse_ascendc_api | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_ascendc_api | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_e2e | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> |
[2026-07-22 10:23:39] CI执行结束


流水线任务触发成功
任务链接 [c10513aa0c6845b7ac953fca521b6fb2][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| UT_Test_Python_superkernel | ✅ SUCCESS | >>>>> | |
| ST_Test_Python_superkernel | ✅ SUCCESS | >>>>> | |
| UT_Test_superkernel | ✅ SUCCESS | >>>>> | |
| UT_Test_autofuse_framework | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_framework | ✅ SUCCESS | >>>>> | |
| UT_Test_autofuse_ascendc_api | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_ascendc_api | ✅ SUCCESS | >>>>> | |
| ST_Test_autofuse_e2e | ✅ SUCCESS | >>>>> | |
| pre_comment | ✅ SUCCESS | >>>>> |
[2026-07-22 14:33:36] CI执行结束


/lgtm


/lgtm


/approve


Pull Request
描述
将ut/st注册到ctest统一管理
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
1.
2.
核对清单
其他信息
在此添加任何其他关于本次 PR 的说明。