[debuginfo-tests] Support moving debuginfo-tests to llvm/projects
Summary:
Add cmake and lit files needed to run these tests as an
external project. Also, copy test_debuginfo.pl from llvm/utils since
it's only used here. The copy in llvm/utils must be maintained as
long as bots continue to include debuginfo-tests in clang/test.
This patch depends on clang patch https://reviews.llvm.org/D41055.
Reviewers: zturner, aprantl
Reviewed By: aprantl
Subscribers: mgorny, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D40971
llvm-svn: 320495
diff --git a/debuginfo-tests/lit.cfg.py b/debuginfo-tests/lit.cfg.py
new file mode 100644
index 0000000..cd20eaa
--- /dev/null
+++ b/debuginfo-tests/lit.cfg.py
@@ -0,0 +1,63 @@
+# -*- Python -*-
+
+import os
+import platform
+import re
+import subprocess
+import tempfile
+
+import lit.formats
+import lit.util
+
+from lit.llvm import llvm_config
+from lit.llvm.subst import ToolSubst
+from lit.llvm.subst import FindTool
+
+# Configuration file for the 'lit' test runner.
+
+# name: The name of this test suite.
+config.name = 'debuginfo-tests'
+
+# testFormat: The test format to use to interpret tests.
+#
+# For now we require '&&' between commands, until they get globally killed and
+# the test runner updated.
+config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
+
+# suffixes: A list of file extensions to treat as test files.
+config.suffixes = ['.c', '.cpp', '.m']
+
+# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
+# subdirectories contain auxiliary inputs for various tests in their parent
+# directories.
+config.excludes = ['Inputs']
+
+# test_source_root: The root path where tests are located.
+config.test_source_root = os.path.join(config.debuginfo_tests_src_root)
+
+# test_exec_root: The root path where tests should be run.
+config.test_exec_root = config.debuginfo_tests_obj_root
+
+llvm_config.use_default_substitutions()
+
+# clang_src_dir is not used by these tests, but is required by
+# use_clang(), so set it to "".
+if not hasattr(config, 'clang_src_dir'):
+ config.clang_src_dir = ""
+llvm_config.use_clang()
+
+if config.llvm_use_sanitizer:
+ # Propagate path to symbolizer for ASan/MSan.
+ llvm_config.with_system_environment(
+ ['ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'])
+
+tool_dirs = [config.llvm_tools_dir]
+
+tools = [
+ ToolSubst('%test_debuginfo', command=os.path.join(
+ config.debuginfo_tests_src_root, 'test_debuginfo.pl')),
+]
+
+llvm_config.add_tool_substitutions(tools, tool_dirs)
+
+lit.util.usePlatformSdkOnDarwin(config, lit_config)