summaryrefslogtreecommitdiffstats
path: root/mlir/test/Unit
diff options
context:
space:
mode:
authorJacques Pienaar <jpienaar@google.com>2019-03-29 22:10:12 -0700
committerMehdi Amini <joker.eph@gmail.com>2019-03-30 11:23:22 -0700
commit1273af232cd103faad15890687d506eae0d9f014 (patch)
tree540ba5dc899f26e2726afccb0b083650b4e4d2eb /mlir/test/Unit
parent6f24bf82f971d679cf209e4c1538ca69ded62ba5 (diff)
downloadbcm5719-llvm-1273af232cd103faad15890687d506eae0d9f014.tar.gz
bcm5719-llvm-1273af232cd103faad15890687d506eae0d9f014.zip
Add build files and update README.
* Add initial version of build files; * Update README with instructions to download and build MLIR from github; -- PiperOrigin-RevId: 241102092
Diffstat (limited to 'mlir/test/Unit')
-rw-r--r--mlir/test/Unit/lit.cfg.py42
-rw-r--r--mlir/test/Unit/lit.site.cfg.py.in26
2 files changed, 68 insertions, 0 deletions
diff --git a/mlir/test/Unit/lit.cfg.py b/mlir/test/Unit/lit.cfg.py
new file mode 100644
index 00000000000..ea14853e71d
--- /dev/null
+++ b/mlir/test/Unit/lit.cfg.py
@@ -0,0 +1,42 @@
+# -*- Python -*-
+
+# Configuration file for the 'lit' test runner.
+
+import os
+import subprocess
+
+import lit.formats
+
+# name: The name of this test suite.
+config.name = 'MLIR-Unit'
+
+# suffixes: A list of file extensions to treat as test files.
+config.suffixes = []
+
+# is_early; Request to run this suite early.
+config.is_early = True
+
+# test_source_root: The root path where tests are located.
+# test_exec_root: The root path where tests should be run.
+config.test_exec_root = os.path.join(config.mlir_obj_root, 'unittests')
+config.test_source_root = config.test_exec_root
+
+# testFormat: The test format to use to interpret tests.
+config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')
+
+# Propagate the temp directory. Windows requires this because it uses \Windows\
+# if none of these are present.
+if 'TMP' in os.environ:
+ config.environment['TMP'] = os.environ['TMP']
+if 'TEMP' in os.environ:
+ config.environment['TEMP'] = os.environ['TEMP']
+
+# Propagate HOME as it can be used to override incorrect homedir in passwd
+# that causes the tests to fail.
+if 'HOME' in os.environ:
+ config.environment['HOME'] = os.environ['HOME']
+
+# Propagate path to symbolizer for ASan/MSan.
+for symbolizer in ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH']:
+ if symbolizer in os.environ:
+ config.environment[symbolizer] = os.environ[symbolizer]
diff --git a/mlir/test/Unit/lit.site.cfg.py.in b/mlir/test/Unit/lit.site.cfg.py.in
new file mode 100644
index 00000000000..a9464bbc20c
--- /dev/null
+++ b/mlir/test/Unit/lit.site.cfg.py.in
@@ -0,0 +1,26 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+import sys
+
+config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.llvm_build_mode = "@LLVM_BUILD_MODE@"
+config.enable_shared = @ENABLE_SHARED@
+config.shlibdir = "@SHLIBDIR@"
+config.mlir_src_root = "@MLIR_SOURCE_DIR@"
+config.mlir_obj_root = "@MLIR_BINARY_DIR@"
+config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
+
+# Support substitution of the tools_dir and build_mode with user parameters.
+# This is used when we can't determine the tool dir at configuration time.
+try:
+ config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
+ config.llvm_build_mode = config.llvm_build_mode % lit_config.params
+except KeyError:
+ e = sys.exc_info()[1]
+ key, = e.args
+ lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+
+# Let the main config do the real work.
+lit_config.load_config(config, "@MLIR_SOURCE_DIR@/test/Unit/lit.cfg.py")
OpenPOWER on IntegriCloud