From fb8b56f2f19e1898cd146504e84f6419c98cfc0a Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sun, 4 Oct 2026 20:54:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E5=9B=9E=E5=BD=92=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E8=BE=93=E5=87=BA=E7=9B=AE=E5=BD=95=E5=80=99=E9=80=89?= =?UTF-8?q?=E8=A1=A5=20*=5Fmlir=20=E5=8F=98=E4=BD=93=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=8D=95=E7=AB=AF=20MLIR=20=E4=B8=8B=20exe=20=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 单端 MLIR 后 OutputDir = {BuildDir}/output_mlir(Config.mlir_dir_suffix()), 但 SequentialRegressionTest.find_output_dirs 与 regression_test 只探 output/ 与 .tpv_build/output,导致编译成功却报"未找到可执行文件" (MLIRLiteTest 实测)。两处补 *_mlir 变体并优先探测(旧 output/ 可能 残留同名旧 exe)。 --- SequentialRegressionTest.py | 9 ++++++++- regression_test.py | 20 +++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/SequentialRegressionTest.py b/SequentialRegressionTest.py index beba3ea..65a3ba8 100644 --- a/SequentialRegressionTest.py +++ b/SequentialRegressionTest.py @@ -110,19 +110,26 @@ def find_output_dirs(proj_dir, proj_config): - {output_dir}(默认 output,TPC/旧布局) - {build_dir}/{output_dir}(build_dir 默认 .tpv_build) - {build_dir}/output(TPV 布局:.tpv_build/output) + - 以上各项的 *_mlir 变体(单端 MLIR 布局:OutputDir = {BuildDir}/output_mlir, + 见 TransPyV/App/lib/Projectrans/Config.vp 的 mlir_dir_suffix()) 保序去重返回。 注意:ZlibDbg 等项目的 project.json 既无 output_dir 也无 build_dir, 此时必须仍把 .tpv_build/output 纳入候选,否则 TPV 编译成功的 exe 定位不到(报"无可执行二进制文件")。 + 单端 MLIR 后 exe 落在 {BuildDir}/output_mlir(非 output),且旧 LLVM 布局 + 的 output/ 可能残留同名旧 exe,故 *_mlir 变体**优先**探测。 """ od = proj_config.get('output_dir') or 'output' bd = proj_config.get('build_dir') or '.tpv_build' - dirs = [ + # 单端 MLIR 目录后缀(与 Config.mlir_dir_suffix() 同口径,当前恒为 "_mlir") + mlir_suf = '_mlir' + base = [ os.path.abspath(os.path.join(proj_dir, od)), os.path.abspath(os.path.join(proj_dir, bd, od)), os.path.abspath(os.path.join(proj_dir, bd, 'output')), ] + dirs = [d + mlir_suf for d in base] + base seen = set() uniq = [] for d in dirs: diff --git a/regression_test.py b/regression_test.py index 3770496..3d8496f 100644 --- a/regression_test.py +++ b/regression_test.py @@ -230,9 +230,23 @@ def main(): proj_config = json.load(f) except Exception: continue - output_dir = os.path.join(proj_dir, proj_config.get('output_dir', './output')) - output_dir = os.path.abspath(output_dir) - for exe in find_executables(output_dir): + # 候选输出目录:兼容 TPC/旧 LLVM 布局(output)与单端 MLIR 布局 + # (OutputDir = {BuildDir}/output_mlir,见 Config.mlir_dir_suffix())。 + # 旧 output/ 可能残留同名旧 exe,故 *_mlir 变体优先探测。 + od = proj_config.get('output_dir') or 'output' + bd = proj_config.get('build_dir') or '.tpv_build' + base_dirs = [ + os.path.join(proj_dir, od), + os.path.join(proj_dir, bd, od), + os.path.join(proj_dir, bd, 'output'), + ] + exes = [] + for d in [os.path.abspath(x) + '_mlir' for x in base_dirs] \ + + [os.path.abspath(x) for x in base_dirs]: + exes = find_executables(d) + if exes: + break + for exe in exes: run_tasks.append((name, exe)) print(f"找到 {len(run_tasks)} 个可执行文件\n")