From bc14c77a1e8818ed8647e5bc92e3cd38f27fda41 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Fri, 19 Jun 2020 03:21:36 +0000 Subject: [PATCH] Fix `check-mlir` target when the host target isn't configured This patch adds the `default_triple` feature to MLIR test suite. This feature was added to LLVM in d178f4fc8 in order to be able to run the LLVM tests without having the host targets configured in. With this change, `ninja check-mlir` passes without the host target, i.e. this config: cmake ../llvm -DLLVM_TARGETS_TO_BUILD="" -DLLVM_DEFAULT_TARGET_TRIPLE="" -DLLVM_ENABLE_PROJECTS=mlir -GNinja Differential Revision: https://reviews.llvm.org/D82142 --- mlir/test/lit.cfg.py | 8 ++++++++ mlir/test/mlir-cpu-runner/lit.local.cfg | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index 8c556e2..bb0850e 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -81,3 +81,11 @@ llvm_config.add_tool_substitutions(tools, tool_dirs) # This option avoids to accidentally reuse variable across -LABEL match, # it can be explicitly opted-in by prefixing the variable name with $ config.environment['FILECHECK_OPTS'] = "-enable-var-scope" + + +# LLVM can be configured with an empty default triple +# by passing ` -DLLVM_DEFAULT_TARGET_TRIPLE="" `. +# This is how LLVM filters tests that require the host target +# to be available for JIT tests. +if config.target_triple: + config.available_features.add('default_triple') diff --git a/mlir/test/mlir-cpu-runner/lit.local.cfg b/mlir/test/mlir-cpu-runner/lit.local.cfg index 7fd56a7..012da91 100644 --- a/mlir/test/mlir-cpu-runner/lit.local.cfg +++ b/mlir/test/mlir-cpu-runner/lit.local.cfg @@ -2,4 +2,13 @@ import sys # FIXME: llvm orc does not support the COFF rtld. if sys.platform == 'win32': - config.unsupported = True \ No newline at end of file + config.unsupported = True + +# Requires a non-empty default triple for these tests. +# Passing ` -DLLVM_DEFAULT_TARGET_TRIPLE="" ` when the +# host target isn't available is how LLVM filters +# tests that require the host target to be available +# for JIT tests. +if 'default_triple' not in config.available_features: + config.unsupported = True + -- 2.7.4