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
# 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')
# 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
+