summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-01-30 18:29:16 +0000
committerAdrian Prantl <aprantl@apple.com>2018-01-30 18:29:16 +0000
commit5ec76fe720e43a9196d3437e1ff448668bf7db6d (patch)
tree49d569898f53e6887e7167b4470b5e672ddf1541 /lldb/packages/Python/lldbsuite/test/functionalities/breakpoint
parent1d8e5ea2500728cfc751ce055dd75e5084584e9c (diff)
downloadbcm5719-llvm-5ec76fe720e43a9196d3437e1ff448668bf7db6d.tar.gz
bcm5719-llvm-5ec76fe720e43a9196d3437e1ff448668bf7db6d.zip
Compile the LLDB tests out-of-tree.
This patch is the result of a discussion on lldb-dev, see http://lists.llvm.org/pipermail/lldb-dev/2018-January/013111.html for background. For each test (should be eventually: each test configuration) a separate build directory is created and we execute make VPATH=$srcdir/path/to/test -C $builddir/path/to/test -f $srcdir/path/to/test/Makefile -I $srcdir/path/to/test In order to make this work all LLDB tests need to be updated to find the executable in the test build directory, since CWD still points at the test's source directory, which is a requirement for unittest2. Although we have done extensive testing, I'm expecting that this first attempt will break a few bots. Please DO NOT HESITATE TO REVERT this patch in order to get the bots green again. We will likely have to iterate on this some more. Differential Revision: https://reviews.llvm.org/D42281 llvm-svn: 323803
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/breakpoint')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py5
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py8
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py2
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py2
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py5
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile9
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py16
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py10
8 files changed, 32 insertions, 25 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
index 6f06ca7770c..f3b9a637360 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
@@ -30,9 +30,8 @@ class BadAddressBreakpointTestCase(TestBase):
def address_breakpoints(self):
"""Test that breakpoints set on a bad address say they are bad."""
-
- (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self,
- "Set a breakpoint here", lldb.SBFileSpec("main.c"))
+ (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+ self, "Set a breakpoint here", lldb.SBFileSpec("main.c"))
# Now see if we can read from 0. If I can't do that, I don't have a good way to know
# what an illegal address is...
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
index 97611a27dba..8d174580f29 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
@@ -44,16 +44,16 @@ class BreakpointCaseSensitivityTestCase(TestBase):
# Create a target by the debugger.
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- cwd = os.getcwd()
+ srcdir = self.getSourceDir()
# try both BreakpointCreateByLocation and BreakpointCreateBySourceRegex
for regex in [False, True]:
# should always hit
self.check_breakpoint('main.c', regex, True)
# should always hit
- self.check_breakpoint(os.path.join(cwd, 'main.c'), regex, True)
+ self.check_breakpoint(os.path.join(srcdir, 'main.c'), regex, True)
# different case for directory
- self.check_breakpoint(os.path.join(cwd.upper(), 'main.c'),
+ self.check_breakpoint(os.path.join(srcdir.upper(), 'main.c'),
regex,
case_insensitive)
# different case for file
@@ -61,7 +61,7 @@ class BreakpointCaseSensitivityTestCase(TestBase):
regex,
case_insensitive)
# different case for both
- self.check_breakpoint(os.path.join(cwd.upper(), 'Main.c'),
+ self.check_breakpoint(os.path.join(srcdir.upper(), 'Main.c'),
regex,
case_insensitive)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
index 059c9232e4c..d064b75b91c 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
@@ -54,7 +54,7 @@ class RegexpBreakCommandTestCase(TestBase):
num_locations=1)
# Check breakpoint with full file path.
- full_path = os.path.join(os.getcwd(), self.source)
+ full_path = os.path.join(self.getSourceDir(), self.source)
break_results = lldbutil.run_break_set_command(
self, "b %s:%d" % (full_path, self.line))
lldbutil.check_breakpoint_result(
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
index 8130679c0f6..8b5352866c2 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
@@ -63,7 +63,7 @@ class BreakpointNames(TestBase):
# Create a targets we are making breakpoint in and copying to:
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- self.main_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "main.c"))
+ self.main_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "main.c"))
def check_name_in_target(self, bkpt_name):
name_list = lldb.SBStringList()
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
index 958a17d83c9..7603bd90ffc 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
@@ -15,7 +15,6 @@ class BreakpointSetRestart(TestBase):
def test_breakpoint_set_restart(self):
self.build()
- cwd = os.getcwd()
exe = self.getBuildArtifact("a.out")
target = self.dbg.CreateTarget(exe)
@@ -33,9 +32,7 @@ class BreakpointSetRestart(TestBase):
break
bp = target.BreakpointCreateBySourceRegex(
- self.BREAKPOINT_TEXT, lldb.SBFileSpec(
- os.path.join(
- cwd, 'main.cpp')))
+ self.BREAKPOINT_TEXT, lldb.SBFileSpec('main.cpp'))
self.assertTrue(
bp.IsValid() and bp.GetNumLocations() == 1,
VALID_BREAKPOINT)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile
index 0ac34a186b2..2d7f20f43fe 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile
@@ -1,7 +1,14 @@
LEVEL = ../../../make
-CXX_SOURCES := main.cpp
+CXX_SOURCES := relative.cpp
EXE := CompDirSymLink
include $(LEVEL)/Makefile.rules
+
+# Force relative filenames by copying it into the build directory.
+relative.cpp: main.cpp
+ cp -f $< $@
+
+clean::
+ rm -rf relative.cpp
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
index e4672fbbf1b..86ef0d72b58 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
@@ -13,7 +13,7 @@ from lldbsuite.test import lldbutil
_EXE_NAME = 'CompDirSymLink' # Must match Makefile
-_SRC_FILE = 'main.cpp'
+_SRC_FILE = 'relative.cpp'
_COMP_DIR_SYM_LINK_PROP = 'plugin.symbol-file.dwarf.comp-dir-symlink-paths'
@@ -25,8 +25,11 @@ class CompDirSymLinkTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside main().
- self.line = line_number(_SRC_FILE, '// Set break point at this line.')
- self.src_path = os.path.join(os.getcwd(), _SRC_FILE)
+ self.line = line_number(
+ os.path.join(self.getSourceDir(), "main.cpp"),
+ '// Set break point at this line.')
+ self.src_path = self.getBuildArtifact(_SRC_FILE)
+
@skipIf(hostoslist=["windows"])
def test_symlink_paths_set(self):
@@ -39,6 +42,7 @@ class CompDirSymLinkTestCase(TestBase):
@skipIf(hostoslist=no_match(["linux"]))
def test_symlink_paths_set_procselfcwd(self):
+ os.chdir(self.getBuildDir())
pwd_symlink = '/proc/self/cwd'
self.doBuild(pwd_symlink)
self.runCmd(
@@ -59,15 +63,15 @@ class CompDirSymLinkTestCase(TestBase):
self.line)
def create_src_symlink(self):
- pwd_symlink = os.path.join(os.getcwd(), 'pwd_symlink')
+ pwd_symlink = self.getBuildArtifact('pwd_symlink')
if os.path.exists(pwd_symlink):
os.unlink(pwd_symlink)
- os.symlink(os.getcwd(), pwd_symlink)
+ os.symlink(self.getBuildDir(), pwd_symlink)
self.addTearDownHook(lambda: os.remove(pwd_symlink))
return pwd_symlink
def doBuild(self, pwd_symlink):
self.build(None, None, {'PWD': pwd_symlink}, True)
- exe = os.path.join(os.getcwd(), _EXE_NAME)
+ exe = self.getBuildArtifact(_EXE_NAME)
self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
index 34ce8868b8f..5c3da17c254 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
@@ -73,7 +73,7 @@ class BreakpointSerialization(TestBase):
# Call super's setUp().
TestBase.setUp(self)
- self.bkpts_file_path = os.path.join(os.getcwd(), "breakpoints.json")
+ self.bkpts_file_path = self.getBuildArtifact("breakpoints.json")
self.bkpts_file_spec = lldb.SBFileSpec(self.bkpts_file_path)
def check_equivalence(self, source_bps, do_write = True):
@@ -119,7 +119,7 @@ class BreakpointSerialization(TestBase):
empty_module_list = lldb.SBFileSpecList()
empty_cu_list = lldb.SBFileSpecList()
- blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c"))
# It isn't actually important for these purposes that these breakpoint
# actually have locations.
@@ -147,7 +147,7 @@ class BreakpointSerialization(TestBase):
cu_list.Append(lldb.SBFileSpec("AnotherCU.c"))
cu_list.Append(lldb.SBFileSpec("ThirdCU.c"))
- blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c"))
# It isn't actually important for these purposes that these breakpoint
# actually have locations.
@@ -174,7 +174,7 @@ class BreakpointSerialization(TestBase):
empty_module_list = lldb.SBFileSpecList()
empty_cu_list = lldb.SBFileSpecList()
- blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c"))
# It isn't actually important for these purposes that these breakpoint
# actually have locations.
@@ -218,7 +218,7 @@ class BreakpointSerialization(TestBase):
empty_module_list = lldb.SBFileSpecList()
empty_cu_list = lldb.SBFileSpecList()
- blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c"))
# It isn't actually important for these purposes that these breakpoint
# actually have locations.
OpenPOWER on IntegriCloud