diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py --- 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 --- a/mlir/test/mlir-cpu-runner/lit.local.cfg +++ b/mlir/test/mlir-cpu-runner/lit.local.cfg @@ -2,4 +2,13 @@ # 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 +