Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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,'
}}
${{
Expand Down
44 changes: 42 additions & 2 deletions mlir/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, $<CONFIG> 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 $<CONFIG> 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 $<CONFIG> 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)
3 changes: 2 additions & 1 deletion mlir/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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>"
config.mqt_core_mlir_test_dir = "@PROJECT_BINARY_DIR@/mlir/test"

import lit.llvm
Expand Down
Loading