From 4508e1bebd7c9429e0148a31d9f645938c69957f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 3 Jan 2026 15:52:55 +0000 Subject: [PATCH 1/2] Initial plan From a7730bd94660f907dd65cf7364b00f78a52e0464 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 3 Jan 2026 15:57:10 +0000 Subject: [PATCH 2/2] Fix MLIR lit test configuration and CI workflow conditions Co-authored-by: burgholzer <6358767+burgholzer@users.noreply.github.com> --- .github/workflows/ci.yml | 20 ++++++++-------- mlir/test/lit.cfg.py | 44 ++++++++++++++++++++++++++++++++++-- mlir/test/lit.site.cfg.py.in | 3 ++- 3 files changed, 54 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08078b04dc..e28246ad0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: cpp-tests-ubuntu: name: 🇨‌ Test 🐧 needs: change-detection - if: fromJSON(needs.change-detection.outputs.run-cpp-tests) && !contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') + if: (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && !contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') strategy: fail-fast: false matrix: @@ -39,7 +39,7 @@ jobs: cpp-tests-macos: name: 🇨‌ Test 🍎 needs: change-detection - if: fromJSON(needs.change-detection.outputs.run-cpp-tests) && !contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') + if: (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && !contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') strategy: fail-fast: false matrix: @@ -60,7 +60,7 @@ jobs: cpp-tests-windows: name: 🇨‌ Test 🏁 needs: change-detection - if: fromJSON(needs.change-detection.outputs.run-cpp-tests) && !contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') + if: (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && !contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') strategy: fail-fast: false matrix: @@ -81,7 +81,7 @@ jobs: cpp-tests-extensive-ubuntu: name: 🇨‌ Test (Extensive) 🐧 needs: change-detection - if: fromJSON(needs.change-detection.outputs.run-cpp-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') + if: (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') strategy: fail-fast: false matrix: @@ -98,7 +98,7 @@ jobs: cpp-tests-extensive-macos: name: 🇨‌ Test (Extensive) 🍎 needs: change-detection - if: fromJSON(needs.change-detection.outputs.run-cpp-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') + if: (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') strategy: fail-fast: false matrix: @@ -116,7 +116,7 @@ jobs: cpp-tests-extensive-windows: name: 🇨‌ Test (Extensive) 🏁 needs: change-detection - if: fromJSON(needs.change-detection.outputs.run-cpp-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') + if: (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') strategy: fail-fast: false matrix: @@ -132,7 +132,7 @@ jobs: cpp-coverage: name: 🇨‌ Coverage needs: change-detection - if: fromJSON(needs.change-detection.outputs.run-cpp-tests) + if: fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir) uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-coverage.yml@7f8eeed7a3dba08e1e9be54966e5722f5753d0df # v1.17.7 permissions: contents: read @@ -262,15 +262,15 @@ jobs: with: allowed-skips: >- ${{ - fromJSON(needs.change-detection.outputs.run-cpp-tests) && !contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') + (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && !contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') && '' || 'cpp-tests-ubuntu,cpp-tests-macos,cpp-tests-windows,' }} ${{ - fromJSON(needs.change-detection.outputs.run-cpp-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') + (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci') && '' || 'cpp-tests-extensive-ubuntu,cpp-tests-extensive-macos,cpp-tests-extensive-windows,' }} ${{ - fromJSON(needs.change-detection.outputs.run-cpp-tests) + (fromJSON(needs.change-detection.outputs.run-cpp-tests) || fromJSON(needs.change-detection.outputs.run-mlir)) && '' || 'cpp-coverage,' }} ${{ diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index e51242713d..070c95b72a 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -38,7 +38,47 @@ # Define where to execute tests (and produce the output). config.test_exec_root = Path(config.mqt_core_mlir_test_dir) -multi_config_path = Path(config.mqt_core_mlir_tools_dir) / config.cmake_build_type -tool_dirs = [config.llvm_tools_dir, config.mqt_core_mlir_tools_dir, str(multi_config_path)] +# Build tool search paths +# LLVM tools (FileCheck, not) come from LLVM installation +# quantum-opt comes from our build directory +base_tool_dir = Path(config.mqt_core_mlir_tools_dir) + +# For multi-config generators, $ is expanded at build time by CMake +# For single-config generators, the path is the actual directory +# We need to check if the path contains a valid binary location +tool_dirs = [config.llvm_tools_dir] + +# Check if base_tool_dir exists and contains quantum-opt +if base_tool_dir.exists(): + if (base_tool_dir / "quantum-opt").exists() or (base_tool_dir / "quantum-opt.exe").exists(): + tool_dirs.append(str(base_tool_dir)) + else: + # For multi-config generators, check if parent directory exists + # This handles cases where $ didn't expand properly + parent_dir = base_tool_dir.parent + if parent_dir.exists(): + # Search for quantum-opt in parent or common config directories + found = False + for candidate in [parent_dir] + [parent_dir / cfg for cfg in ["Release", "Debug", "RelWithDebInfo", "MinSizeRel"]]: + if (candidate / "quantum-opt").exists() or (candidate / "quantum-opt.exe").exists(): + tool_dirs.append(str(candidate)) + found = True + break + if not found: + # Fallback: add parent directory anyway + tool_dirs.append(str(parent_dir)) +else: + # Path doesn't exist - likely $ not expanded + # Try parent directory + parent_dir = base_tool_dir.parent + if parent_dir.exists(): + tool_dirs.append(str(parent_dir)) + # Also try common config subdirectories + for cfg in ["Release", "Debug", "RelWithDebInfo", "MinSizeRel"]: + candidate = parent_dir / cfg + if (candidate / "quantum-opt").exists() or (candidate / "quantum-opt.exe").exists(): + tool_dirs.append(str(candidate)) + break + tools = ["not", "FileCheck", "quantum-opt"] llvm_config.add_tool_substitutions(tools, tool_dirs) diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in index 313ea13b92..087c6d3a6d 100644 --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -10,7 +10,8 @@ config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") config.cmake_build_type = "@CMAKE_BUILD_TYPE@" -config.mqt_core_mlir_tools_dir = "@PROJECT_BINARY_DIR@/mlir/tools/quantum-opt" +# Use generator expression to handle multi-config generators +config.mqt_core_mlir_tools_dir = "@PROJECT_BINARY_DIR@/mlir/tools/quantum-opt/$" config.mqt_core_mlir_test_dir = "@PROJECT_BINARY_DIR@/mlir/test" import lit.llvm