aboutsummaryrefslogtreecommitdiff
path: root/debuginfo-tests
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-11-10 20:57:57 +0000
committerZachary Turner <zturner@google.com>2017-11-10 20:57:57 +0000
commit0f2ce11df7288c4cdae0db2f7211ec41446e6c22 (patch)
treedcb05a278762dcb31288cbbca159cbfdf9c6b44b /debuginfo-tests
parentf59d0715b1581d627eab52e03f81dcb6c4f9c008 (diff)
[debuginfo-tests] Make debuginfo-tests work in a standard configuration.
Previously, debuginfo-tests was expected to be checked out into clang/test and then the tests would automatically run as part of check-clang. This is not a standard workflow for handling external projects, and it brings with it some serious drawbacks such as the inability to depend on things other than clang, which we will need going forward. The goal of this patch is to migrate towards a more standard workflow. To ease the transition for build bot maintainers, this patch tries not to break the existing workflow, but instead simply deprecate it to give maintainers a chance to update the build infrastructure. Differential Revision: https://reviews.llvm.org/D39605 llvm-svn: 317925
Diffstat (limited to 'debuginfo-tests')
-rw-r--r--debuginfo-tests/CMakeLists.txt36
-rw-r--r--debuginfo-tests/lit.cfg.py57
-rw-r--r--debuginfo-tests/lit.site.cfg.py.in25
-rw-r--r--debuginfo-tests/tests/aggregate-indirect-arg.cpp (renamed from debuginfo-tests/aggregate-indirect-arg.cpp)2
-rw-r--r--debuginfo-tests/tests/asan-blocks.c (renamed from debuginfo-tests/asan-blocks.c)0
-rw-r--r--debuginfo-tests/tests/asan.c (renamed from debuginfo-tests/asan.c)0
-rw-r--r--debuginfo-tests/tests/block_var.m (renamed from debuginfo-tests/block_var.m)2
-rw-r--r--debuginfo-tests/tests/blocks.m (renamed from debuginfo-tests/blocks.m)8
-rw-r--r--debuginfo-tests/tests/ctor.cpp (renamed from debuginfo-tests/ctor.cpp)4
-rw-r--r--debuginfo-tests/tests/dbg-arg.c (renamed from debuginfo-tests/dbg-arg.c)0
-rw-r--r--debuginfo-tests/tests/foreach.m (renamed from debuginfo-tests/foreach.m)4
-rw-r--r--debuginfo-tests/tests/forward-declare-class.cpp (renamed from debuginfo-tests/forward-declare-class.cpp)0
-rw-r--r--debuginfo-tests/tests/lit.local.cfg (renamed from debuginfo-tests/lit.local.cfg)0
-rw-r--r--debuginfo-tests/tests/llgdb.py (renamed from debuginfo-tests/llgdb.py)0
-rw-r--r--debuginfo-tests/tests/nested-struct.cpp (renamed from debuginfo-tests/nested-struct.cpp)0
-rw-r--r--debuginfo-tests/tests/nrvo-string.cpp (renamed from debuginfo-tests/nrvo-string.cpp)0
-rw-r--r--debuginfo-tests/tests/safestack.c (renamed from debuginfo-tests/safestack.c)0
-rw-r--r--debuginfo-tests/tests/sret.cpp (renamed from debuginfo-tests/sret.cpp)10
-rw-r--r--debuginfo-tests/tests/stack-var.c (renamed from debuginfo-tests/stack-var.c)0
-rw-r--r--debuginfo-tests/tests/static-member-2.cpp (renamed from debuginfo-tests/static-member-2.cpp)0
-rw-r--r--debuginfo-tests/tests/static-member.cpp (renamed from debuginfo-tests/static-member.cpp)0
-rw-r--r--debuginfo-tests/tests/vla.c (renamed from debuginfo-tests/vla.c)2
22 files changed, 134 insertions, 16 deletions
diff --git a/debuginfo-tests/CMakeLists.txt b/debuginfo-tests/CMakeLists.txt
new file mode 100644
index 000000000000..60a467fec851
--- /dev/null
+++ b/debuginfo-tests/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Debug Info tests. These tests invoke clang to generate programs with
+# various types of debug info, and then run those programs under a debugger
+# such as GDB or LLDB to verify the results.
+
+set(DEBUGINFO_TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(DEBUGINFO_TESTS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+set(DEBUGINFO_TEST_DEPS
+ clang
+ llvm-config
+ FileCheck
+ count
+ not
+ )
+
+get_target_property(CLANG_SOURCE_DIR clang SOURCE_DIR)
+
+if (TARGET lld)
+ set(DEBUGINFO_TESTS_HAS_LLD 1)
+ list(APPEND DEBUGINFO_TEST_DEPS lld)
+ get_target_property(LLD_SOURCE_DIR lld SOURCE_DIR)
+endif()
+
+configure_lit_site_cfg(
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+ MAIN_CONFIG
+ ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
+ )
+
+add_lit_testsuite(check-debuginfo "Running debug info integration tests"
+ ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${DEBUGINFO_TEST_DEPS}
+ )
+
+set_target_properties(check-debuginfo PROPERTIES FOLDER "Debug info tests") \ No newline at end of file
diff --git a/debuginfo-tests/lit.cfg.py b/debuginfo-tests/lit.cfg.py
new file mode 100644
index 000000000000..b56aa42d00c7
--- /dev/null
+++ b/debuginfo-tests/lit.cfg.py
@@ -0,0 +1,57 @@
+# -*- 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, 'tests')
+
+# 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()
+
+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.llvm_src_root, 'utils', 'test_debuginfo.pl')),
+]
+
+llvm_config.add_tool_substitutions(tools, tool_dirs)
diff --git a/debuginfo-tests/lit.site.cfg.py.in b/debuginfo-tests/lit.site.cfg.py.in
new file mode 100644
index 000000000000..8c4481a9f949
--- /dev/null
+++ b/debuginfo-tests/lit.site.cfg.py.in
@@ -0,0 +1,25 @@
+@LIT_SITE_CFG_IN_HEADER@
+
+import lit.util
+
+config.test_exec_root = "@CMAKE_BINARY_DIR@"
+
+config.llvm_src_root = "@LLVM_SOURCE_DIR@"
+config.llvm_obj_root = "@LLVM_BINARY_DIR@"
+config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
+config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
+config.llvm_shlib_dir = "@SHLIBDIR@"
+config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"
+config.debuginfo_tests_obj_root = "@DEBUGINFO_TESTS_BINARY_DIR@"
+config.debuginfo_tests_src_root = "@DEBUGINFO_TESTS_SOURCE_DIR@"
+config.has_lld = lit.util.pythonize_bool("@DEBUGINFO_TESTS_HAS_LLD@")
+config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.target_triple = "@TARGET_TRIPLE@"
+config.host_arch = "@HOST_ARCH@"
+
+config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
+
+@LIT_SITE_CFG_IN_FOOTER@
+
+# Let the main config do the real work.
+lit_config.load_config(config, "@DEBUGINFO_TESTS_SOURCE_DIR@/lit.cfg.py")
diff --git a/debuginfo-tests/aggregate-indirect-arg.cpp b/debuginfo-tests/tests/aggregate-indirect-arg.cpp
index 86c7caf96184..eb2fd665cf61 100644
--- a/debuginfo-tests/aggregate-indirect-arg.cpp
+++ b/debuginfo-tests/tests/aggregate-indirect-arg.cpp
@@ -1,6 +1,6 @@
// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
-// RUN: %test_debuginfo %s %t.out
+// RUN: %test_debuginfo %s %t.out
// Radar 8945514
// DEBUGGER: break 22
// DEBUGGER: r
diff --git a/debuginfo-tests/asan-blocks.c b/debuginfo-tests/tests/asan-blocks.c
index b919a291eba2..b919a291eba2 100644
--- a/debuginfo-tests/asan-blocks.c
+++ b/debuginfo-tests/tests/asan-blocks.c
diff --git a/debuginfo-tests/asan.c b/debuginfo-tests/tests/asan.c
index a2df75457224..a2df75457224 100644
--- a/debuginfo-tests/asan.c
+++ b/debuginfo-tests/tests/asan.c
diff --git a/debuginfo-tests/block_var.m b/debuginfo-tests/tests/block_var.m
index 7ec786f17987..32862172c570 100644
--- a/debuginfo-tests/block_var.m
+++ b/debuginfo-tests/tests/block_var.m
@@ -1,6 +1,6 @@
// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation
-// RUN: %test_debuginfo %s %t.out
+// RUN: %test_debuginfo %s %t.out
// REQUIRES: system-darwin
diff --git a/debuginfo-tests/blocks.m b/debuginfo-tests/tests/blocks.m
index 8e5a21213200..12c99774a314 100644
--- a/debuginfo-tests/blocks.m
+++ b/debuginfo-tests/tests/blocks.m
@@ -1,6 +1,6 @@
// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation
-// RUN: %test_debuginfo %s %t.out
+// RUN: %test_debuginfo %s %t.out
// REQUIRES: system-darwin
// Radar 9279956
@@ -24,9 +24,9 @@ extern void foo(void(^)(void));
int master = 0;
__block int m2 = 0;
__block int dbTransaction = 0;
- int (^x)(void) = ^(void) { (void) self;
- (void) master;
- (void) dbTransaction;
+ int (^x)(void) = ^(void) { (void) self;
+ (void) master;
+ (void) dbTransaction;
m2++;
return m2;
};
diff --git a/debuginfo-tests/ctor.cpp b/debuginfo-tests/tests/ctor.cpp
index 92cdbcd7e0b1..364401a2d5cc 100644
--- a/debuginfo-tests/ctor.cpp
+++ b/debuginfo-tests/tests/ctor.cpp
@@ -1,12 +1,12 @@
// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
-// RUN: %test_debuginfo %s %t.out
+// RUN: %test_debuginfo %s %t.out
// DEBUGGER: break 14
// DEBUGGER: r
// DEBUGGER: p *this
-// CHECK-NEXT-NOT: Cannot access memory at address
+// CHECK-NEXT-NOT: Cannot access memory at address
class A {
public:
diff --git a/debuginfo-tests/dbg-arg.c b/debuginfo-tests/tests/dbg-arg.c
index a65dc910b8bc..a65dc910b8bc 100644
--- a/debuginfo-tests/dbg-arg.c
+++ b/debuginfo-tests/tests/dbg-arg.c
diff --git a/debuginfo-tests/foreach.m b/debuginfo-tests/tests/foreach.m
index 2e3c312c877c..ccdc2827fd10 100644
--- a/debuginfo-tests/foreach.m
+++ b/debuginfo-tests/tests/foreach.m
@@ -1,6 +1,6 @@
// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation
-// RUN: %test_debuginfo %s %t.out
+// RUN: %test_debuginfo %s %t.out
//
// REQUIRES: system-darwin
// Radar 8757124
@@ -19,7 +19,7 @@ int main (int argc, const char * argv[]) {
for (NSString *thing in things) {
NSLog (@"%@", thing);
}
-
+
things = [NSArray arrayWithObjects:@"aaa", @"bbb", @"ccc" , nil];
for (NSString *thing in things) {
NSLog (@"%@", thing);
diff --git a/debuginfo-tests/forward-declare-class.cpp b/debuginfo-tests/tests/forward-declare-class.cpp
index 132420009bd1..132420009bd1 100644
--- a/debuginfo-tests/forward-declare-class.cpp
+++ b/debuginfo-tests/tests/forward-declare-class.cpp
diff --git a/debuginfo-tests/lit.local.cfg b/debuginfo-tests/tests/lit.local.cfg
index ce0175cf7f98..ce0175cf7f98 100644
--- a/debuginfo-tests/lit.local.cfg
+++ b/debuginfo-tests/tests/lit.local.cfg
diff --git a/debuginfo-tests/llgdb.py b/debuginfo-tests/tests/llgdb.py
index 7d4fdd64fd1b..7d4fdd64fd1b 100644
--- a/debuginfo-tests/llgdb.py
+++ b/debuginfo-tests/tests/llgdb.py
diff --git a/debuginfo-tests/nested-struct.cpp b/debuginfo-tests/tests/nested-struct.cpp
index 7533e6a81518..7533e6a81518 100644
--- a/debuginfo-tests/nested-struct.cpp
+++ b/debuginfo-tests/tests/nested-struct.cpp
diff --git a/debuginfo-tests/nrvo-string.cpp b/debuginfo-tests/tests/nrvo-string.cpp
index 18acebb0e6dd..18acebb0e6dd 100644
--- a/debuginfo-tests/nrvo-string.cpp
+++ b/debuginfo-tests/tests/nrvo-string.cpp
diff --git a/debuginfo-tests/safestack.c b/debuginfo-tests/tests/safestack.c
index 01c5f7ede925..01c5f7ede925 100644
--- a/debuginfo-tests/safestack.c
+++ b/debuginfo-tests/tests/safestack.c
diff --git a/debuginfo-tests/sret.cpp b/debuginfo-tests/tests/sret.cpp
index 3c304e2f04a5..640015fab40b 100644
--- a/debuginfo-tests/sret.cpp
+++ b/debuginfo-tests/tests/sret.cpp
@@ -1,6 +1,6 @@
// RUN: %clangxx %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
// RUN: %clangxx %target_itanium_abi_host_triple %t.o -o %t.out
-// RUN: %test_debuginfo %s %t.out
+// RUN: %test_debuginfo %s %t.out
// Radar 8775834
// DEBUGGER: break 62
// DEBUGGER: r
@@ -24,7 +24,7 @@ protected:
int m_int;
};
-A::A (int i) :
+A::A (int i) :
m_int(i)
{
}
@@ -50,11 +50,11 @@ class B
{
public:
B () {}
-
+
A AInstance();
};
-A
+A
B::AInstance()
{
A a(12);
@@ -65,7 +65,7 @@ int main (int argc, char const *argv[])
{
B b;
int return_val = b.AInstance().get_int();
-
+
A a(b.AInstance());
return return_val;
}
diff --git a/debuginfo-tests/stack-var.c b/debuginfo-tests/tests/stack-var.c
index 372139c59b0c..372139c59b0c 100644
--- a/debuginfo-tests/stack-var.c
+++ b/debuginfo-tests/tests/stack-var.c
diff --git a/debuginfo-tests/static-member-2.cpp b/debuginfo-tests/tests/static-member-2.cpp
index 4edb2b060f1a..4edb2b060f1a 100644
--- a/debuginfo-tests/static-member-2.cpp
+++ b/debuginfo-tests/tests/static-member-2.cpp
diff --git a/debuginfo-tests/static-member.cpp b/debuginfo-tests/tests/static-member.cpp
index 1d8ad62c5b88..1d8ad62c5b88 100644
--- a/debuginfo-tests/static-member.cpp
+++ b/debuginfo-tests/tests/static-member.cpp
diff --git a/debuginfo-tests/vla.c b/debuginfo-tests/tests/vla.c
index 9c8e27715332..e6ea1ef4ac20 100644
--- a/debuginfo-tests/vla.c
+++ b/debuginfo-tests/tests/vla.c
@@ -1,7 +1,7 @@
// This test case verifies the debug location for variable-length arrays.
// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out
-// RUN: %test_debuginfo %s %t.out
+// RUN: %test_debuginfo %s %t.out
//
// DEBUGGER: break 18
// DEBUGGER: r