[Mlir-commits] [mlir] bc14c77 - Fix `check-mlir` target when the host target isn't configured

Mehdi Amini llvmlistbot at llvm.org
Thu Jun 18 23:36:39 PDT 2020


Author: Mehdi Amini
Date: 2020-06-19T06:36:20Z
New Revision: bc14c77a1e8818ed8647e5bc92e3cd38f27fda41

URL: https://github.com/llvm/llvm-project/commit/bc14c77a1e8818ed8647e5bc92e3cd38f27fda41
DIFF: https://github.com/llvm/llvm-project/commit/bc14c77a1e8818ed8647e5bc92e3cd38f27fda41.diff

LOG: 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

Added: 
    

Modified: 
    mlir/test/lit.cfg.py
    mlir/test/mlir-cpu-runner/lit.local.cfg

Removed: 
    


################################################################################
diff  --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py
index 8c556e2db535..bb0850ec6756 100644
--- a/mlir/test/lit.cfg.py
+++ b/mlir/test/lit.cfg.py
@@ -81,3 +81,11 @@
 # 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 7fd56a7f60dc..012da916f226 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
+


        


More information about the Mlir-commits mailing list