From 175a3df9c7afbde0b3aa75dbe06472557a523819 Mon Sep 17 00:00:00 2001 From: Stephen Neuendorffer Date: Wed, 22 Apr 2020 10:52:07 -0700 Subject: [PATCH] [MLIR] Add a tests for out of tree dialect example. This attempts to ensure that out of tree usage remains stable. Differential Revision: https://reviews.llvm.org/D78656 --- mlir/test/Examples/standalone/lit.local.cfg | 3 +++ mlir/test/Examples/standalone/test.toy | 4 ++++ mlir/test/lit.cfg.py | 1 + mlir/test/lit.site.cfg.py.in | 1 + 4 files changed, 9 insertions(+) create mode 100644 mlir/test/Examples/standalone/lit.local.cfg create mode 100644 mlir/test/Examples/standalone/test.toy diff --git a/mlir/test/Examples/standalone/lit.local.cfg b/mlir/test/Examples/standalone/lit.local.cfg new file mode 100644 index 0000000..481b809 --- /dev/null +++ b/mlir/test/Examples/standalone/lit.local.cfg @@ -0,0 +1,3 @@ +config.substitutions.append(("%cmake", config.host_cmake)) +config.substitutions.append(("%host_cxx", config.host_cxx)) +config.substitutions.append(("%host_cc", config.host_cc)) diff --git a/mlir/test/Examples/standalone/test.toy b/mlir/test/Examples/standalone/test.toy new file mode 100644 index 0000000..4f9ba5c --- /dev/null +++ b/mlir/test/Examples/standalone/test.toy @@ -0,0 +1,4 @@ +# RUN: %cmake %mlir_src_root/examples/standalone -DCMAKE_CXX_COMPILER=%host_cxx -DCMAKE_C_COMPILER=%host_cc -DMLIR_DIR=%llvm_lib_dir/cmake/mlir ; %cmake --build . --target check-standalone-opt | tee %t | FileCheck %s + +# CHECK: Expected Passes: 1 +# UNSUPPORTED: windows, android diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py index 65f8031..e78c828 100644 --- a/mlir/test/lit.cfg.py +++ b/mlir/test/lit.cfg.py @@ -31,6 +31,7 @@ config.test_exec_root = os.path.join(config.mlir_obj_root, 'test') config.substitutions.append(('%PATH%', config.environment['PATH'])) config.substitutions.append(('%shlibext', config.llvm_shlib_ext)) +config.substitutions.append(("%mlir_src_root", config.mlir_src_root)) llvm_config.with_system_environment( ['HOME', 'INCLUDE', 'LIB', 'TMP', 'TEMP']) diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in index dafb1c9..dc6286a 100644 --- a/mlir/test/lit.site.cfg.py.in +++ b/mlir/test/lit.site.cfg.py.in @@ -23,6 +23,7 @@ config.llvm_bindings = "@LLVM_BINDINGS@".split(' ') config.host_os = "@HOST_OS@" config.host_cc = "@HOST_CC@" config.host_cxx = "@HOST_CXX@" +config.host_cmake = "@CMAKE_COMMAND@" # Note: ldflags can contain double-quoted paths, so must use single quotes here. config.host_ldflags = '@HOST_LDFLAGS@' config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" -- 2.7.4