diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
175 files changed, 726 insertions, 617 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py b/lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py index 5acbf9c14c3..20fd3030721 100644 --- a/lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py +++ b/lldb/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py @@ -21,7 +21,6 @@ class SBDirCheckerCase(TestBase): def setUp(self): TestBase.setUp(self) self.source = 'main.cpp' - self.exe_name = self.getBuildArtifact("a.out") self.generateSource(self.source) @skipIfNoSBHeaders @@ -35,16 +34,19 @@ class SBDirCheckerCase(TestBase): self.skipTest( "LLDB is 64-bit and cannot be linked to 32-bit test program.") - self.buildDriver(self.source, self.exe_name) - self.sanity_check_executable(self.exe_name) + exe_name = self.getBuildArtifact("a.out") + self.buildDriver(self.source, exe_name) + self.sanity_check_executable(exe_name) def sanity_check_executable(self, exe_name): """Sanity check executable compiled from the auto-generated program.""" + exe_name = self.getBuildArtifact("a.out") exe = self.getBuildArtifact(exe_name) self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET) + # This test uses a generated source file, so it's in the build directory. self.line_to_break = line_number( - self.source, '// Set breakpoint here.') + self.getBuildArtifact(self.source), '// Set breakpoint here.') env_cmd = "settings set target.env-vars %s=%s" % ( self.dylibPath, self.getLLDBLibraryEnvVal()) diff --git a/lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py b/lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py index dc1a0d19f83..d9ea974d3ab 100644 --- a/lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py +++ b/lldb/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py @@ -32,12 +32,12 @@ class TestMultipleSimultaneousDebuggers(TestBase): def test_multiple_debuggers(self): env = {self.dylibPath: self.getLLDBLibraryEnvVal()} - self.driver_exe = os.path.join(os.getcwd(), "multi-process-driver") + self.driver_exe = self.getBuildArtifact("multi-process-driver") self.buildDriver('multi-process-driver.cpp', self.driver_exe) self.addTearDownHook(lambda: os.remove(self.driver_exe)) self.signBinary(self.driver_exe) - self.inferior_exe = os.path.join(os.getcwd(), "testprog") + self.inferior_exe = self.getBuildArtifact("testprog") self.buildDriver('testprog.cpp', self.inferior_exe) self.addTearDownHook(lambda: os.remove(self.inferior_exe)) diff --git a/lldb/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py b/lldb/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py index decb3fd4f0c..f4e166955ac 100644 --- a/lldb/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py +++ b/lldb/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py @@ -26,7 +26,7 @@ class TestMultipleTargets(TestBase): def test_multiple_targets(self): env = {self.dylibPath: self.getLLDBLibraryEnvVal()} - self.driver_exe = os.path.join(os.getcwd(), "multi-target") + self.driver_exe = self.getBuildArtifact("multi-target") self.buildDriver('main.cpp', self.driver_exe) self.addTearDownHook(lambda: os.remove(self.driver_exe)) self.signBinary(self.driver_exe) diff --git a/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py b/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py index 767bab79e81..5789c44a2fc 100644 --- a/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py +++ b/lldb/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py @@ -89,14 +89,16 @@ class SBBreakpointCallbackCase(TestBase): self.inferior = 'inferior_program' self.buildProgram('inferior.cpp', self.inferior) - self.addTearDownHook(lambda: os.remove(self.inferior)) + self.addTearDownHook(lambda: + os.remove(self.getBuildArtifact(self.inferior))) self.buildDriver(sources, test_name) - self.addTearDownHook(lambda: os.remove(test_name)) + self.addTearDownHook(lambda: + os.remove(self.getBuildArtifact(test_name))) - test_exe = os.path.join(os.getcwd(), test_name) + test_exe = self.getBuildArtifact(test_name) self.signBinary(test_exe) - exe = [test_exe, self.inferior] + exe = [test_exe, self.getBuildArtifact(self.inferior)] env = {self.dylibPath: self.getLLDBLibraryEnvVal()} if self.TraceOn(): diff --git a/lldb/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py b/lldb/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py index 4ddda525537..8e9244f3a3e 100644 --- a/lldb/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py +++ b/lldb/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py @@ -19,8 +19,7 @@ class ARMEmulationTestCase(TestBase): @no_debug_info_test def test_thumb_emulations(self): - current_dir = os.getcwd() - test_dir = os.path.join(current_dir, "new-test-files") + test_dir = os.path.join(self.getSourceDir(), "new-test-files") files = os.listdir(test_dir) thumb_files = list() for f in files: @@ -33,8 +32,7 @@ class ARMEmulationTestCase(TestBase): @no_debug_info_test def test_arm_emulations(self): - current_dir = os.getcwd() - test_dir = os.path.join(current_dir, "new-test-files") + test_dir = os.path.join(self.getSourceDir(), "new-test-files") files = os.listdir(test_dir) arm_files = list() for f in files: diff --git a/lldb/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py b/lldb/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py index ebc128bd272..dcbd36cc138 100644 --- a/lldb/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py +++ b/lldb/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py @@ -94,7 +94,7 @@ class RepeatedExprsCase(BenchBase): def run_gdb_repeated_exprs(self, exe_name, count): import pexpect - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) # Set self.child_prompt, which is "(gdb) ". self.child_prompt = '(gdb) ' diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py index 25fb1b1b474..b9222dde7c9 100644 --- a/lldb/packages/Python/lldbsuite/test/configuration.py +++ b/lldb/packages/Python/lldbsuite/test/configuration.py @@ -107,6 +107,9 @@ lldb_platform_name = None lldb_platform_url = None lldb_platform_working_dir = None +# The base directory in which the tests are being built. +test_build_dir = None + # Parallel execution settings is_inferior_test_runner = False multiprocess_test_subdir = None diff --git a/lldb/packages/Python/lldbsuite/test/darwin_log.py b/lldb/packages/Python/lldbsuite/test/darwin_log.py index 9395bbd59ce..8756eca3016 100644 --- a/lldb/packages/Python/lldbsuite/test/darwin_log.py +++ b/lldb/packages/Python/lldbsuite/test/darwin_log.py @@ -162,7 +162,7 @@ class DarwinLogTestBase(lldbtest.TestBase): if enable_options is not None and len(enable_options) > 0: enable_cmd += ' ' + ' '.join(enable_options) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.run_lldb_to_breakpoint(exe, self.source, self.line, enable_command=enable_cmd, settings_commands=settings_commands) @@ -382,7 +382,7 @@ class DarwinLogEventBasedTestBase(lldbtest.TestBase): # self.runCmd("log enable lldb process") # Launch the process - doesn't stop at entry. - process = target.LaunchSimple(None, None, os.getcwd()) + process = target.LaunchSimple(None, None, self.getBuildDir()) self.assertIsNotNone(process, lldbtest.PROCESS_IS_VALID) # Keep track of whether we're tracing output. diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index f8bfec44236..5a2d44e2e0d 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -474,6 +474,8 @@ def parseOptionsAndInitTestdirs(): configuration.lldb_platform_url = args.lldb_platform_url if args.lldb_platform_working_dir: configuration.lldb_platform_working_dir = args.lldb_platform_working_dir + if args.test_build_dir: + configuration.test_build_dir = args.test_build_dir if args.event_add_entries and len(args.event_add_entries) > 0: entries = {} @@ -623,6 +625,12 @@ def setupSysPath(): os.environ["LLDB_TEST"] = scriptPath + # Set up the root build directory. + builddir = configuration.test_build_dir + if not configuration.test_build_dir: + raise Exception("test_build_dir is not set") + os.environ["LLDB_BUILD"] = os.path.abspath(configuration.test_build_dir) + # Set up the LLDB_SRC environment variable, so that the tests can locate # the LLDB source code. os.environ["LLDB_SRC"] = lldbsuite.lldb_root @@ -1186,6 +1194,11 @@ def run_suite(): configuration.lldb_platform_working_dir = None configuration.lldb_platform_url = None + # Set up the working directory. + # Note that it's not dotest's job to clean this directory. + try: os.makedirs(configuration.test_build_dir) + except: pass + target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2] checkLibcxxSupport() diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py index bc43a6fc04a..c2aa3b78411 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest_args.py +++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -159,6 +159,12 @@ def create_parser(): metavar='Codesigning identity', default='lldb_codesign', help='The codesigning identity to use') + group.add_argument( + '--build-dir', + dest='test_build_dir', + metavar='Test build directory', + default='lldb-test-build', + help='The root build directory for the tests. It will be removed before running.') # Configuration options group = parser.add_argument_group('Remote platform options') diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py b/lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py index 54709e26ecb..af216898cf7 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py @@ -31,7 +31,8 @@ class ExprCommandCallOverriddenMethod(TestBase): self.build() # Set breakpoint in main and run exe - self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact("a.out"), + CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True) diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py b/lldb/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py index f6938b1ea98..c1a1b375e15 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py @@ -11,23 +11,24 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -def enumerateJITFiles(): - return [f for f in os.listdir(os.getcwd()) if f.startswith("jit")] - -def countJITFiles(): - return len(enumerateJITFiles()) - -def cleanJITFiles(): - for j in enumerateJITFiles(): - os.remove(j) - return - class SaveJITObjectsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) + def enumerateJITFiles(self): + return [f for f in os.listdir(self.getBuildDir()) if f.startswith("jit")] + + def countJITFiles(self): + return len(self.enumerateJITFiles()) + + def cleanJITFiles(self): + for j in self.enumerateJITFiles(): + os.remove(j) + return + @expectedFailureAll(oslist=["windows"]) def test_save_jit_objects(self): self.build() + os.chdir(self.getBuildDir()) src_file = "main.c" src_file_spec = lldb.SBFileSpec(src_file) @@ -36,16 +37,17 @@ class SaveJITObjectsTestCase(TestBase): frame = thread.frames[0] - cleanJITFiles() + self.cleanJITFiles() frame.EvaluateExpression("(void*)malloc(0x1)") - self.assertTrue(countJITFiles() == 0, + self.assertTrue(self.countJITFiles() == 0, "No files emitted with save-jit-objects=false") self.runCmd("settings set target.save-jit-objects true") frame.EvaluateExpression("(void*)malloc(0x1)") - jit_files_count = countJITFiles() - cleanJITFiles() + jit_files_count = self.countJITFiles() + self.cleanJITFiles() self.assertTrue(jit_files_count != 0, "At least one file emitted with save-jit-objects=true") process.Kill() + os.chdir(self.getSourceDir()) diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/Makefile b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/Makefile index 48eec5c5d26..9e35242c72f 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/Makefile +++ b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/Makefile @@ -7,7 +7,7 @@ include $(LEVEL)/Makefile.rules a.out: dummy dummy: - $(MAKE) -f dummy.mk + $(MAKE) VPATH=$(VPATH) -I $(SRCDIR) -f $(SRCDIR)/dummy.mk clean:: - $(MAKE) -f dummy.mk clean + $(MAKE) VPATH=$(VPATH) -I $(SRCDIR) -f $(SRCDIR)/dummy.mk clean diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py index 590e2cf3676..1a8a619b0ed 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py @@ -45,7 +45,8 @@ class TopLevelExpressionsTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) def run_dummy(self): - self.runCmd("file dummy", CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact("dummy"), + CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( self, diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py b/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py index b348e72606a..ad87796766c 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py @@ -30,7 +30,7 @@ class AttachResumeTestCase(TestBase): def process_attach_continue_interrupt_detach(self): """Test attach/continue/interrupt/detach""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) popen = self.spawnSubprocess(exe) self.addTearDownHook(self.cleanupSubprocesses) 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. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py index 975ad32689b..cf1c448022b 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py @@ -30,9 +30,10 @@ class CommandScriptImmediateOutputTestCase (PExpectTest): @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139") def test_command_script_immediate_output_console(self): """Test that LLDB correctly allows scripted commands to set immediate output to the console.""" + self.makeBuildDir() self.launch(timeout=10) - script = os.path.join(os.getcwd(), 'custom_command.py') + script = os.path.join(self.getSourceDir(), 'custom_command.py') prompt = "\(lldb\) " self.sendline('command script import %s' % script, patterns=[prompt]) @@ -52,14 +53,15 @@ class CommandScriptImmediateOutputTestCase (PExpectTest): @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139") def test_command_script_immediate_output_file(self): """Test that LLDB correctly allows scripted commands to set immediate output to a file.""" + self.makeBuildDir() self.launch(timeout=10) - test_files = {os.path.join(os.getcwd(), 'read.txt'): 'r', - os.path.join(os.getcwd(), 'write.txt'): 'w', - os.path.join(os.getcwd(), 'append.txt'): 'a', - os.path.join(os.getcwd(), 'write_plus.txt'): 'w+', - os.path.join(os.getcwd(), 'read_plus.txt'): 'r+', - os.path.join(os.getcwd(), 'append_plus.txt'): 'a+'} + test_files = {self.getBuildArtifact('read.txt'): 'r', + self.getBuildArtifact('write.txt'): 'w', + self.getBuildArtifact('append.txt'): 'a', + self.getBuildArtifact('write_plus.txt'): 'w+', + self.getBuildArtifact('read_plus.txt'): 'r+', + self.getBuildArtifact('append_plus.txt'): 'a+'} starter_string = 'Starter Garbage\n' write_string = 'writing to file with mode: ' @@ -68,7 +70,7 @@ class CommandScriptImmediateOutputTestCase (PExpectTest): with open(path, 'w+') as init: init.write(starter_string) - script = os.path.join(os.getcwd(), 'custom_command.py') + script = os.path.join(self.getSourceDir(), 'custom_command.py') prompt = "\(lldb\) " self.sendline('command script import %s' % script, patterns=[prompt]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py b/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py index 61cd7d5aa1c..6cf486fe1f0 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py @@ -41,23 +41,23 @@ class ExecTestCase(TestBase): self.do_test(True) def do_test(self, skip_exec): + self.makeBuildDir() + exe = self.getBuildArtifact("a.out") if self.getArchitecture() == 'x86_64': - source = os.path.join(os.getcwd(), "main.cpp") - o_file = os.path.join(os.getcwd(), "main.o") + source = self.getSourcePath("main.cpp") + o_file = self.getBuildArtifact("main.o") execute_command( "'%s' -g -O0 -arch i386 -arch x86_64 '%s' -c -o '%s'" % (os.environ["CC"], source, o_file)) execute_command( - "'%s' -g -O0 -arch i386 -arch x86_64 '%s'" % - (os.environ["CC"], o_file)) + "'%s' -g -O0 -arch i386 -arch x86_64 '%s' -o '%s'" % + (os.environ["CC"], o_file, exe)) if self.debug_info != "dsym": dsym_path = self.getBuildArtifact("a.out.dSYM") execute_command("rm -rf '%s'" % (dsym_path)) else: self.build() - exe = self.getBuildArtifact("a.out") - # Create the target target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile index e1832fdefbe..c7c5ef40545 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile @@ -1,12 +1,14 @@ -all: clean - $(CC) -arch i386 -g -c a.c +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + +all: a.c clean + $(CC) -arch i386 -g -c $(SRCDIR)/a.c ar -q liba-i386.a a.o ranlib liba-i386.a - $(CC) -arch x86_64 -g -c a.c + $(CC) -arch x86_64 -g -c $(SRCDIR)/a.c ar -q liba-x86_64.a a.o ranlib liba-x86_64.a lipo -create -output liba.a liba-i386.a liba-x86_64.a - $(CC) -g -c main.c + $(CC) -g -c $(SRCDIR)/main.c $(CC) -o a.out main.o -L. -la clean: diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile index 089fc237b05..cb1af719ac3 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile @@ -6,7 +6,7 @@ C_SOURCES := somefunc.c include $(LEVEL)/Makefile.rules other-2.o: other-2.cpp - $(CXX) $(CFLAGS_NO_DEBUG) -c other-2.cpp + $(CXX) $(CFLAGS_NO_DEBUG) -c $(SRCDIR)/other-2.cpp somefunc.o: somefunc.c - $(CC) $(CFLAGS) -std=c99 -c somefunc.c
\ No newline at end of file + $(CC) $(CFLAGS) -std=c99 -c $(SRCDIR)/somefunc.c diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py index 498384be424..9b485b2235d 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py @@ -39,7 +39,7 @@ class LaunchWithShellExpandTestCase(TestBase): self.runCmd( "process launch -X true -w %s -- fi*.tx? () > <" % - (os.getcwd())) + (self.getSourceDir())) process = self.process() @@ -77,7 +77,7 @@ class LaunchWithShellExpandTestCase(TestBase): self.runCmd( 'process launch -X true -w %s -- "foo bar"' % - (os.getcwd())) + (self.getSourceDir())) process = self.process() @@ -99,7 +99,8 @@ class LaunchWithShellExpandTestCase(TestBase): self.runCmd("process kill") - self.runCmd('process launch -X true -w %s -- foo\ bar' % (os.getcwd())) + self.runCmd('process launch -X true -w %s -- foo\ bar' + % (self.getBuildDir())) process = self.process() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile index 9a954a201cf..0dd9eb41a40 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile @@ -7,11 +7,10 @@ CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules -.PHONY: a.out: lib_a lib_b lib_c lib_d hidden_lib_d install_name_tool lib_%: - $(MAKE) -f $*.mk + $(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/$*.mk install_name_tool: ifeq ($(OS),Darwin) @@ -20,11 +19,11 @@ endif hidden_lib_d: - $(MAKE) -C hidden + $(MAKE) VPATH=$(SRCDIR)/hidden -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean:: - $(MAKE) -f a.mk clean - $(MAKE) -f b.mk clean - $(MAKE) -f c.mk clean - $(MAKE) -f d.mk clean - $(MAKE) -C hidden clean + $(MAKE) -f $(SRCDIR)/a.mk clean + $(MAKE) -f $(SRCDIR)/b.mk clean + $(MAKE) -f $(SRCDIR)/c.mk clean + $(MAKE) -f $(SRCDIR)/d.mk clean + $(MAKE) -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py index 413ac2364f7..26fa4473fdb 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py @@ -22,6 +22,7 @@ class LoadUnloadTestCase(TestBase): def setUp(self): # Call super's setUp(). TestBase.setUp(self) + lldbutil.mkdir_p(self.getBuildArtifact("hidden")) # Find the line number to break for main.cpp. self.line = line_number( 'main.cpp', @@ -36,12 +37,12 @@ class LoadUnloadTestCase(TestBase): "=" + os.environ["LD_LIBRARY_PATH"] + ":" + - os.getcwd()) + self.getBuildDir()) else: if lldb.remote_platform: wd = lldb.remote_platform.GetWorkingDirectory() else: - wd = os.getcwd() + wd = self.getBuildDir() self.runCmd( "settings set target.env-vars " + self.dylibPath + @@ -63,7 +64,7 @@ class LoadUnloadTestCase(TestBase): cwd = os.getcwd() for f in shlibs: err = lldb.remote_platform.Put( - lldb.SBFileSpec(os.path.join(cwd, f)), + lldb.SBFileSpec(self.getBuildArtifact(f)), lldb.SBFileSpec(os.path.join(wd, f))) if err.Fail(): raise RuntimeError( @@ -78,13 +79,16 @@ class LoadUnloadTestCase(TestBase): raise RuntimeError( "Unable to create a directory '%s'." % hidden_dir) err = lldb.remote_platform.Put( - lldb.SBFileSpec(os.path.join(cwd, 'hidden', shlib)), + lldb.SBFileSpec(os.path.join('hidden', shlib)), lldb.SBFileSpec(hidden_file)) if err.Fail(): raise RuntimeError( "Unable copy 'libloadunload_d.so' to '%s'.\n>>> %s" % (wd, err.GetCString())) + # libloadunload_d.so does not appear in the image list because executable + # dependencies are resolved relative to the debuggers PWD. Bug? + @expectedFailureAll(oslist=["linux"]) @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @not_remote_testsuite_ready @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently @@ -100,11 +104,10 @@ class LoadUnloadTestCase(TestBase): dylibName = 'libloadunload_d.so' # The directory with the dynamic library we did not link to. - new_dir = os.path.join(os.getcwd(), "hidden") + new_dir = os.path.join(self.getBuildDir(), "hidden") - old_dylib = os.path.join(os.getcwd(), dylibName) + old_dylib = os.path.join(self.getBuildDir(), dylibName) new_dylib = os.path.join(new_dir, dylibName) - exe = self.getBuildArtifact("a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -115,14 +118,14 @@ class LoadUnloadTestCase(TestBase): # Add an image search path substitution pair. self.runCmd( "target modules search-paths add %s %s" % - (os.getcwd(), new_dir)) + (self.getBuildDir(), new_dir)) self.expect("target modules search-paths list", - substrs=[os.getcwd(), new_dir]) + substrs=[self.getBuildDir(), new_dir]) self.expect( "target modules search-paths query %s" % - os.getcwd(), + self.getBuildDir(), "Image search path successfully transformed", substrs=[new_dir]) @@ -146,6 +149,9 @@ class LoadUnloadTestCase(TestBase): "LLDB successfully locates the relocated dynamic library", substrs=[new_dylib]) + # libloadunload_d.so does not appear in the image list because executable + # dependencies are resolved relative to the debuggers PWD. Bug? + @expectedFailureAll(oslist=["linux"]) @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @expectedFailureAndroid # wrong source file shows up for hidden library @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently @@ -174,18 +180,19 @@ class LoadUnloadTestCase(TestBase): if lldb.remote_platform: wd = lldb.remote_platform.GetWorkingDirectory() else: - wd = os.getcwd() + wd = self.getBuildDir() old_dir = wd new_dir = os.path.join(wd, special_dir) old_dylib = os.path.join(old_dir, dylibName) - remove_dyld_path_cmd = "settings remove target.env-vars " + self.dylibPath + remove_dyld_path_cmd = "settings remove target.env-vars " \ + + self.dylibPath self.addTearDownHook( lambda: self.dbg.HandleCommand(remove_dyld_path_cmd)) - # For now we don't track (DY)LD_LIBRARY_PATH, so the old library will be in - # the modules list. + # For now we don't track (DY)LD_LIBRARY_PATH, so the old + # library will be in the modules list. self.expect("target modules list", substrs=[os.path.basename(old_dylib)], matching=True) @@ -203,7 +210,7 @@ class LoadUnloadTestCase(TestBase): if not self.platformIsDarwin(): env_cmd_string += ":" + wd self.runCmd(env_cmd_string) - + # This time, the hidden library should be picked up. self.expect("run", substrs=["return", "12345"]) @@ -233,15 +240,14 @@ class LoadUnloadTestCase(TestBase): self.runCmd("run", RUN_SUCCEEDED) + ctx = self.platformContext + dylibName = ctx.shlib_prefix + 'loadunload_a.' + ctx.shlib_extension + localDylibPath = self.getBuildArtifact(dylibName) if lldb.remote_platform: - shlib_dir = lldb.remote_platform.GetWorkingDirectory() - else: - shlib_dir = self.mydir - - if self.platformIsDarwin(): - dylibName = 'libloadunload_a.dylib' + wd = lldb.remote_platform.GetWorkingDirectory() + remoteDylibPath = lldbutil.join_remote_paths(wd, dylibName) else: - dylibName = 'libloadunload_a.so' + remoteDylibPath = localDylibPath # Make sure that a_function does not exist at this point. self.expect( @@ -253,13 +259,10 @@ class LoadUnloadTestCase(TestBase): # Use lldb 'process load' to load the dylib. self.expect( - "process load %s --install" % - dylibName, - "%s loaded correctly" % - dylibName, + "process load %s --install=%s" % (localDylibPath, remoteDylibPath), + "%s loaded correctly" % dylibName, patterns=[ - 'Loading "%s".*ok' % - dylibName, + 'Loading "%s".*ok' % localDylibPath, 'Image [0-9]+ loaded']) # Search for and match the "Image ([0-9]+) loaded" pattern. @@ -366,6 +369,9 @@ class LoadUnloadTestCase(TestBase): substrs=['stopped', 'stop reason = step over']) + # We can't find a breakpoint location for d_init before launching because + # executable dependencies are resolved relative to the debuggers PWD. Bug? + @expectedFailureAll(oslist=["linux"]) @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently def test_static_init_during_load(self): diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk index 0eb810e2178..9b30db77171 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk +++ b/lldb/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk @@ -13,11 +13,10 @@ CXXFLAGS += -fPIC include $(LEVEL)/Makefile.rules -.PHONY: $(DYLIB_FILENAME): lib_b -lib_b: - "$(MAKE)" -f b.mk +.PHONY lib_b: + $(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/b.mk clean:: - "$(MAKE)" -f b.mk clean + $(MAKE) -I $(SRCDIR) -f $(SRCDIR)/b.mk clean diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py index 18fcc41fa9f..25b83ed5532 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py @@ -45,7 +45,7 @@ class PluginCommandTestCase(TestBase): retobj = lldb.SBCommandReturnObject() retval = debugger.GetCommandInterpreter().HandleCommand( - "plugin load %s" % plugin_lib_name, retobj) + "plugin load %s" % self.getBuildArtifact(plugin_lib_name), retobj) retobj.Clear() diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py index 1a6f4c12443..4a19a4e7760 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py @@ -44,9 +44,9 @@ class PluginPythonOSPlugin(TestBase): self.dbg.SetAsync(False) # Create a target by the debugger. - cwd = os.getcwd() exe = self.getBuildArtifact("a.out") - python_os_plugin_path = os.path.join(cwd, "operating_system.py") + python_os_plugin_path = os.path.join(self.getSourceDir(), + "operating_system.py") target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) @@ -128,9 +128,9 @@ class PluginPythonOSPlugin(TestBase): self.dbg.SetAsync(False) # Create a target by the debugger. - cwd = os.getcwd() exe = self.getBuildArtifact("a.out") - python_os_plugin_path = os.path.join(cwd, "operating_system2.py") + python_os_plugin_path = os.path.join(self.getSourceDir(), + "operating_system2.py") target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py index 3459da6a3af..49ff0319746 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py @@ -64,7 +64,7 @@ class MiniDumpTestCase(TestBase): """Test that we can examine a more interesting stack in a mini dump.""" self.build() exe = self.getBuildArtifact("a.out") - core = os.path.join(os.getcwd(), "core.dmp") + core = self.getBuildArtifact("core.dmp") try: # Set a breakpoint and capture a mini dump. target = self.dbg.CreateTarget(exe) @@ -100,7 +100,7 @@ class MiniDumpTestCase(TestBase): """Test that we can examine local variables in a mini dump.""" self.build() exe = self.getBuildArtifact("a.out") - core = os.path.join(os.getcwd(), "core.dmp") + core = self.getBuildArtifact("core.dmp") try: # Set a breakpoint and capture a mini dump. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py index c4d372cd3d3..94a013b53ce 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py @@ -27,7 +27,7 @@ class ProcessAttachTestCase(TestBase): def test_attach_to_process_by_id(self): """Test attach by process id""" self.build() - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) # Spawn a new process popen = self.spawnSubprocess(exe) @@ -43,13 +43,13 @@ class ProcessAttachTestCase(TestBase): @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails def test_attach_to_process_from_different_dir_by_id(self): """Test attach by process id""" + newdir = self.getBuildArtifact("newdir") try: - os.mkdir(os.path.join(os.getcwd(),'newdir')) + os.mkdir(newdir) except OSError, e: if e.errno != os.errno.EEXIST: raise - testdir = os.getcwd() - newdir = os.path.join(testdir,'newdir') + testdir = self.getBuildDir() exe = os.path.join(newdir, 'proc_attach') self.buildProgram('main.cpp', exe) self.addTearDownHook(lambda: shutil.rmtree(newdir)) @@ -58,7 +58,7 @@ class ProcessAttachTestCase(TestBase): popen = self.spawnSubprocess(exe) self.addTearDownHook(self.cleanupSubprocesses) - os.chdir('newdir') + os.chdir(newdir) self.addTearDownHook(lambda: os.chdir(testdir)) self.runCmd("process attach -p " + str(popen.pid)) @@ -71,7 +71,7 @@ class ProcessAttachTestCase(TestBase): def test_attach_to_process_by_name(self): """Test attach by process name""" self.build() - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) # Spawn a new process popen = self.spawnSubprocess(exe) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py index 5465b7155f5..481ec6d7c05 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py @@ -25,7 +25,7 @@ class AttachDeniedTestCase(TestBase): def test_attach_to_process_by_id_denied(self): """Test attach by process id denied""" self.build() - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) # Use a file as a synchronization point between test and inferior. pid_file_path = lldbutil.append_to_process_working_directory( diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py index 18fe9d7cb2d..9692b169754 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py @@ -132,7 +132,9 @@ class ProcessLaunchTestCase(TestBase): out_file_name = "my_working_dir_test.out" err_file_name = "my_working_dir_test.err" - my_working_dir_path = os.path.join(os.getcwd(), mywd) + my_working_dir_path = self.getBuildArtifact(mywd) + try: os.makedirs(my_working_dir_path) + except: pass out_file_path = os.path.join(my_working_dir_path, out_file_name) err_file_path = os.path.join(my_working_dir_path, err_file_name) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/my_working_dir/.keep b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/my_working_dir/.keep deleted file mode 100644 index e69de29bb2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/my_working_dir/.keep +++ /dev/null diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py index e25d710d059..55dbc422371 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py @@ -22,7 +22,7 @@ class ProcessSaveCoreTestCase(TestBase): """Test that SaveCore fails if the process isn't stopped.""" self.build() exe = self.getBuildArtifact("a.out") - core = os.path.join(os.getcwd(), "core.dmp") + core = self.getBuildArtifact("core.dmp") target = self.dbg.CreateTarget(exe) process = target.LaunchSimple( None, None, self.get_process_working_directory()) @@ -36,7 +36,7 @@ class ProcessSaveCoreTestCase(TestBase): """Test that we can save a Windows mini dump.""" self.build() exe = self.getBuildArtifact("a.out") - core = os.path.join(os.getcwd(), "core.dmp") + core = self.getBuildArtifact("core.dmp") try: target = self.dbg.CreateTarget(exe) breakpoint = target.BreakpointCreateByName("bar") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py b/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py index cb3baf4cfc5..f82443f9b15 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py @@ -149,7 +149,7 @@ class RegisterCommandsTestCase(TestBase): self.platform = "posix" if self.platform != "": - self.log_file = os.path.join(os.getcwd(), 'TestRegisters.log') + self.log_file = self.getBuildArtifact('TestRegisters.log') self.runCmd( "log enable " + self.platform + diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py b/lldb/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py index 9957c91c5d6..9f1ec962adb 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py @@ -35,6 +35,8 @@ class SingleQuoteInCommandLineTestCase(TestBase): """Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it.""" import pexpect self.buildDefault() + try: os.makedirs(self.getBuildArtifact("path with '09")) + except: pass system([["cp", self.getBuildArtifact("a.out"), "\"%s\"" % self.getBuildArtifact(self.myexe)]]) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/path with '09/.keep b/lldb/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/path with '09/.keep deleted file mode 100644 index e69de29bb2d..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/path with '09/.keep +++ /dev/null diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile index 45b69a5bb6e..4f71dc87646 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile @@ -5,4 +5,4 @@ C_SOURCES := with-debug.c without-debug.c include $(LEVEL)/Makefile.rules without-debug.o: without-debug.c - $(CC) $(CFLAGS_NO_DEBUG) -c without-debug.c + $(CC) $(CFLAGS_NO_DEBUG) -c $< diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py b/lldb/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py index 3a18877ef2d..88267b60b97 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py @@ -46,7 +46,7 @@ class StopHookForMultipleThreadsTestCase(TestBase): self.setTearDownCleanup(dictionary=self.d) import pexpect - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) prompt = "(lldb) " # So that the child gets torn down after the test. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py index 4d5ac02a11a..71bfff1d05d 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py @@ -62,8 +62,8 @@ class targetCommandTestCase(TestBase): def do_target_command(self): """Exercise 'target create', 'target list', 'target select' commands.""" exe_a = self.getBuildArtifact("a.out") - exe_b = os.path.join(os.getcwd(), "b.out") - exe_c = os.path.join(os.getcwd(), "c.out") + exe_b = self.getBuildArtifact("b.out") + exe_c = self.getBuildArtifact("c.out") self.runCmd("target list") output = self.res.GetOutput() @@ -114,7 +114,8 @@ class targetCommandTestCase(TestBase): def do_target_variable_command(self, exe_name): """Exercise 'target variable' command before and after starting the inferior.""" - self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact(exe_name), + CURRENT_EXECUTABLE_SET) self.expect( "target variable my_global_char", @@ -206,7 +207,8 @@ class targetCommandTestCase(TestBase): def do_target_variable_command_no_fail(self, exe_name): """Exercise 'target variable' command before and after starting the inferior.""" - self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact(exe_name), + CURRENT_EXECUTABLE_SET) self.expect( "target variable my_global_char", diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile index 4b5e0ee9422..88e031846c5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile @@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py index 9fac249936e..dbde146e73a 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py @@ -46,7 +46,7 @@ class HelloWatchLocationTestCase(TestBase): """Test watching a location with '-s size' option.""" self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py index 17c5afa1753..8e19f9b3b5b 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py @@ -40,7 +40,7 @@ class HelloWatchpointTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py index e3e96bfce19..b51cab38aa8 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py @@ -37,7 +37,7 @@ class WatchpointSlotsTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Detect line number after which we are going to increment arrayName. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py index 47454498e70..e758f9cd7e2 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py @@ -42,7 +42,7 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped in main. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py index 82865e646be..5bb683934c1 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py @@ -46,7 +46,7 @@ class WatchpointCommandsTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. @@ -117,7 +117,7 @@ class WatchpointCommandsTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. @@ -174,7 +174,7 @@ class WatchpointCommandsTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. @@ -234,7 +234,7 @@ class WatchpointCommandsTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. @@ -304,7 +304,7 @@ class WatchpointCommandsTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py index a4ceca34c08..cd819f27ec5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py @@ -45,7 +45,7 @@ class WatchpointLLDBCommandTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. @@ -113,7 +113,7 @@ class WatchpointLLDBCommandTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py index 50cd88bd862..d9edd05d3a7 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py @@ -46,7 +46,7 @@ class WatchpointPythonCommandTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. @@ -116,7 +116,7 @@ class WatchpointPythonCommandTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. @@ -144,7 +144,8 @@ class WatchpointPythonCommandTestCase(TestBase): (self.source, self.decl)]) - cmd_script_file = os.path.join(os.getcwd(), "watchpoint_command.py") + cmd_script_file = os.path.join(self.getSourceDir(), + "watchpoint_command.py") self.runCmd("command script import '%s'" % (cmd_script_file)) self.runCmd( diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py index 34502a6d1d3..a77b1e70e3d 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py @@ -45,7 +45,7 @@ class WatchpointConditionCmdTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Add a breakpoint to set a watchpoint when stopped on the breakpoint. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py index 104bc61a0f0..587dcabb2ba 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py @@ -41,8 +41,6 @@ class TestWatchpointSetEnable(TestBase): # Create a target by the debugger. self.target = self.dbg.CreateTarget(exe) self.assertTrue(self.target, VALID_TARGET) - cwd = os.getcwd() - bkpt_before = self.target.BreakpointCreateBySourceRegex("Set a breakpoint here", main_file_spec) self.assertEqual(bkpt_before.GetNumLocations(), 1, "Failed setting the before breakpoint.") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py index 542473d00ee..d4f78a5f3ec 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py @@ -62,7 +62,7 @@ class WatchpointSizeTestCase(TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Detect line number after which we are going to increment arrayName. diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile b/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile index f8a04bd32b9..979cefe9b7f 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile +++ b/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile @@ -1,18 +1,16 @@ LEVEL := ../../../make -LD_EXTRAS := -L. -l$(LIB_PREFIX)One -l$(LIB_PREFIX)Two +LD_EXTRAS := -L. -LOne -l$(LIB_PREFIX)One -LTwo -l$(LIB_PREFIX)Two C_SOURCES := main.c -main.o : CFLAGS_EXTRAS += -g -O0 - include $(LEVEL)/Makefile.rules .PHONY: a.out: lib_One lib_Two lib_%: - $(MAKE) -f $*.mk + $(MAKE) VPATH=$(SRCDIR)/$* -I $(SRCDIR) -f $(SRCDIR)/$*.mk clean:: - $(MAKE) -f One.mk clean - $(MAKE) -f Two.mk clean + $(MAKE) -f $(SRCDIR)/One.mk clean + $(MAKE) -f $(SRCDIR)/Two.mk clean diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk b/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk index 04f894c595e..eb68a402b1b 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk +++ b/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk @@ -1,12 +1,12 @@ LEVEL := ../../../make DYLIB_NAME := One -DYLIB_C_SOURCES := One/One.c One/OneConstant.c +DYLIB_C_SOURCES := One.c OneConstant.c DYLIB_ONLY := YES include $(LEVEL)/Makefile.rules CFLAGS_EXTRAS += -fPIC -One/OneConstant.o: One/OneConstant.c +OneConstant.o: OneConstant.c $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@ diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py b/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py index 3ba4628e478..0fbf6725695 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py @@ -16,6 +16,11 @@ class TestConflictingSymbols(TestBase): mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True + def setUp(self): + TestBase.setUp(self) + lldbutil.mkdir_p(self.getBuildArtifact("One")) + lldbutil.mkdir_p(self.getBuildArtifact("Two")) + def test_conflicting_symbols(self): self.build() exe = self.getBuildArtifact("a.out") diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk b/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk index 117d9e00d44..634fb1dc0fa 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk +++ b/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk @@ -1,12 +1,12 @@ LEVEL := ../../../make DYLIB_NAME := Two -DYLIB_C_SOURCES := Two/Two.c Two/TwoConstant.c +DYLIB_C_SOURCES := Two.c TwoConstant.c DYLIB_ONLY := YES include $(LEVEL)/Makefile.rules CFLAGS_EXTRAS += -fPIC -Two/TwoConstant.o: Two/TwoConstant.c +TwoConstant.o: TwoConstant.c $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@ diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py b/lldb/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py index 0223858ca58..b76cd411b5c 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py @@ -29,10 +29,10 @@ class TlsGlobalTestCase(TestBase): "=" + os.environ["LD_LIBRARY_PATH"] + ":" + - os.getcwd()) + self.getBuildDir()) else: self.runCmd("settings set target.env-vars " + - self.dylibPath + "=" + os.getcwd()) + self.dylibPath + "=" + self.getBuildDir()) self.addTearDownHook( lambda: self.runCmd( "settings remove target.env-vars " + diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py b/lldb/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py index 8764f521130..4965df2d809 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py @@ -40,9 +40,7 @@ class TestUnionMembers(TestBase): def _load_exe(self): self.build() - cwd = os.getcwd() - - src_file = os.path.join(cwd, "main.c") + src_file = os.path.join(self.getSourceDir(), "main.c") self.src_file_spec = lldb.SBFileSpec(src_file) self.assertTrue(self.src_file_spec.IsValid(), "breakpoint file") diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py index 5cbcfdf9687..a344c4f7d18 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py @@ -18,9 +18,7 @@ class TestCppChainedCalls(TestBase): self.assertTrue(src_file_spec.IsValid(), "Main source file") # Get the path of the executable - cwd = os.getcwd() - exe_file = self.getBuildArtifact("a.out") - exe_path = os.path.join(cwd, exe_file) + exe_path = self.getBuildArtifact("a.out") # Load the executable target = self.dbg.CreateTarget(exe_path) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py index 74b94517fa0..276794ca422 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py @@ -51,7 +51,7 @@ class CppValueCastTestCase(TestBase): def do_sbvalue_cast(self, exe_name): """Test SBValue::Cast(SBType) API for C++ types.""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) # Create a target from the debugger. diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py index 866bae7f7d2..fa68d0a1502 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py @@ -20,7 +20,6 @@ class TestCppGlobalOperators(TestBase): self.assertTrue(src_file_spec.IsValid(), "Main source file") # Get the path of the executable - cwd = os.getcwd() exe_path = self.getBuildArtifact("a.out") # Load the executable diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py index 643dd2f81ff..b9f25537258 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py @@ -13,9 +13,8 @@ class TestWithGmodulesDebugInfo(TestBase): @add_test_categories(["gmodules"]) def test_specialized_typedef_from_pch(self): self.build() - cwd = os.getcwd() - src_file = os.path.join(cwd, "main.cpp") + src_file = os.path.join(self.getSourceDir(), "main.cpp") src_file_spec = lldb.SBFileSpec(src_file) self.assertTrue(src_file_spec.IsValid(), "breakpoint file") diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile index bea4bf96e60..2ce96e90d2d 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile @@ -19,16 +19,16 @@ nolimit: main.o length_nolimit.o a.o $(CXX) main.o length_nolimit.o a.o -o nolimit $(LDFLAGS) main.o: main.cpp - $(CXX) $(CFLAGS_LIMIT) main.cpp -o main.o + $(CXX) $(CFLAGS_LIMIT) $(SRCDIR)/main.cpp -o main.o length_limit.o: length.cpp - $(CXX) $(CFLAGS_LIMIT) length.cpp -o length_limit.o + $(CXX) $(CFLAGS_LIMIT) $(SRCDIR)/length.cpp -o length_limit.o length_nolimit.o: length.cpp - $(CXX) $(CFLAGS_NO_LIMIT) length.cpp -o length_nolimit.o + $(CXX) $(CFLAGS_NO_LIMIT) $(SRCDIR)/length.cpp -o length_nolimit.o a.o: a.cpp - $(CXX) $(CFLAGS_NO_DEBUG) -c a.cpp -o a.o + $(CXX) $(CFLAGS_NO_DEBUG) -c $(SRCDIR)/a.cpp -o a.o clean: OBJECTS += limit nolimit length_limit.o length_nolimit.o length_limit.dwo length_nolimit.dwo diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py index 505a27a0a67..c7368a41a30 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py @@ -51,8 +51,7 @@ class TestCppIncompleteTypes(TestBase): self.assertTrue(src_file_spec.IsValid(), "Main source file") # Get the path of the executable - cwd = os.getcwd() - exe_path = os.path.join(cwd, exe) + exe_path = self.getBuildArtifact(exe) # Load the executable target = self.dbg.CreateTarget(exe_path) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py index f7a3f91e158..ae50d3d3966 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py @@ -12,9 +12,7 @@ class TestWithLimitDebugInfo(TestBase): def test_limit_debug_info(self): self.build() - cwd = os.getcwd() - - src_file = os.path.join(cwd, "main.cpp") + src_file = os.path.join(self.getSourceDir(), "main.cpp") src_file_spec = lldb.SBFileSpec(src_file) self.assertTrue(src_file_spec.IsValid(), "breakpoint file") diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile index 0041add935a..9e52bacd5fc 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile @@ -9,11 +9,11 @@ include $(LEVEL)/Makefile.rules a.out: lib_a lib_b lib_%: - $(MAKE) -f $*.mk + $(MAKE) VPATH=$(VPATH) -f $(SRCDIR)/$*.mk hidden_lib_d: $(MAKE) -C hidden clean:: - $(MAKE) -f a.mk clean - $(MAKE) -f b.mk clean + $(MAKE) -f $(SRCDIR)/a.mk clean + $(MAKE) -f $(SRCDIR)/b.mk clean diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py index b1e6e080be3..f42d194cd62 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py @@ -16,12 +16,11 @@ class TestCppNsImport(TestBase): self.build() # Get main source file - src_file = "main.cpp" + src_file = os.path.join(self.getSourceDir(), "main.cpp") src_file_spec = lldb.SBFileSpec(src_file) self.assertTrue(src_file_spec.IsValid(), "Main source file") # Get the path of the executable - cwd = os.getcwd() exe_path = self.getBuildArtifact("a.out") # Load the executable diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py index ba1e6bd06f9..5cd9e4ed1b4 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py @@ -23,12 +23,11 @@ class TestCppScopes(TestBase): self.build() # Get main source file - src_file = "main.cpp" + src_file = os.path.join(self.getSourceDir(), "main.cpp") src_file_spec = lldb.SBFileSpec(src_file) self.assertTrue(src_file_spec.IsValid(), "Main source file") # Get the path of the executable - cwd = os.getcwd() exe_path = self.getBuildArtifact("a.out") # Load the executable diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile b/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile index 2d6de6f1514..346fc4b1fbc 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile @@ -1,38 +1,23 @@ LEVEL = ../../../make -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif +LD_EXTRAS = -lobjc -framework Foundation -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +include $(LEVEL)/Makefile.rules -CFLAGS ?= -g -O0 - -ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) -endif - -LDFLAGS = $(CFLAGS) -lobjc -framework Foundation - -all: a.out libTest.dylib libTestExt.dylib +all: a.out libTest.dylib: Test/Test.m - $(CC) $(CFLAGS) -I. -c -o Test.o Test/Test.m - $(CC) $(LDFLAGS) -shared -o libTest.dylib Test.o - dsymutil libTest.dylib + mkdir -p Test + $(MAKE) MAKE_DSYM=YES VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/Test/Test.mk all libTestExt.dylib: TestExt/TestExt.m - $(CC) $(CFLAGS) -I. -c -o TestExt.o TestExt/TestExt.m - $(CC) $(LDFLAGS) -L. -lTest -shared -o libTestExt.dylib TestExt.o - dsymutil libTestExt.dylib + mkdir -p TestExt + $(MAKE) MAKE_DSYM=YES VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/TestExt/TestExt.mk all a.out: main.m libTest.dylib libTestExt.dylib - $(CC) $(LDFLAGS) -I. -L. -lTest -lTestExt -o a.out main.m - -.PHONY: clean + $(CC) $(LDFLAGS) -I$(SRCDIR) -L. -lTest -lTestExt -o a.out $< -clean: - rm -rf libTest.dylib libTestExt.dylib a.out Test.o TestExt.o libTest.dylib.dSYM libTest.dylib.dSYM +clean:: + rm -rf libTest.dylib libTestExt.dylib a.out Test.o TestExt.o libTest.dylib.dSYM libTestExt.dylib.dSYM + $(MAKE) MAKE_DSYM=YES VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/Test/Test.mk clean + $(MAKE) MAKE_DSYM=YES VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/TestExt/TestExt.mk clean diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk b/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk new file mode 100644 index 00000000000..be758ac07d8 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk @@ -0,0 +1,10 @@ +LEVEL = ../../../make + +DYLIB_NAME := Test +DYLIB_ONLY := YES +CFLAGS_EXTRAS = -I$(SRCDIR)/.. +LD_EXTRAS = -lobjc -framework Foundation + +DYLIB_OBJC_SOURCES = Test/Test.m + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk b/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk new file mode 100644 index 00000000000..285d7262ce8 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk @@ -0,0 +1,10 @@ +LEVEL = ../../../make + +DYLIB_NAME := TestExt +DYLIB_ONLY := YES +CFLAGS_EXTRAS = -I$(SRCDIR)/.. +LD_EXTRAS = -L. -lTest -lobjc -framework Foundation + +DYLIB_OBJC_SOURCES = TestExt/TestExt.m + +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py index b432d47d36a..42535ca44af 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py @@ -296,7 +296,7 @@ class FoundationTestCase(TestBase): # Log any DWARF lookups ++file_index logfile = os.path.join( - os.getcwd(), + self.getBuildDir(), "dwarf-lookups-" + self.getArchitecture() + "-" + diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py index 8ef9f39434e..82e08584702 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py @@ -34,7 +34,7 @@ class ObjectDescriptionAPITestCase(TestBase): d = {'EXE': 'b.out'} self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), 'b.out') + exe = self.getBuildArtifact('b.out') # Create a target by the debugger. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py b/lldb/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py index 96ac6d7bd90..2fad51eefd5 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py @@ -84,10 +84,12 @@ class HiddenIvarsTestCase(TestBase): if strip: self.assertTrue(subprocess.call( - ['/usr/bin/strip', '-Sx', 'libInternalDefiner.dylib']) == 0, 'stripping dylib succeeded') - self.assertTrue(subprocess.call(['/bin/rm', - '-rf', - 'libInternalDefiner.dylib.dSYM']) == 0, + ['/usr/bin/strip', '-Sx', + self.getBuildArtifact('libInternalDefiner.dylib')]) == 0, + 'stripping dylib succeeded') + self.assertTrue(subprocess.call( + ['/bin/rm', '-rf', + self.getBuildArtifact('libInternalDefiner.dylib.dSYM')]) == 0, 'remove dylib dSYM file succeeded') self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx', self.getBuildArtifact("a.out") diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile b/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile index bd940ab148c..f69da9a64be 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile @@ -19,8 +19,8 @@ endif all: aout aout: - $(CC) $(CFLAGS_NO_DEBUG) myclass.m -c -o myclass.o - $(CC) $(CFLAGS) myclass.o repro.m -framework Foundation + $(CC) $(CFLAGS_NO_DEBUG) $(SRCDIR)/myclass.m -c -o myclass.o + $(CC) $(CFLAGS) myclass.o $(SRCDIR)/repro.m -framework Foundation clean:: rm -f myclass.o diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py index ad182586f78..c6c556d385d 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py @@ -47,7 +47,7 @@ class IncompleteModulesTestCase(TestBase): self.runCmd( "settings set target.clang-module-search-paths \"" + - os.getcwd() + + self.getSourceDir() + "\"") self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY, diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py index 2b2f51918cb..29d386253fb 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py @@ -50,7 +50,7 @@ class ModulesInlineFunctionsTestCase(TestBase): self.runCmd( "settings set target.clang-module-search-paths \"" + - os.getcwd() + + self.getSourceDir() + "\"") self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY, diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py b/lldb/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py index 8b3f444b27a..6e95b4fa4b9 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py @@ -34,7 +34,7 @@ class ObjCDynamicSBTypeTestCase(TestBase): self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile b/lldb/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile index 4365ed9ae93..b93a8a13379 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile @@ -3,7 +3,7 @@ LEVEL = ../../../make OBJC_SOURCES := main.m LDFLAGS = $(CFLAGS) -lobjc -framework Foundation -default: a.out.stripped +all: a.out.stripped a.out.stripped: a.out.dSYM strip -o a.out.stripped a.out diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py b/lldb/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py index 288f912dc79..57a572c6bb4 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py @@ -38,7 +38,7 @@ class PrintObjTestCase(TestBase): d = {'EXE': 'b.out'} self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), 'b.out') + exe = self.getBuildArtifact('b.out') target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py b/lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py index fe7d5d48ca7..737b0dc3286 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py @@ -33,7 +33,7 @@ class MethodReturningBOOLTestCase(TestBase): self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py b/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py index 1375a78f87a..ed60e5f98c2 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py @@ -33,7 +33,7 @@ class Rdar10967107TestCase(TestBase): self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py b/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py index d1956d46e7b..8619ce1ebd3 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py @@ -33,7 +33,7 @@ class Rdar10967107TestCase(TestBase): self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( diff --git a/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py b/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py index 28f230107fd..00fffc8176a 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py +++ b/lldb/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py @@ -41,7 +41,7 @@ class Rdar12408181TestCase(TestBase): self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( diff --git a/lldb/packages/Python/lldbsuite/test/lldbinline.py b/lldb/packages/Python/lldbsuite/test/lldbinline.py index 3f10b2a9352..b555a464208 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbinline.py +++ b/lldb/packages/Python/lldbsuite/test/lldbinline.py @@ -97,12 +97,14 @@ class InlineTest(TestBase): return "-N dsym %s" % (self.mydir) def BuildMakefile(self): - if os.path.exists("Makefile"): + self.makeBuildDir() + makefilePath = self.getBuildArtifact("Makefile") + if os.path.exists(makefilePath): return categories = {} - for f in os.listdir(os.getcwd()): + for f in os.listdir(self.getSourceDir()): t = source_type(f) if t: if t in list(categories.keys()): @@ -110,7 +112,7 @@ class InlineTest(TestBase): else: categories[t] = [f] - makefile = open("Makefile", 'w+') + makefile = open(makefilePath, 'w+') level = os.sep.join( [".."] * len(self.mydir.split(os.sep))) + os.sep + "make" @@ -137,29 +139,33 @@ class InlineTest(TestBase): @add_test_categories(["dsym"]) def __test_with_dsym(self): self.using_dsym = True + self.debug_info = "dsym" self.BuildMakefile() - self.buildDsym() + self.build() self.do_test() @add_test_categories(["dwarf"]) def __test_with_dwarf(self): self.using_dsym = False + self.debug_info = "dwarf" self.BuildMakefile() - self.buildDwarf() + self.build() self.do_test() @add_test_categories(["dwo"]) def __test_with_dwo(self): self.using_dsym = False + self.debug_info = "dwo" self.BuildMakefile() - self.buildDwo() + self.build() self.do_test() @add_test_categories(["gmodules"]) def __test_with_gmodules(self): self.using_dsym = False + self.debug_info = "gmodules" self.BuildMakefile() - self.buildGModules() + self.build() self.do_test() def execute_user_command(self, __command): @@ -167,14 +173,15 @@ class InlineTest(TestBase): def do_test(self): exe = self.getBuildArtifact("a.out") - source_files = [f for f in os.listdir(os.getcwd()) if source_type(f)] + source_files = [f for f in os.listdir(self.getSourceDir()) + if source_type(f)] target = self.dbg.CreateTarget(exe) parser = CommandParser() parser.parse_source_files(source_files) parser.set_breakpoints(target) - process = target.LaunchSimple(None, None, os.getcwd()) + process = target.LaunchSimple(None, None, self.getBuildDir()) while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint): thread = lldbutil.get_stopped_thread( diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 69d4937b6cf..e87dd4c5e60 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -554,6 +554,7 @@ class Base(unittest2.TestCase): print("Change dir to:", full_dir, file=sys.stderr) os.chdir(os.path.join(os.environ["LLDB_TEST"], cls.mydir)) + # TODO: Obsolete this by creating one working dir per configuration. if debug_confirm_directory_exclusivity: import lock cls.dir_lock = lock.Lock(os.path.join(full_dir, ".dirlock")) @@ -718,9 +719,28 @@ class Base(unittest2.TestCase): lldb.remote_platform.Run(shell_cmd) self.addTearDownHook(clean_working_directory) + def getSourceDir(self): + """Return the full path to the current test.""" + return os.path.join(os.environ["LLDB_TEST"], self.mydir) + + def getBuildDir(self): + """Return the full path to the current test.""" + return os.path.join(os.environ["LLDB_BUILD"], self.mydir) + + + def makeBuildDir(self): + """Create the test-specific working directory.""" + # See also dotest.py which sets up ${LLDB_BUILD}. + try: os.makedirs(self.getBuildDir()) + except: pass + def getBuildArtifact(self, name="a.out"): """Return absolute path to an artifact in the test's build directory.""" - return os.path.join(os.getcwd(), name) + return os.path.join(self.getBuildDir(), name) + + def getSourcePath(self, name): + """Return absolute path to a file in the test's source directory.""" + return os.path.join(self.getSourceDir(), name) def setUp(self): """Fixture for unittest test case setup. @@ -855,6 +875,7 @@ class Base(unittest2.TestCase): self.framework_dir = None self.dsym = None self.darwinWithFramework = False + self.makeBuildDir() def setAsync(self, value): """ Sets async mode to True/False and ensures it is reset after the testcase completes.""" @@ -1407,7 +1428,6 @@ class Base(unittest2.TestCase): """ Platform-specific way to build a program that links with LLDB (via the liblldb.so or LLDB.framework). """ - stdflag = self.getstdFlag() stdlibflag = self.getstdlibFlag() @@ -1495,18 +1515,18 @@ class Base(unittest2.TestCase): architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build the default binaries.""" + if not testdir: + testdir = self.mydir if self.debug_info: raise Exception("buildDefault tests must set NO_DEBUG_INFO_TESTCASE") module = builder_module() + self.makeBuildDir() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildDefault( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildDefault(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build default binary") def buildDsym( @@ -1514,16 +1534,15 @@ class Base(unittest2.TestCase): architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dsym info.""" + if not testdir: + testdir = self.mydir module = builder_module() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildDsym( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildDsym(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build binary with dsym") def buildDwarf( @@ -1531,16 +1550,15 @@ class Base(unittest2.TestCase): architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dwarf maps.""" + if not testdir: + testdir = self.mydir module = builder_module() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildDwarf( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildDwarf(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build binary with dwarf") def buildDwo( @@ -1548,16 +1566,15 @@ class Base(unittest2.TestCase): architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dwarf maps.""" + if not testdir: + testdir = self.mydir module = builder_module() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildDwo( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildDwo(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build binary with dwo") def buildGModules( @@ -1565,16 +1582,15 @@ class Base(unittest2.TestCase): architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with gmodules info.""" + if not testdir: + testdir = self.mydir module = builder_module() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildGModules( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildGModules(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build binary with gmodules") def buildGo(self): @@ -1869,8 +1885,9 @@ class TestBase(Base): timeWaitNextLaunch = 1.0 def generateSource(self, source): + self.makeBuildDir() template = source + '.template' - temp = os.path.join(os.getcwd(), template) + temp = os.path.join(self.getSourceDir(), template) with open(temp, 'r') as f: content = f.read() @@ -1889,7 +1906,7 @@ class TestBase(Base): header.startswith("SB") and header.endswith(".h"))] includes = '\n'.join(list) new_content = content.replace('%include_SB_APIs%', includes) - src = os.path.join(os.getcwd(), source) + src = os.path.join(self.getBuildDir(), source) with open(src, 'w') as f: f.write(new_content) @@ -1950,12 +1967,12 @@ class TestBase(Base): else: # Check relative names local_shlib_path = os.path.join( - os.getcwd(), shlib_prefix + name + shlib_extension) + self.getBuildDir(), shlib_prefix + name + shlib_extension) if not os.path.exists(local_shlib_path): local_shlib_path = os.path.join( - os.getcwd(), name + shlib_extension) + self.getBuildDir(), name + shlib_extension) if not os.path.exists(local_shlib_path): - local_shlib_path = os.path.join(os.getcwd(), name) + local_shlib_path = os.path.join(self.getBuildDir(), name) # Make sure we found the local shared library in the above code self.assertTrue(os.path.exists(local_shlib_path)) @@ -2002,7 +2019,7 @@ class TestBase(Base): return lldb.remote_platform.GetWorkingDirectory() else: # local tests change directory into each test subdirectory - return os.getcwd() + return self.getBuildDir() def tearDown(self): #import traceback @@ -2287,18 +2304,24 @@ class TestBase(Base): clean=True): """Platform specific way to build the default binaries.""" module = builder_module() + self.makeBuildDir() + dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) if self.debug_info is None: - return self.buildDefault(architecture, compiler, dictionary, clean) + return self.buildDefault(architecture, compiler, dictionary, + clean, self.mydir) elif self.debug_info == "dsym": - return self.buildDsym(architecture, compiler, dictionary, clean) + return self.buildDsym(architecture, compiler, dictionary, + clean, self.mydir) elif self.debug_info == "dwarf": - return self.buildDwarf(architecture, compiler, dictionary, clean) + return self.buildDwarf(architecture, compiler, dictionary, + clean, self.mydir) elif self.debug_info == "dwo": - return self.buildDwo(architecture, compiler, dictionary, clean) + return self.buildDwo(architecture, compiler, dictionary, + clean, self.mydir) elif self.debug_info == "gmodules": - return self.buildGModules( - architecture, compiler, dictionary, clean) + return self.buildGModules(architecture, compiler, dictionary, + clean, self.mydir) else: self.fail("Can't build for debug info: %s" % self.debug_info) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 62a69a31627..00b65ab8a55 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -9,6 +9,7 @@ from __future__ import absolute_import # System modules import collections +import errno import os import re import sys @@ -44,6 +45,14 @@ def which(program): return exe_file return None +def mkdir_p(path): + try: + os.makedirs(path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + if not os.path.isdir(path): + raise OSError(errno.ENOTDIR, "%s is not a directory"%path) # =================================================== # Disassembly for an SBFunction or an SBSymbol object # =================================================== diff --git a/lldb/packages/Python/lldbsuite/test/logging/TestLogging.py b/lldb/packages/Python/lldbsuite/test/logging/TestLogging.py index e8edae1b798..630a4215d56 100644 --- a/lldb/packages/Python/lldbsuite/test/logging/TestLogging.py +++ b/lldb/packages/Python/lldbsuite/test/logging/TestLogging.py @@ -39,7 +39,7 @@ class LogTestCase(TestBase): patterns=["Current executable set to .*a.out"]) log_file = os.path.join( - os.getcwd(), + self.getBuildDir(), "lldb-commands-log-%s-%s-%s.txt" % (type, os.path.basename( diff --git a/lldb/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile index 3a363ab98c1..5abcf02738c 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile @@ -13,10 +13,10 @@ ifeq "$(OS)" "Darwin" CFLAGS += -arch $(ARCH) endif -all: clean +all: main.c clean mkdir hide.app mkdir hide.app/Contents - $(CC) $(CFLAGS) -g main.c + $(CC) $(CFLAGS) -g $< mv a.out.dSYM hide.app/Contents strip -x a.out diff --git a/lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile index c75a079fe81..18a4934cca3 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile @@ -1,3 +1,5 @@ +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + CC ?= clang ifeq "$(ARCH)" "" @@ -8,9 +10,12 @@ CFLAGS ?= -g -O0 -arch $(ARCH) all: TestApp.app/Contents/MacOS/TestApp -TestApp.app/Contents/MacOS/TestApp: - $(CC) $(CFLAGS) -o TestApp main.c +TestApp.app/Contents/MacOS/TestApp: $(SRCDIR)/main.c + $(CC) $(CFLAGS) -o TestApp $< + rm -rf TestApp.app + cp -r $(SRCDIR)/TestApp.app . mv TestApp TestApp.app/Contents/MacOS/TestApp mv TestApp.dSYM TestApp.app.dSYM + clean: rm -rf TestApp.app/Contents/MacOS/TestApp TestApp.app.dSYM diff --git a/lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py b/lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py index 90454f897c3..af6beeefd39 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py +++ b/lldb/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py @@ -38,7 +38,7 @@ class FindAppInMacOSAppBundle(TestBase): # breakpoint, runs to it, and returns the thread, process & target. # It optionally takes an SBLaunchOption argument if you want to pass # arguments or environment variables. - exe = os.path.join(os.getcwd(), "TestApp.app") + exe = self.getBuildArtifact("TestApp.app") error = lldb.SBError() target = self.dbg.CreateTarget(exe, None, None, False, error) self.assertTrue(error.Success(), "Could not create target: %s"%(error.GetCString())) diff --git a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile index 7b321e3deae..313c83e990d 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile @@ -1,3 +1,5 @@ +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + CC ?= clang ifeq "$(ARCH)" "" @@ -7,7 +9,7 @@ endif CFLAGS ?= -g -O0 -arch $(ARCH) all: clean - $(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd bundle.c + $(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd $(SRCDIR)/bundle.c mkdir com.apple.sbd.xpc mv com.apple.sbd com.apple.sbd.xpc/ mkdir -p com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF @@ -15,7 +17,7 @@ all: clean rm -rf com.apple.sbd.dSYM mkdir hide.app tar cf - com.apple.sbd.xpc com.apple.sbd.xpc.dSYM | ( cd hide.app;tar xBpf -) - $(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn main.c + $(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn $(SRCDIR)/main.c clean: rm -rf a.out a.out.dSYM hide.app com.apple.sbd com.apple.sbd.dSYM com.apple.sbd.xpc com.apple.sbd.xpc.dSYM find-bundle-with-dots-in-fn find-bundle-with-dots-in-fn.dSYM diff --git a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py index 104e88752ec..9a046cf0b29 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py +++ b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py @@ -37,8 +37,9 @@ class BundleWithDotInFilenameTestCase(TestBase): def test_attach_and_check_dsyms(self): """Test attach to binary, see if the bundle dSYM is found""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) self.build() + os.chdir(self.getBuildDir()); popen = self.spawnSubprocess(exe) self.addTearDownHook(self.cleanupSubprocesses) @@ -66,6 +67,7 @@ class BundleWithDotInFilenameTestCase(TestBase): dsym_name = mod.GetSymbolFileSpec().GetFilename() self.assertTrue (dsym_name == 'com.apple.sbd', "Check that we found the dSYM for the bundle that was loaded") i=i+1 + os.chdir(self.getSourceDir()); if __name__ == '__main__': unittest.main() diff --git a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile index 33b09502378..d52d6f1f0d3 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile @@ -1,3 +1,5 @@ +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + CC ?= clang ifeq "$(ARCH)" "" @@ -7,12 +9,12 @@ endif CFLAGS ?= -g -O0 -arch $(ARCH) all: clean - $(CC) $(CFLAGS) -install_name $(PWD)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework myframework.c + $(CC) $(CFLAGS) -install_name $(shell pwd)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework $(SRCDIR)/myframework.c mkdir -p MyFramework.framework/Versions/A/Headers mkdir -p MyFramework.framework/Versions/A/Resources cp MyFramework MyFramework.framework/Versions/A - cp MyFramework.h MyFramework.framework/Versions/A/Headers - cp Info.plist MyFramework.framework/Versions/A/Resources + cp $(SRCDIR)/MyFramework.h MyFramework.framework/Versions/A/Headers + cp $(SRCDIR)/Info.plist MyFramework.framework/Versions/A/Resources ( cd MyFramework.framework/Versions ; ln -s A Current ) ( cd MyFramework.framework/ ; ln -s Versions/Current/Headers . ) ( cd MyFramework.framework/ ; ln -s Versions/Current/MyFramework . ) @@ -21,8 +23,8 @@ all: clean mkdir hide.app rm -f MyFramework tar cf - MyFramework.framework MyFramework.framework.dSYM | ( cd hide.app;tar xBpf -) - $(CC) $(CFLAGS) -o deep-bundle main.c -F. -framework MyFramework - + $(CC) $(CFLAGS) -o deep-bundle $(SRCDIR)/main.c -F. -framework MyFramework + clean: rm -rf a.out a.out.dSYM deep-bundle deep-bundle.dSYM MyFramework.framework MyFramework.framework.dSYM MyFramework MyFramework.dSYM hide.app diff --git a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py index 493c4b99d09..d6123e39c3f 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py +++ b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py @@ -37,9 +37,9 @@ class DeepBundleTestCase(TestBase): def test_attach_and_check_dsyms(self): """Test attach to binary, see if the framework dSYM is found""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) self.build() - popen = self.spawnSubprocess(exe) + popen = self.spawnSubprocess(exe, [self.getBuildDir()]) self.addTearDownHook(self.cleanupSubprocesses) # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in @@ -49,7 +49,6 @@ class DeepBundleTestCase(TestBase): # binary & dSYM via target.exec-search-paths settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app" self.runCmd(settings_str) - self.runCmd("process attach -p " + str(popen.pid)) target = self.dbg.GetSelectedTarget() diff --git a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c index 19715216d6c..b5ef5cff74a 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c +++ b/lldb/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c @@ -1,12 +1,17 @@ #include <MyFramework/MyFramework.h> #include <unistd.h> +#include <stdio.h> #include <stdlib.h> int setup_is_complete = 0; -int main() +int main(int argc, const char **argv) { - system ("/bin/rm -rf MyFramework MyFramework.framework MyFramework.framework.dSYM"); + char command[8192]; + sprintf (command, + "/bin/rm -rf %s/MyFramework %s/MyFramework.framework %s/MyFramework.framework.dSYM", + argv[1], argv[1], argv[1]); + system (command); setup_is_complete = 1; diff --git a/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile index 07aa39eac3b..69fd86e575e 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile @@ -1,14 +1,6 @@ -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif - -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +LEVEL = ../../make -CFLAGS ?= -g -O0 -CWD := $(shell pwd) +include $(LEVEL)/Makefile.rules LIB_PREFIX := lib @@ -28,21 +20,21 @@ all: a.out $(LIB_INDIRECT) $(LIB_REEXPORT) a.out: main.o $(LIB_INDIRECT) $(LIB_REEXPORT) $(CC) $(CFLAGS) -o a.out main.o -L. $(LIB_INDIRECT) $(LIB_REEXPORT) -main.o: main.c - $(CC) $(CFLAGS) -c main.c +main.o: $(SRCDIR)/main.c + $(CC) $(CFLAGS) -c $(SRCDIR)/main.c $(LIB_INDIRECT): indirect.o $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_INDIRECT) -o $(LIB_INDIRECT) indirect.o if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_INDIRECT); fi -indirect.o: indirect.c - $(CC) $(CFLAGS) -c indirect.c +indirect.o: $(SRCDIR)/indirect.c + $(CC) $(CFLAGS) -c $(SRCDIR)/indirect.c $(LIB_REEXPORT): reexport.o $(LIB_INDIRECT) - $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_REEXPORT) -o $(LIB_REEXPORT) reexport.o -L. -lindirect -Wl,-alias_list,$(CWD)/alias.list + $(CC) $(CFLAGS) $(LD_FLAGS) $(EXEC_PATH_REEXPORT) -o $(LIB_REEXPORT) reexport.o -L. -lindirect -Wl,-alias_list,$(SRCDIR)/alias.list if [ "$(OS)" = "Darwin" ]; then dsymutil $(LIB_REEXPORT); fi -reexport.o: reexport.c - $(CC) $(CFLAGS) -c reexport.c -clean: +reexport.o: $(SRCDIR)/reexport.c + $(CC) $(CFLAGS) -c $(SRCDIR)/reexport.c +clean:: rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM) diff --git a/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py b/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py index ee3d48d4552..a87a6289310 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py +++ b/lldb/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py @@ -32,8 +32,8 @@ class TestIndirectFunctions(TestBase): self.assertTrue(target, VALID_TARGET) if self.platformIsDarwin(): - lib1 = os.path.join(os.getcwd(), 'libindirect.dylib') - lib2 = os.path.join(os.getcwd(), 'libreexport.dylib') + lib1 = self.getBuildArtifact('libindirect.dylib') + lib2 = self.getBuildArtifact('libreexport.dylib') self.registerSharedLibrariesWithTarget(target, [lib1, lib2]) self.main_source_spec = lldb.SBFileSpec(self.main_source) diff --git a/lldb/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py b/lldb/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py index 999ab5e2491..2df2dc7b61b 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py +++ b/lldb/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py @@ -111,7 +111,7 @@ class DarwinNSLogOutputTestCase(lldbtest.TestBase): self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) self.run_lldb_to_breakpoint(exe, self.source, self.line, settings_commands=settings_commands) self.expect_prompt() diff --git a/lldb/packages/Python/lldbsuite/test/macosx/order/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/order/Makefile index 52fae2d2ca3..ff5f1886ef5 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/order/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/order/Makefile @@ -1,7 +1,7 @@ LEVEL = ../../make C_SOURCES := main.c -LDFLAGS = $(CFLAGS) -Xlinker -order_file -Xlinker ./order-file +LDFLAGS = $(CFLAGS) -Xlinker -order_file -Xlinker $(SRCDIR)/order-file MAKE_DSYM := NO include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/macosx/queues/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/queues/Makefile index 93f2f7b2f34..0d70f259501 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/queues/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/queues/Makefile @@ -1,28 +1,5 @@ -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif +LEVEL = ../../make -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +C_SOURCES := main.c -CFLAGS ?= -g -O0 -CWD := $(shell pwd) - -LIB_PREFIX := lib - -ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) -endif - -all: a.out - -a.out: main.o - $(CC) $(CFLAGS) -o a.out main.o - -main.o: main.c - $(CC) $(CFLAGS) -c main.c - -clean: - rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM) +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile index 93f2f7b2f34..0d70f259501 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile @@ -1,28 +1,5 @@ -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif +LEVEL = ../../make -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +C_SOURCES := main.c -CFLAGS ?= -g -O0 -CWD := $(shell pwd) - -LIB_PREFIX := lib - -ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) -endif - -all: a.out - -a.out: main.o - $(CC) $(CFLAGS) -o a.out main.o - -main.o: main.c - $(CC) $(CFLAGS) -c main.c - -clean: - rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM) +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/macosx/thread-names/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/thread-names/Makefile index 93f2f7b2f34..0d70f259501 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/thread-names/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/thread-names/Makefile @@ -1,28 +1,5 @@ -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif +LEVEL = ../../make -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +C_SOURCES := main.c -CFLAGS ?= -g -O0 -CWD := $(shell pwd) - -LIB_PREFIX := lib - -ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) -endif - -all: a.out - -a.out: main.o - $(CC) $(CFLAGS) -o a.out main.o - -main.o: main.c - $(CC) $(CFLAGS) -c main.c - -clean: - rm -rf $(wildcard *.o *~ *.dylib *.so a.out *.dSYM) +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile b/lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile index 854c78ed8c2..d74ed26f50a 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile +++ b/lldb/packages/Python/lldbsuite/test/macosx/universal/Makefile @@ -1,19 +1,21 @@ CC ?= clang +all: testit + testit: testit.i386 testit.x86_64 - lipo -create -o testit testit.i386 testit.x86_64 + lipo -create -o testit $^ testit.i386: testit.i386.o - $(CC) -arch i386 -o testit.i386 testit.i386.o + $(CC) -arch i386 -o testit.i386 $< testit.x86_64: testit.x86_64.o - $(CC) -arch x86_64 -o testit.x86_64 testit.x86_64.o + $(CC) -arch x86_64 -o testit.x86_64 $< testit.i386.o: main.c - $(CC) -g -O0 -arch i386 -c -o testit.i386.o main.c + $(CC) -g -O0 -arch i386 -c -o testit.i386.o $< testit.x86_64.o: main.c - $(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o main.c + $(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o $< clean: rm -rf $(wildcard testit* *~) diff --git a/lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py b/lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py index 9a690e3ebb0..ca4f3ce9b13 100644 --- a/lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py +++ b/lldb/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py @@ -33,7 +33,7 @@ class UniversalTestCase(TestBase): self.build() # Note that "testit" is a universal binary. - exe = os.path.join(os.getcwd(), "testit") + exe = self.getBuildArtifact("testit") # Create a target by the debugger. target = self.dbg.CreateTargetWithFileAndTargetTriple( @@ -57,7 +57,7 @@ class UniversalTestCase(TestBase): self.build() # Note that "testit" is a universal binary. - exe = os.path.join(os.getcwd(), "testit") + exe = self.getBuildArtifact("testit") # By default, x86_64 is assumed if no architecture is specified. self.expect("file " + exe, CURRENT_EXECUTABLE_SET, @@ -130,7 +130,7 @@ class UniversalTestCase(TestBase): self.build() # Note that "testit" is a universal binary. - exe = os.path.join(os.getcwd(), "testit") + exe = self.getBuildArtifact("testit") # Create a target by the debugger. target = self.dbg.CreateTargetWithFileAndTargetTriple( diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index f59f486dd7f..196c8fbcb84 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -6,6 +6,7 @@ # OBJC_SOURCES := # OBJCXX_SOURCES := # DYLIB_C_SOURCES := +# DYLIB_OBJC_SOURCES := # DYLIB_CXX_SOURCES := # # Specifying DYLIB_ONLY has the effect of building dylib only, skipping @@ -27,7 +28,8 @@ # Uncomment line below for debugging shell commands # SHELL = /bin/sh -x -THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ +SRCDIR := $(shell dirname $(firstword $(MAKEFILE_LIST)))/ +THIS_FILE_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/ LLDB_BASE_DIR := $(THIS_FILE_DIR)../../../../../ @@ -223,7 +225,7 @@ else CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) -I$(LLDB_BASE_DIR)include endif -CFLAGS += -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR) +CFLAGS += -I$(SRCDIR) -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR) CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS) # Use this one if you want to build one part of the result without debug information: @@ -494,23 +496,6 @@ endif #---------------------------------------------------------------------- #---------------------------------------------------------------------- -# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO" -#---------------------------------------------------------------------- -ifneq "$(DYLIB_ONLY)" "YES" -$(DSYM) : $(EXE) -ifeq "$(OS)" "Darwin" -ifneq "$(MAKE_DSYM)" "NO" - "$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)" -endif -else -ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" - $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)" - $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)" -endif -endif -endif - -#---------------------------------------------------------------------- # Compile the executable from all the objects. #---------------------------------------------------------------------- ifneq "$(DYLIB_NAME)" "" @@ -526,6 +511,22 @@ $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) endif #---------------------------------------------------------------------- +# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO" +#---------------------------------------------------------------------- +$(DSYM) : $(EXE) +ifeq "$(OS)" "Darwin" +ifneq "$(MAKE_DSYM)" "NO" + "$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)" +else +endif +else +ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" + $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)" + $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)" +endif +endif + +#---------------------------------------------------------------------- # Make the archive #---------------------------------------------------------------------- ifneq "$(ARCHIVE_NAME)" "" @@ -565,7 +566,7 @@ endif #ifneq "$(PCH_OUTPUT)" "" $(PCH_OUTPUT) : $(PCH_CXX_SOURCE) - $(CXX) $(CXXFLAGS) -x c++-header -o $(PCH_OUTPUT) $(PCH_CXX_SOURCE) + $(CXX) $(CXXFLAGS) -x c++-header -o $@ $< %.o : %.cpp $(PCH_OUTPUT) $(CXX) $(PCHFLAGS) $(CXXFLAGS) -c -o $@ $< #endif diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py index bd6656bd5e8..ab9c39acbc3 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py @@ -50,13 +50,31 @@ def getArchFlag(): return ("ARCHFLAG=" + archflag) if archflag else "" - -def getMake(): - """Returns the name for GNU make""" +def getMake(test_subdir): + """Returns the invocation for GNU make. + The argument test_subdir is the relative path to the testcase.""" if platform.system() == "FreeBSD" or platform.system() == "NetBSD": - return "gmake" + make = "gmake" else: - return "make" + make = "make" + + # Construct the base make invocation. + lldb_test = os.environ["LLDB_TEST"] + lldb_build = os.environ["LLDB_BUILD"] + if not (lldb_test and lldb_build and test_subdir and + (not os.path.isabs(test_subdir))): + raise Exception("Could not derive test directories") + build_dir = os.path.join(lldb_build, test_subdir) + test_dir = os.path.join(lldb_test, test_subdir) + # This is a bit of a hack to make inline testcases work. + makefile = os.path.join(test_dir, "Makefile") + if not os.path.isfile(makefile): + makefile = os.path.join(build_dir, "Makefile") + return [make, + "VPATH="+test_dir, + "-C", build_dir, + "-I", test_dir, + "-f", makefile] def getArchSpec(architecture): @@ -121,12 +139,13 @@ def buildDefault( architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries the default way.""" commands = [] if clean: - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - commands.append([getMake(), getArchSpec(architecture), + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + [getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) @@ -140,12 +159,13 @@ def buildDwarf( architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries with dwarf debug info.""" commands = [] if clean: - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec( + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + ["MAKE_DSYM=NO", getArchSpec( architecture), getCCSpec(compiler), getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) @@ -158,13 +178,17 @@ def buildDwo( architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries with dwarf debug info.""" commands = [] if clean: - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec( - architecture), getCCSpec(compiler), getCmdLine(dictionary)]) + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + + ["MAKE_DSYM=NO", "MAKE_DWO=YES", + getArchSpec(architecture), + getCCSpec(compiler), + getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) # True signifies that we can handle building dwo. @@ -176,13 +200,14 @@ def buildGModules( architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries with dwarf debug info.""" commands = [] if clean: - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - commands.append([getMake(), - "MAKE_DSYM=NO", + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + + ["MAKE_DSYM=NO", "MAKE_GMODULES=YES", getArchSpec(architecture), getCCSpec(compiler), @@ -195,12 +220,4 @@ def buildGModules( def cleanup(sender=None, dictionary=None): """Perform a platform-specific cleanup after the test.""" - #import traceback - # traceback.print_stack() - commands = [] - if os.path.isfile("Makefile"): - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - - runBuildCommands(commands, sender=sender) - # True signifies that we can handle cleanup. return True diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py index 06a2a86d47a..d71bc3b1fee 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py @@ -5,20 +5,23 @@ import lldbsuite.test.lldbtest as lldbtest from builder_base import * - def buildDsym( sender=None, architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries with dsym debug info.""" commands = [] if clean: - commands.append(["make", "clean", getCmdLine(dictionary)]) - commands.append(["make", "MAKE_DSYM=YES", getArchSpec( - architecture), getCCSpec(compiler), getCmdLine(dictionary)]) + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + + ["MAKE_DSYM=YES", + getArchSpec(architecture), + getCCSpec(compiler), + "all", getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py index d9e654dc32f..e980336ff9d 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_freebsd.py @@ -6,5 +6,6 @@ def buildDsym( architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): return False diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py index d9e654dc32f..e980336ff9d 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py @@ -6,5 +6,6 @@ def buildDsym( architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): return False diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py index d9e654dc32f..e980336ff9d 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_netbsd.py @@ -6,5 +6,6 @@ def buildDsym( architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): return False diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py index d9e654dc32f..e980336ff9d 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_win32.py @@ -6,5 +6,6 @@ def buildDsym( architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): return False diff --git a/lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py b/lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py index a9e896f2579..074bbc76fd1 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py @@ -34,7 +34,7 @@ class SBTypeMemberFunctionsTest(TestBase): d = {'EXE': self.exe_name} self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) # Create a target by the debugger. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py index 9f64d3699ce..8548506fdc4 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py @@ -28,10 +28,12 @@ class SBFormattersAPITestCase(TestBase): self.setTearDownCleanup() """Test Python APIs for working with formatters""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact("a.out"), + CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + self, "main.cpp", self.line, num_expected_locations=1, + loc_exact=True) self.runCmd("run", RUN_SUCCEEDED) @@ -439,7 +441,8 @@ class SBFormattersAPITestCase(TestBase): self.build(dictionary={'EXE': 'no_synth'}) self.setTearDownCleanup() - self.runCmd("file no_synth", CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact("no_synth"), + CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py b/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py index fb4e54aa0bc..5ab4fad9643 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py @@ -21,7 +21,7 @@ class HelloWorldTestCase(TestBase): # Call super's setUp(). TestBase.setUp(self) # Get the full path to our executable to be attached/debugged. - self.exe = os.path.join(os.getcwd(), self.testMethodName) + self.exe = self.getBuildArtifact(self.testMethodName) self.d = {'EXE': self.testMethodName} # Find a couple of the line numbers within main.c. self.line1 = line_number('main.c', '// Set break point at this line.') diff --git a/lldb/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py b/lldb/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py index 71f77b36880..0be34022315 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py @@ -20,10 +20,10 @@ class ProcessIOTestCase(TestBase): # Call super's setUp(). TestBase.setUp(self) # Get the full path to our executable to be debugged. - self.exe = os.path.join(os.getcwd(), "process_io") - self.local_input_file = os.path.join(os.getcwd(), "input.txt") - self.local_output_file = os.path.join(os.getcwd(), "output.txt") - self.local_error_file = os.path.join(os.getcwd(), "error.txt") + self.exe = self.getBuildArtifact("process_io") + self.local_input_file = self.getBuildArtifact("input.txt") + self.local_output_file = self.getBuildArtifact("output.txt") + self.local_error_file = self.getBuildArtifact("error.txt") self.input_file = os.path.join( self.get_process_working_directory(), "input.txt") diff --git a/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py b/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py index 6302711606c..7abcf81a069 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py @@ -20,8 +20,10 @@ class TestReadMemCString(TestBase): self.dbg.SetAsync(False) self.main_source = "main.c" - self.main_source_spec = lldb.SBFileSpec(self.main_source) - self.exe = os.path.join(os.getcwd(), "read-mem-cstring") + self.main_source_path = os.path.join(self.getSourceDir(), + self.main_source) + self.main_source_spec = lldb.SBFileSpec(self.main_source_path) + self.exe = self.getBuildArtifact("read-mem-cstring") (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, 'breakpoint here', self.main_source_spec, None, self.exe) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py index 5893dfb8f7f..088a66c71c5 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py @@ -19,7 +19,7 @@ class SectionAPITestCase(TestBase): d = {'EXE': 'b.out'} self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), 'b.out') + exe = self.getBuildArtifact('b.out') target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py index 7154e173d4d..fb8a448b033 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py @@ -149,7 +149,7 @@ class TargetAPITestCase(TestBase): self.assertEqual(len(content), 1) def create_simple_target(self, fn): - exe = os.path.join(os.getcwd(), fn) + exe = self.getBuildArtifact(fn) target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) return target @@ -175,7 +175,7 @@ class TargetAPITestCase(TestBase): def find_global_variables(self, exe_name): """Exercise SBTaget.FindGlobalVariables() API.""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) # Create a target by the debugger. target = self.dbg.CreateTarget(exe) @@ -216,8 +216,7 @@ class TargetAPITestCase(TestBase): # While we are at it, let's also exercise the similar # SBModule.FindGlobalVariables() API. for m in target.module_iter(): - if os.path.normpath(m.GetFileSpec().GetDirectory()) == os.getcwd( - ) and m.GetFileSpec().GetFilename() == exe_name: + if os.path.normpath(m.GetFileSpec().GetDirectory()) == self.getBuildDir() and m.GetFileSpec().GetFilename() == exe_name: value_list = m.FindGlobalVariables( target, 'my_global_var_of_char_type', 3) self.assertTrue(value_list.GetSize() == 1) @@ -227,7 +226,7 @@ class TargetAPITestCase(TestBase): def find_functions(self, exe_name): """Exercise SBTaget.FindFunctions() API.""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) # Create a target by the debugger. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py index 6b18419aa79..48ebf1793d6 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py @@ -134,7 +134,7 @@ class ThreadAPITestCase(TestBase): def step_out_of_malloc_into_function_b(self, exe_name): """Test Python SBThread.StepOut() API to step out of a malloc call where the call site is at function b().""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) @@ -181,7 +181,7 @@ class ThreadAPITestCase(TestBase): def step_over_3_times(self, exe_name): """Test Python SBThread.StepOver() API.""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) @@ -227,7 +227,7 @@ class ThreadAPITestCase(TestBase): def run_to_address(self, exe_name): """Test Python SBThread.RunToAddress() API.""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py b/lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py index 5ab742dac7c..40128d3ce94 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py @@ -34,7 +34,7 @@ class TypeAndTypeListTestCase(TestBase): d = {'EXE': self.exe_name} self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) # Create a target by the debugger. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py index 632244e8b9e..3890b923e75 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py @@ -33,7 +33,7 @@ class ValueAPITestCase(TestBase): d = {'EXE': self.exe_name} self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) # Create a target by the debugger. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py index 64c7fde2267..18d39d9675c 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py @@ -38,7 +38,7 @@ class ChangeValueAPITestCase(TestBase): d = {'EXE': self.exe_name} self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) # Create a target by the debugger. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py b/lldb/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py index d5f53d712e7..1b009521d25 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py @@ -36,7 +36,7 @@ class ValueAsLinkedListTestCase(TestBase): d = {'EXE': self.exe_name} self.build(dictionary=d) self.setTearDownCleanup(dictionary=d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) # Create a target by the debugger. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py b/lldb/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py index f4789877f34..e4795f22455 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py @@ -21,7 +21,7 @@ class HelloWorldTestCase(TestBase): # Call super's setUp(). TestBase.setUp(self) # Get the full path to our executable to be attached/debugged. - self.exe = os.path.join(os.getcwd(), self.testMethodName) + self.exe = self.getBuildArtifact(self.testMethodName) self.d = {'EXE': self.testMethodName} @add_test_categories(['pyapi']) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py index 4b0216d7a60..bb32869543c 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py @@ -42,7 +42,7 @@ class WatchpointConditionAPITestCase(TestBase): """Test watchpoint condition API.""" self.build(dictionary=self.d) self.setTearDownCleanup(dictionary=self.d) - exe = os.path.join(os.getcwd(), self.exe_name) + exe = self.getBuildArtifact(self.exe_name) # Create a target by the debugger. target = self.dbg.CreateTarget(exe) diff --git a/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py b/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py index 717c0744b1b..8d68ff865d1 100644 --- a/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py +++ b/lldb/packages/Python/lldbsuite/test/settings/TestSettings.py @@ -155,7 +155,7 @@ class SettingsCommandTestCase(TestBase): self.runCmd("breakpoint set -n main") self.runCmd("run") self.expect("thread backtrace", - substrs=["`main", os.getcwd()]) + substrs=["`main", self.getSourceDir()]) def test_set_auto_confirm(self): """Test that after 'set auto-confirm true', manual confirmation should not kick in.""" @@ -421,8 +421,8 @@ class SettingsCommandTestCase(TestBase): startstr='target.arg0 (string) = "cde"') self.runCmd("settings clear target.arg0", check=False) # file - path1 = os.path.join(os.getcwd(), "path1.txt") - path2 = os.path.join(os.getcwd(), "path2.txt") + path1 = self.getBuildArtifact("path1.txt") + path2 = self.getBuildArtifact("path2.txt") self.runCmd( "settings set target.output-path %s" % path1) # Set to known value diff --git a/lldb/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py b/lldb/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py index 54a96710b3d..0bf688a42ed 100644 --- a/lldb/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py +++ b/lldb/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py @@ -22,7 +22,7 @@ class SettingsCommandTestCase(TestBase): @classmethod def classCleanup(cls): """Cleanup the test byproducts.""" - cls.RemoveTempFile("stdout.txt") + cls.RemoveTempFile(self.getBuildArtifact("stdout.txt")) @no_debug_info_test def test_no_quote(self): @@ -82,16 +82,22 @@ class SettingsCommandTestCase(TestBase): exe = self.getBuildArtifact("a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("process launch -- " + args_in) + local_outfile = self.getBuildArtifact("output.txt") + if lldb.remote_platform: + remote_outfile = "output.txt" # Relative to platform's PWD + else: + remote_outfile = local_outfile + + self.runCmd("process launch -- %s %s" %(remote_outfile, args_in)) if lldb.remote_platform: - src_file_spec = lldb.SBFileSpec('output.txt', False) - dst_file_spec = lldb.SBFileSpec('output.txt', True) + src_file_spec = lldb.SBFileSpec(remote_outfile, False) + dst_file_spec = lldb.SBFileSpec(local_outfile, True) lldb.remote_platform.Get(src_file_spec, dst_file_spec) - with open('output.txt', 'r') as f: + with open(local_outfile, 'r') as f: output = f.read() - self.RemoveTempFile("output.txt") + self.RemoveTempFile(local_outfile) self.assertEqual(output, args_out) diff --git a/lldb/packages/Python/lldbsuite/test/settings/quoting/main.c b/lldb/packages/Python/lldbsuite/test/settings/quoting/main.c index 5e3e34f84a6..2ebaa142bc5 100644 --- a/lldb/packages/Python/lldbsuite/test/settings/quoting/main.c +++ b/lldb/packages/Python/lldbsuite/test/settings/quoting/main.c @@ -8,11 +8,11 @@ main(int argc, char const *argv[]) { int i; - FILE *output = fopen ("output.txt", "w"); + FILE *output = fopen (argv[1], "w"); if (output == NULL) exit (1); - for (i = 1; i < argc; ++i) + for (i = 2; i < argc; ++i) fwrite(argv[i], strlen(argv[i])+1, 1, output); fclose (output); diff --git a/lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py b/lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py index 44bac1de2b4..a30f8187cdc 100644 --- a/lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py +++ b/lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py @@ -140,10 +140,12 @@ class SourceManagerTestCase(TestBase): # Set target.source-map settings. self.runCmd("settings set target.source-map %s %s" % - (os.getcwd(), os.path.join(os.getcwd(), "hidden"))) + (self.getSourceDir(), + os.path.join(self.getSourceDir(), "hidden"))) # And verify that the settings work. self.expect("settings show target.source-map", - substrs=[os.getcwd(), os.path.join(os.getcwd(), "hidden")]) + substrs=[self.getSourceDir(), + os.path.join(self.getSourceDir(), "hidden")]) # Display main() and verify that the source mapping has been kicked in. self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY, @@ -235,10 +237,11 @@ class SourceManagerTestCase(TestBase): def test_set_breakpoint_with_absolute_path(self): self.build() self.runCmd("settings set target.source-map %s %s" % - (os.getcwd(), os.path.join(os.getcwd(), "hidden"))) + (self.getSourceDir(), + os.path.join(self.getSourceDir(), "hidden"))) exe = self.getBuildArtifact("a.out") - main = os.path.join(os.getcwd(), "hidden", "main.c") + main = os.path.join(self.getSourceDir(), "hidden", "main.c") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py index d4d7a484be4..c1c6faf10f0 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py @@ -29,7 +29,7 @@ class MiLibraryLoadedTestCase(lldbmi_testcase.MiTestCaseBase): # Test =library-loaded import os - path = os.path.join(os.getcwd(), self.myexe) + path = self.getBuildArtifact(self.myexe) symbols_path = os.path.join( path + ".dSYM", "Contents", diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py index 16f71fe8130..c8bb89e07f6 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -200,7 +200,7 @@ class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase): self.expect("\*stopped,reason=\"breakpoint-hit\"") import os - path = os.path.join(os.getcwd(), "main.cpp") + path = os.path.join(self.getSourceDir(), "main.cpp") line = line_number('main.cpp', '// BP_return') self.runCmd("-break-insert %s:%d" % (path, line)) self.expect("\^done,bkpt={number=\"2\"") diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py index 6c38534aec2..4ca40630c38 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py @@ -13,6 +13,7 @@ class MiTestCaseBase(Base): mydir = None myexe = None mylog = None + NO_DEBUG_INFO_TESTCASE = True @classmethod def classCleanup(cls): @@ -22,7 +23,11 @@ class MiTestCaseBase(Base): TestBase.RemoveTempFile(cls.mylog) def setUp(self): + if not self.mydir: + raise("mydir is empty") + Base.setUp(self) + self.makeBuildDir() self.buildDefault() self.child_prompt = "(gdb)" self.myexe = self.getBuildArtifact("a.out") diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py index 6ac9bf81356..f396a0681cf 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py @@ -92,7 +92,7 @@ class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase): # Test that -symbol-list-lines works when file is specified using # absolute path import os - path = os.path.join(os.getcwd(), "main.cpp") + path = os.path.join(self.getSourceDir(), "main.cpp") self.runCmd("-symbol-list-lines \"%s\"" % path) self.expect( "\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py index 137408a2bd2..a3030582a86 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py @@ -32,7 +32,7 @@ class MiTargetTestCase(lldbmi_testcase.MiTestCaseBase): # Load executable # FIXME: -file-exec-and-sybmols is not required for target attach, but # the test will not pass without this - self.runCmd("-file-exec-and-symbols %s" % exeName) + self.runCmd("-file-exec-and-symbols %s" % self.getBuildArtifact(exeName)) self.expect("\^done") # Set up attach @@ -40,7 +40,7 @@ class MiTargetTestCase(lldbmi_testcase.MiTestCaseBase): time.sleep(4) # Give attach time to setup # Start target process - self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName)) + self.spawnSubprocess(self.getBuildArtifact(exeName)) self.addTearDownHook(self.cleanupSubprocesses) self.expect("\^done") @@ -71,8 +71,7 @@ class MiTargetTestCase(lldbmi_testcase.MiTestCaseBase): self.addTearDownCleanup(dictionary=d) # Start target process - targetProcess = self.spawnSubprocess( - os.path.join(os.path.dirname(__file__), exeName)) + targetProcess = self.spawnSubprocess(self.getBuildArtifact(exeName)) self.addTearDownHook(self.cleanupSubprocesses) self.spawnLldbMi(args=None) @@ -109,7 +108,7 @@ class MiTargetTestCase(lldbmi_testcase.MiTestCaseBase): # Start target process targetProcess = self.spawnSubprocess( - os.path.join(os.path.dirname(__file__), exeName)) + self.getBuildArtifact(exeName)) self.addTearDownHook(self.cleanupSubprocesses) self.spawnLldbMi(args=None) diff --git a/lldb/packages/Python/lldbsuite/test/types/AbstractBase.py b/lldb/packages/Python/lldbsuite/test/types/AbstractBase.py index ee548954a74..bb322345d25 100644 --- a/lldb/packages/Python/lldbsuite/test/types/AbstractBase.py +++ b/lldb/packages/Python/lldbsuite/test/types/AbstractBase.py @@ -34,7 +34,7 @@ class GenericTester(TestBase): # module cacheing subsystem to be confused with executable name "a.out" # used for all the test cases. self.exe_name = self.testMethodName - self.golden_filename = os.path.join(os.getcwd(), "golden-output.txt") + self.golden_filename = self.getBuildArtifact("golden-output.txt") def tearDown(self): """Cleanup the test byproducts.""" @@ -113,8 +113,8 @@ class GenericTester(TestBase): quotedDisplay=False, blockCaptured=False): """Test that variables with basic types are displayed correctly.""" - - self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET) + self.runCmd("file %s" % self.getBuildArtifact(exe_name), + CURRENT_EXECUTABLE_SET) # First, capture the golden output emitted by the oracle, i.e., the # series of printf statements. @@ -210,7 +210,8 @@ class GenericTester(TestBase): blockCaptured=False): """Test that variable expressions with basic types are evaluated correctly.""" - self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET) + self.runCmd("file %s" % self.getBuildArtifact(exe_name), + CURRENT_EXECUTABLE_SET) # First, capture the golden output emitted by the oracle, i.e., the # series of printf statements. diff --git a/lldb/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py b/lldb/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py index 11a7d6f41fb..c75f7f293fa 100644 --- a/lldb/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py +++ b/lldb/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py @@ -64,7 +64,7 @@ class AddDsymCommandCase(TestBase): def generate_main_cpp(self, version=0): """Generate main.cpp from main.cpp.template.""" - temp = os.path.join(os.getcwd(), self.template) + temp = os.path.join(self.getSourceDir(), self.template) with open(temp, 'r') as f: content = f.read() @@ -72,7 +72,8 @@ class AddDsymCommandCase(TestBase): '%ADD_EXTRA_CODE%', 'printf("This is version %d\\n");' % version) - src = os.path.join(os.getcwd(), self.source) + self.makeBuildDir() + src = os.path.join(self.getBuildDir(), self.source) with open(src, 'w') as f: f.write(new_content) @@ -86,11 +87,13 @@ class AddDsymCommandCase(TestBase): exe_path = self.getBuildArtifact(exe_name) self.runCmd("file " + exe_path, CURRENT_EXECUTABLE_SET) - wrong_path = os.path.join("%s.dSYM" % exe_name, "Contents") + wrong_path = os.path.join(self.getBuildDir(), + "%s.dSYM" % exe_name, "Contents") self.expect("add-dsym " + wrong_path, error=True, substrs=['invalid module path']) right_path = os.path.join( + self.getBuildDir(), "%s.dSYM" % exe_path, "Contents", @@ -108,6 +111,7 @@ class AddDsymCommandCase(TestBase): # This time, the UUID should match and we expect some feedback from # lldb. right_path = os.path.join( + self.getBuildDir(), "%s.dSYM" % exe_path, "Contents", |