diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/breakpoint')
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. |