Fix MLIR lit test configuration for multi-config generators and enable C++ tests for MLIR changes#1421
Fix MLIR lit test configuration for multi-config generators and enable C++ tests for MLIR changes#1421
Conversation
Co-authored-by: burgholzer <6358767+burgholzer@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@copilot The PR is targetted at the wrong base branch. |
I've updated the PR to target the |
|
@copilot Resolve the conflicts and rebase |
I've resolved the conflicts and rebased onto the
The commit is ready locally but there's a technical limitation with force-pushing through the tooling due to the branch history divergence (4000+ commits). The branch needs to be force-pushed to replace the old grafted-main base with the proper enable-mlir base. |
|
@copilot Start a new PR that directly targets the enable-mlir branch. Close the existing PR |
I don't have the capability to create new PRs or close existing PRs. However, I've already prepared all the necessary changes locally in commit 9671ca32 which is properly rebased onto the enable-mlir branch (618d94f). The changes include:
You can either:
|
Description
This PR fixes MLIR lit test configuration to work properly with both single-config generators (Linux/macOS) and multi-config generators (Windows MSVC), and updates the CI workflow to run C++ tests when MLIR files change.
Base Branch:
enable-mlirThe changes resolve conflicts and rebase onto the
enable-mlirbranch to establish the correct base for MLIR-related improvements.Changes Made
mlir/test/lit.site.cfg.py.in$<CONFIG>generator expression to tool directory path for proper multi-config generator supportmlir/test/lit.cfg.pyquantum-optandquantum-opt.exe.github/workflows/ci.ymlrun-cpp-tests OR run-mlir:allowed-skipssections to match new conditionsExpected Outcomes
✅ MLIR lit tests pass on Linux (single-config generators)
✅ MLIR lit tests pass on macOS (single-config generators)
✅ MLIR lit tests pass on Windows (multi-config MSVC)
✅ C++ tests run when MLIR files are changed
✅ All CI checks pass
Checklist:
Original prompt
Problem
PR #1420 introduced a regression in the MLIR lit test configuration that breaks tests on all platforms:
quantum-optnot to be foundAdditionally, the CI workflows don't run C++ tests when MLIR-related files change, which means MLIR test failures can slip through.
Root Cause
In
mlir/test/lit.cfg.py(line 60), the base tool directoryconfig.mqt_core_mlir_tools_dirwas removed fromtool_dirs, breaking single-config builds wherequantum-optis built directly in that directory.The lit configuration tries to be too clever with runtime path detection, making it fragile and hard to debug.
The CI workflow conditions in
.github/workflows/ci.ymlonly checkrun-cpp-tests, notrun-mlir, so C++ test jobs skip when only MLIR files change.Solution Requirements
1. Fix
mlir/test/lit.site.cfg.py.inUpdate the configuration to use CMake generator expressions properly:
2. Simplify
mlir/test/lit.cfg.pyReplace the complex runtime detection logic with a simpler, more robust approach: