Index: packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py =================================================================== --- packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py +++ packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py @@ -32,12 +32,12 @@ 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)) Index: packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py =================================================================== --- packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py +++ packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py @@ -26,7 +26,7 @@ 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) Index: packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py =================================================================== --- packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py +++ packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py @@ -87,14 +87,16 @@ 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(): Index: packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py =================================================================== --- packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py +++ packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py @@ -19,8 +19,7 @@ @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 @@ @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: Index: packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py =================================================================== --- packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py +++ packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py @@ -94,7 +94,7 @@ 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) ' Index: packages/Python/lldbsuite/test/configuration.py =================================================================== --- packages/Python/lldbsuite/test/configuration.py +++ packages/Python/lldbsuite/test/configuration.py @@ -107,6 +107,9 @@ 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 Index: packages/Python/lldbsuite/test/darwin_log.py =================================================================== --- packages/Python/lldbsuite/test/darwin_log.py +++ packages/Python/lldbsuite/test/darwin_log.py @@ -162,7 +162,7 @@ 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 @@ # 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. Index: packages/Python/lldbsuite/test/dotest.py =================================================================== --- packages/Python/lldbsuite/test/dotest.py +++ packages/Python/lldbsuite/test/dotest.py @@ -472,6 +472,9 @@ 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 + configuration.test_build_dir = os.getcwd() if args.event_add_entries and len(args.event_add_entries) > 0: entries = {} @@ -620,6 +623,7 @@ sys.exit(-1) os.environ["LLDB_TEST"] = scriptPath + os.environ["LLDB_BUILD"] = configuration.test_build_dir # Set up the LLDB_SRC environment variable, so that the tests can locate # the LLDB source code. @@ -1184,6 +1188,14 @@ 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. + if configuration.test_build_dir: + try: os.makedirs(configuration.test_build_dir) + except: pass + else: + configuration.test_build_dir = os.getcwd() + target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2] checkLibcxxSupport() Index: packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- packages/Python/lldbsuite/test/dotest_args.py +++ packages/Python/lldbsuite/test/dotest_args.py @@ -159,6 +159,11 @@ 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', + help='The root build directory for the tests') # Configuration options group = parser.add_argument_group('Remote platform options') Index: packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py =================================================================== --- packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py +++ packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py @@ -12,7 +12,7 @@ from lldbsuite.test import lldbutil def enumerateJITFiles(): - return [f for f in os.listdir(os.getcwd()) if f.startswith("jit")] + return [f for f in os.listdir(self.getBuildDir()) if f.startswith("jit")] def countJITFiles(): return len(enumerateJITFiles()) Index: packages/Python/lldbsuite/test/expression_command/top-level/Makefile =================================================================== --- packages/Python/lldbsuite/test/expression_command/top-level/Makefile +++ packages/Python/lldbsuite/test/expression_command/top-level/Makefile @@ -7,7 +7,7 @@ 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 Index: packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py =================================================================== --- packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py +++ packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py @@ -45,7 +45,8 @@ 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, Index: packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py +++ packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py @@ -30,7 +30,7 @@ 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) Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py @@ -44,16 +44,16 @@ # 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 @@ 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) Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py @@ -54,7 +54,7 @@ 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( Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py @@ -63,7 +63,7 @@ # 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() Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py @@ -15,7 +15,6 @@ def test_breakpoint_set_restart(self): self.build() - cwd = os.getcwd() exe = self.getBuildArtifact("a.out") target = self.dbg.CreateTarget(exe) @@ -35,7 +34,7 @@ bp = target.BreakpointCreateBySourceRegex( self.BREAKPOINT_TEXT, lldb.SBFileSpec( os.path.join( - cwd, 'main.cpp'))) + self.getSourceDir(), 'main.cpp'))) self.assertTrue( bp.IsValid() and bp.GetNumLocations() == 1, VALID_BREAKPOINT) Index: packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py @@ -26,7 +26,7 @@ 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.src_path = os.path.join(self.getSourceDir(), _SRC_FILE) @skipIf(hostoslist=["windows"]) def test_symlink_paths_set(self): @@ -59,7 +59,7 @@ 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) @@ -69,5 +69,5 @@ 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) Index: packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py @@ -73,7 +73,7 @@ # 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 @@ 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 @@ 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 @@ 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 @@ 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. Index: packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py +++ packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py @@ -32,7 +32,7 @@ """Test that LLDB correctly allows scripted commands to set immediate output to the console.""" 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]) @@ -54,12 +54,12 @@ """Test that LLDB correctly allows scripted commands to set immediate output to a file.""" 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 +68,7 @@ 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]) Index: packages/Python/lldbsuite/test/functionalities/exec/TestExec.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/exec/TestExec.py +++ packages/Python/lldbsuite/test/functionalities/exec/TestExec.py @@ -41,23 +41,23 @@ 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 = os.path.join(self.getSourceDir(), "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) Index: packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py +++ packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py @@ -39,7 +39,7 @@ self.runCmd( "process launch -X true -w %s -- fi*.tx? () > <" % - (os.getcwd())) + (self.getBuildDir())) process = self.process() Index: packages/Python/lldbsuite/test/functionalities/load_unload/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/load_unload/Makefile +++ packages/Python/lldbsuite/test/functionalities/load_unload/Makefile @@ -11,7 +11,7 @@ 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 +20,13 @@ hidden_lib_d: - $(MAKE) -C hidden + mkdir -p 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 + mkdir -p hidden + $(MAKE) -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean Index: packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py +++ packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py @@ -36,12 +36,12 @@ "=" + 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 +63,7 @@ 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,7 +78,7 @@ 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( @@ -100,11 +100,10 @@ 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 +114,14 @@ # 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]) @@ -174,18 +173,19 @@ 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 +203,7 @@ 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"]) @@ -239,9 +239,9 @@ shlib_dir = self.mydir if self.platformIsDarwin(): - dylibName = 'libloadunload_a.dylib' + dylibName = self.getBuildArtifact('libloadunload_a.dylib') else: - dylibName = 'libloadunload_a.so' + dylibName = self.getBuildArtifact('libloadunload_a.so') # Make sure that a_function does not exist at this point. self.expect( @@ -253,8 +253,8 @@ # Use lldb 'process load' to load the dylib. self.expect( - "process load %s --install" % - dylibName, + "process load %s --install=%s" % + (dylibName, dylibName), "%s loaded correctly" % dylibName, patterns=[ Index: packages/Python/lldbsuite/test/functionalities/load_unload/a.mk =================================================================== --- packages/Python/lldbsuite/test/functionalities/load_unload/a.mk +++ packages/Python/lldbsuite/test/functionalities/load_unload/a.mk @@ -17,7 +17,7 @@ $(DYLIB_FILENAME): lib_b lib_b: - "$(MAKE)" -f b.mk + $(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/b.mk clean:: - "$(MAKE)" -f b.mk clean + $(MAKE) -I $(SRCDIR) -f $(SRCDIR)/b.mk clean Index: packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py @@ -44,9 +44,9 @@ 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 @@ 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) Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py +++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py @@ -64,7 +64,7 @@ """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 @@ """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) Index: packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py +++ packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py @@ -27,7 +27,7 @@ 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) @@ -44,12 +44,12 @@ def test_attach_to_process_from_different_dir_by_id(self): """Test attach by process id""" try: - os.mkdir(os.path.join(os.getcwd(),'newdir')) + os.mkdir(self.getBuildArtifact('newdir')) except OSError, e: if e.errno != os.errno.EEXIST: raise - testdir = os.getcwd() - newdir = os.path.join(testdir,'newdir') + testdir = self.getBuildDir() + newdir = os.path.join(testdir, 'newdir') exe = os.path.join(newdir, 'proc_attach') self.buildProgram('main.cpp', exe) self.addTearDownHook(lambda: shutil.rmtree(newdir)) @@ -71,7 +71,7 @@ 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) Index: packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py +++ packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py @@ -25,7 +25,7 @@ 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( Index: packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py +++ packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py @@ -132,7 +132,7 @@ 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) 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) Index: packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py +++ packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py @@ -22,7 +22,7 @@ """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 @@ """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") Index: packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py +++ packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py @@ -149,7 +149,7 @@ 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 + Index: packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile +++ packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile @@ -5,4 +5,4 @@ include $(LEVEL)/Makefile.rules without-debug.o: without-debug.c - $(CC) $(CFLAGS_NO_DEBUG) -c without-debug.c + $(CC) $(CFLAGS_NO_DEBUG) -c $< Index: packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py +++ packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py @@ -46,7 +46,7 @@ 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. Index: packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py +++ packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py @@ -62,8 +62,8 @@ 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() Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile =================================================================== --- packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile +++ packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile @@ -2,8 +2,9 @@ CXX_SOURCES := main.cpp -ENABLE_THREADS := YES +VPATH := $(VPATH)/.. -VPATH = .. +ENABLE_THREADS := YES include $(LEVEL)/Makefile.rules + Index: packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py @@ -46,7 +46,7 @@ """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. Index: packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py @@ -40,7 +40,7 @@ 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. Index: packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py @@ -37,7 +37,7 @@ 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. Index: packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py @@ -42,7 +42,7 @@ 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. Index: packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py @@ -46,7 +46,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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. Index: packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py @@ -45,7 +45,7 @@ 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 @@ 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. Index: packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py @@ -46,7 +46,7 @@ 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 @@ 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 @@ (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( Index: packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py @@ -45,7 +45,7 @@ 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. Index: packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py @@ -41,8 +41,6 @@ # 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.") Index: packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py @@ -62,7 +62,7 @@ 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. Index: packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py =================================================================== --- packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py +++ packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py @@ -29,10 +29,10 @@ "=" + 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 " + Index: packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py =================================================================== --- packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py +++ packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py @@ -40,9 +40,7 @@ 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") Index: packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py +++ packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py @@ -18,9 +18,7 @@ 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) Index: packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py +++ packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py @@ -51,7 +51,7 @@ 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. Index: packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py +++ packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py @@ -20,7 +20,6 @@ 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 Index: packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py +++ packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py @@ -12,9 +12,8 @@ @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") Index: packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile +++ packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile @@ -19,16 +19,16 @@ $(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 Index: packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py +++ packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py @@ -51,8 +51,7 @@ 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) Index: packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py +++ packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py @@ -12,9 +12,7 @@ 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") Index: packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py +++ packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py @@ -16,12 +16,11 @@ 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 Index: packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py +++ packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py @@ -23,12 +23,11 @@ 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 Index: packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py +++ packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py @@ -296,7 +296,7 @@ # Log any DWARF lookups ++file_index logfile = os.path.join( - os.getcwd(), + self.getBuildDir(), "dwarf-lookups-" + self.getArchitecture() + "-" + Index: packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py +++ packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py @@ -34,7 +34,7 @@ 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) Index: packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py +++ packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py @@ -47,7 +47,7 @@ self.runCmd( "settings set target.clang-module-search-paths \"" + - os.getcwd() + + self.getSourceDir() + "\"") self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY, Index: packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py +++ packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py @@ -50,7 +50,7 @@ self.runCmd( "settings set target.clang-module-search-paths \"" + - os.getcwd() + + self.getSourceDir() + "\"") self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY, Index: packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py +++ packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py @@ -34,7 +34,7 @@ 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( Index: packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py +++ packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py @@ -38,7 +38,7 @@ 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) Index: packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py +++ packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py @@ -33,7 +33,7 @@ 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( Index: packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py +++ packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py @@ -33,7 +33,7 @@ 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( Index: packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py +++ packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py @@ -33,7 +33,7 @@ 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( Index: packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py =================================================================== --- packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py +++ packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py @@ -41,7 +41,7 @@ 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( Index: packages/Python/lldbsuite/test/lldbinline.py =================================================================== --- packages/Python/lldbsuite/test/lldbinline.py +++ packages/Python/lldbsuite/test/lldbinline.py @@ -97,12 +97,14 @@ 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 @@ 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 @@ @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 @@ 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( Index: packages/Python/lldbsuite/test/lldbtest.py =================================================================== --- packages/Python/lldbsuite/test/lldbtest.py +++ packages/Python/lldbsuite/test/lldbtest.py @@ -553,6 +553,7 @@ 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")) @@ -717,9 +718,24 @@ 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}. + if ("LLDB_BUILD" in os.environ): + 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(os.environ["LLDB_BUILD"], self.mydir, name) def setUp(self): """Fixture for unittest test case setup. @@ -1443,7 +1459,7 @@ "Building LLDB Driver (%s) from sources %s" % (exe_name, sources)) - self.buildDefault(dictionary=d) + self.buildDefault(dictionary=d, testdir=self.mydir) def buildLibrary(self, sources, lib_name): """Platform specific way to build a default library. """ @@ -1481,29 +1497,27 @@ "Building LLDB Library (%s) from sources %s" % (lib_name, sources)) - self.buildDefault(dictionary=d) + self.buildDefault(dictionary=d, testdir=self.mydir) def buildProgram(self, sources, exe_name): """ Platform specific way to build an executable from C/C++ sources. """ d = {'CXX_SOURCES': sources, 'EXE': exe_name} - self.buildDefault(dictionary=d) + self.buildDefault(dictionary=d, testdir=self.mydir) def buildDefault( self, architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build the default binaries.""" + self.makeBuildDir() module = builder_module() 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( @@ -1511,16 +1525,14 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dsym info.""" + self.makeBuildDir() 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( @@ -1528,16 +1540,14 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dwarf maps.""" + self.makeBuildDir() 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( @@ -1545,16 +1555,14 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dwarf maps.""" + self.makeBuildDir() 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( @@ -1562,21 +1570,20 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with gmodules info.""" + self.makeBuildDir() 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): """Build the default go binary. """ + self.makeBuildDir() exe = self.getBuildArtifact("a.out") system([[which('go'), 'build -gcflags "-N -l" -o %s main.go' % exe]]) @@ -1840,8 +1847,9 @@ 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() @@ -1860,7 +1868,7 @@ 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) @@ -1973,7 +1981,7 @@ 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 @@ -2258,18 +2266,23 @@ clean=True): """Platform specific way to build the default binaries.""" module = builder_module() + 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) Index: packages/Python/lldbsuite/test/logging/TestLogging.py =================================================================== --- packages/Python/lldbsuite/test/logging/TestLogging.py +++ packages/Python/lldbsuite/test/logging/TestLogging.py @@ -39,7 +39,7 @@ 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( Index: packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py =================================================================== --- packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py +++ packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py @@ -38,7 +38,7 @@ # 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())) Index: packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py =================================================================== --- packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py +++ packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py @@ -37,7 +37,7 @@ 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() popen = self.spawnSubprocess(exe) self.addTearDownHook(self.cleanupSubprocesses) Index: packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py =================================================================== --- packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py +++ packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py @@ -37,7 +37,7 @@ 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) self.addTearDownHook(self.cleanupSubprocesses) Index: packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile =================================================================== --- packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile +++ 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 @@ 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) Index: packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py =================================================================== --- packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py +++ packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py @@ -32,8 +32,8 @@ 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) Index: packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py =================================================================== --- packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py +++ packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py @@ -111,7 +111,7 @@ 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() Index: packages/Python/lldbsuite/test/macosx/queues/Makefile =================================================================== --- packages/Python/lldbsuite/test/macosx/queues/Makefile +++ 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 Index: packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile =================================================================== --- packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile +++ 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 Index: packages/Python/lldbsuite/test/macosx/thread-names/Makefile =================================================================== --- packages/Python/lldbsuite/test/macosx/thread-names/Makefile +++ 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 Index: packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py =================================================================== --- packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py +++ packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py @@ -33,7 +33,7 @@ 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 @@ 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 @@ 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( Index: packages/Python/lldbsuite/test/make/Makefile.rules =================================================================== --- packages/Python/lldbsuite/test/make/Makefile.rules +++ packages/Python/lldbsuite/test/make/Makefile.rules @@ -27,6 +27,7 @@ # Uncomment line below for debugging shell commands # SHELL = /bin/sh -x +SRCDIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))/ THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ LLDB_BASE_DIR := $(THIS_FILE_DIR)../../../../../ @@ -223,7 +224,7 @@ 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: @@ -514,7 +515,7 @@ ifneq "$(DYLIB_NAME)" "" ifeq "$(DYLIB_ONLY)" "" $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) $(DYLIB_FILENAME) - $(LD) $(OBJECTS) $(ARCHIVE_NAME) -L. -l$(DYLIB_NAME) $(LDFLAGS) -o "$(EXE)" + $(LD) $(OBJECTS) $(ARCHIVE_NAME) -L. -l$(DYLIB_NAME) $(LDFLAGS) -o "$(EXE)" ; false else EXE = $(DYLIB_FILENAME) endif Index: packages/Python/lldbsuite/test/plugins/builder_base.py =================================================================== --- packages/Python/lldbsuite/test/plugins/builder_base.py +++ packages/Python/lldbsuite/test/plugins/builder_base.py @@ -50,13 +50,30 @@ return ("ARCHFLAG=" + archflag) if archflag else "" - -def getMake(): - """Returns the name for GNU make""" +def getMake(rel_testdir): + """Returns the invocation for GNU make""" 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 rel_testdir): + #import pdb; pdb.set_trace() + raise Exception("Could not derive test directories") + build_dir = os.path.join(lldb_build, rel_testdir) + test_dir = os.path.join(lldb_test, rel_testdir) + # 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 +138,13 @@ 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 +158,13 @@ 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 +177,17 @@ 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 +199,14 @@ 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 +219,13 @@ 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 + # #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 Index: packages/Python/lldbsuite/test/plugins/builder_darwin.py =================================================================== --- packages/Python/lldbsuite/test/plugins/builder_darwin.py +++ packages/Python/lldbsuite/test/plugins/builder_darwin.py @@ -5,19 +5,19 @@ 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( + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + ["MAKE_DSYM=YES", getArchSpec( architecture), getCCSpec(compiler), getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) Index: packages/Python/lldbsuite/test/plugins/builder_freebsd.py =================================================================== --- packages/Python/lldbsuite/test/plugins/builder_freebsd.py +++ packages/Python/lldbsuite/test/plugins/builder_freebsd.py @@ -6,5 +6,6 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): return False Index: packages/Python/lldbsuite/test/plugins/builder_linux.py =================================================================== --- packages/Python/lldbsuite/test/plugins/builder_linux.py +++ packages/Python/lldbsuite/test/plugins/builder_linux.py @@ -6,5 +6,6 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True + testdir=None): return False Index: packages/Python/lldbsuite/test/plugins/builder_netbsd.py =================================================================== --- packages/Python/lldbsuite/test/plugins/builder_netbsd.py +++ packages/Python/lldbsuite/test/plugins/builder_netbsd.py @@ -6,5 +6,6 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): return False Index: packages/Python/lldbsuite/test/plugins/builder_win32.py =================================================================== --- packages/Python/lldbsuite/test/plugins/builder_win32.py +++ packages/Python/lldbsuite/test/plugins/builder_win32.py @@ -6,5 +6,6 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): return False Index: packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py =================================================================== --- packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py +++ packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py @@ -34,7 +34,7 @@ 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) Index: packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py =================================================================== --- packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py +++ packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py @@ -21,7 +21,7 @@ # 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.') Index: packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py =================================================================== --- packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py +++ packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py @@ -20,10 +20,10 @@ # 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") Index: packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py =================================================================== --- packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py +++ packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py @@ -20,8 +20,10 @@ 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) Index: packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py =================================================================== --- packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py +++ packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py @@ -149,7 +149,7 @@ 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 @@ 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 @@ # 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 @@ 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) Index: packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py =================================================================== --- packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py +++ packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py @@ -134,7 +134,7 @@ 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 @@ 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 @@ 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) Index: packages/Python/lldbsuite/test/python_api/type/TestTypeList.py =================================================================== --- packages/Python/lldbsuite/test/python_api/type/TestTypeList.py +++ packages/Python/lldbsuite/test/python_api/type/TestTypeList.py @@ -34,7 +34,7 @@ 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) Index: packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py =================================================================== --- packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py +++ packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py @@ -33,7 +33,7 @@ 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) Index: packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py =================================================================== --- packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py +++ packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py @@ -38,7 +38,7 @@ 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) Index: packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py =================================================================== --- packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py +++ packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py @@ -36,7 +36,7 @@ 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) Index: packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py =================================================================== --- packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py +++ packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py @@ -21,7 +21,7 @@ # 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']) Index: packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py =================================================================== --- packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py +++ packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py @@ -42,7 +42,7 @@ """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) Index: packages/Python/lldbsuite/test/settings/TestSettings.py =================================================================== --- packages/Python/lldbsuite/test/settings/TestSettings.py +++ packages/Python/lldbsuite/test/settings/TestSettings.py @@ -155,7 +155,7 @@ 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 @@ 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 Index: packages/Python/lldbsuite/test/source-manager/TestSourceManager.py =================================================================== --- packages/Python/lldbsuite/test/source-manager/TestSourceManager.py +++ packages/Python/lldbsuite/test/source-manager/TestSourceManager.py @@ -140,10 +140,12 @@ # 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 @@ 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( Index: packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py @@ -29,7 +29,7 @@ # 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", Index: packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py @@ -200,7 +200,7 @@ 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\"") Index: packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py @@ -22,8 +22,11 @@ TestBase.RemoveTempFile(cls.mylog) def setUp(self): + if not self.mydir: + raise("mydir is empty") + Base.setUp(self) - self.buildDefault() + self.buildDefault(testdir=self.mydir) self.child_prompt = "(gdb)" self.myexe = self.getBuildArtifact("a.out") Index: packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py @@ -92,7 +92,7 @@ # 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+\"\})+\]" % Index: packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py @@ -32,7 +32,7 @@ # 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 @@ 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 @@ 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 @@ # 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) Index: packages/Python/lldbsuite/test/types/AbstractBase.py =================================================================== --- packages/Python/lldbsuite/test/types/AbstractBase.py +++ packages/Python/lldbsuite/test/types/AbstractBase.py @@ -34,7 +34,8 @@ # 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 = os.path.join(self.getBuildDir(), + "golden-output.txt") def tearDown(self): """Cleanup the test byproducts.""" @@ -113,8 +114,8 @@ 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 +211,8 @@ 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. Index: packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py =================================================================== --- packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py +++ packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py @@ -72,7 +72,7 @@ '%ADD_EXTRA_CODE%', 'printf("This is version %d\\n");' % version) - src = os.path.join(os.getcwd(), self.source) + src = os.path.join(self.getSourceDir(), self.source) with open(src, 'w') as f: f.write(new_content)