Index: lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt =================================================================== --- lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt +++ lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt @@ -135,15 +135,16 @@ self.array_types() This method is decorated with a skipUnless decorator so that it will only gets -included into the test suite if the platform it is running on is 'darwin', aka -Mac OS X. +included into the test suite if the platform it is running on is 'darwin', a.k.a. +macOS. Type 'man dsymutil' for more details. After the binary is built, it is time to specify the file to be used as the main executable by lldb: - exe = os.path.join(os.getcwd(), "a.out") + # Construct the path to a file "a.out" inside the test's build folder. + exe = self.getBuildArtifact("a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) This is where the attribute assignment: @@ -174,10 +175,11 @@ After the current executable is set, we'll then execute two more commands: # Set the output-path and verify it is set. - self.runCmd("settings set target.process.output-path 'stdout.txt'") + stdout = self.getBuildArtifact('stdout.txt') + self.runCmd("settings set target.process.output-path '%s'" %stdout) self.expect("settings show target.process.output-path", SETTING_MSG("target.process.output-path"), - startstr = "target.process.output-path (string) = 'stdout.txt'") + startstr = "target.process.output-path (string) = '.*stdout.txt'") The first uses the 'settings set' command to set the static setting target.process.output-path to be 'stdout.txt', instead of the default @@ -188,7 +190,7 @@ start string of the output against what we pass in as the value of the keyword argument pair: - startstr = "target.process.output-path (string) = 'stdout.txt'" + startstr = "target.process.output-path (string) = '%s'" %stdout Take a look at TestBase.expect() within lldbtest.py for more details. Among other things, it can also match against a list of regexp patterns as well as a @@ -204,15 +206,15 @@ program. # The 'stdout.txt' file should now exist. - self.assertTrue(os.path.isfile("stdout.txt"), - "'stdout.txt' exists due to target.process.output-path.") + self.assertTrue(os.path.isfile(stdout), + "stdout.txt' exists due to target.process.output-path.") Also take a look at main.cpp which emits some message to the stdout. Now, if we pass this assertion, it's time to examine the contents of the file to make sure it contains the same message as programmed in main.cpp: # Read the output file produced by running the program. - with open('stdout.txt', 'r') as f: + with open(stdout, 'r') as f: output = f.read() self.expect(output, exe=False, @@ -235,8 +237,8 @@ @classmethod def classCleanup(cls): - system(["/bin/sh", "-c", "rm -f output.txt"]) - system(["/bin/sh", "-c", "rm -f stdout.txt"]) + system(["/bin/sh", "-c", "rm -f "+self.getBuildArtifact("output.txt")]) + system(["/bin/sh", "-c", "rm -f "+self.getBuildArtifact("stdout.txt")]) This is a classmethod (as shown by the @classmethod decorator) which allows the individual test class to perform cleanup actions after the test harness finishes Index: lldb/trunk/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py +++ lldb/trunk/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py @@ -21,7 +21,6 @@ def setUp(self): TestBase.setUp(self) self.source = 'main.cpp' - self.exe_name = self.getBuildArtifact("a.out") self.generateSource(self.source) @skipIfNoSBHeaders @@ -35,16 +34,19 @@ self.skipTest( "LLDB is 64-bit and cannot be linked to 32-bit test program.") - self.buildDriver(self.source, self.exe_name) - self.sanity_check_executable(self.exe_name) + exe_name = self.getBuildArtifact("a.out") + self.buildDriver(self.source, exe_name) + self.sanity_check_executable(exe_name) def sanity_check_executable(self, exe_name): """Sanity check executable compiled from the auto-generated program.""" + exe_name = self.getBuildArtifact("a.out") exe = self.getBuildArtifact(exe_name) self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET) + # This test uses a generated source file, so it's in the build directory. self.line_to_break = line_number( - self.source, '// Set breakpoint here.') + self.getBuildArtifact(self.source), '// Set breakpoint here.') env_cmd = "settings set target.env-vars %s=%s" % ( self.dylibPath, self.getLLDBLibraryEnvVal()) Index: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py +++ lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py @@ -89,14 +89,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: lldb/trunk/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/configuration.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/configuration.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/darwin_log.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/darwin_log.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/dotest.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py @@ -474,6 +474,8 @@ configuration.lldb_platform_url = args.lldb_platform_url if args.lldb_platform_working_dir: configuration.lldb_platform_working_dir = args.lldb_platform_working_dir + if args.test_build_dir: + configuration.test_build_dir = args.test_build_dir if args.event_add_entries and len(args.event_add_entries) > 0: entries = {} @@ -623,6 +625,12 @@ os.environ["LLDB_TEST"] = scriptPath + # Set up the root build directory. + builddir = configuration.test_build_dir + if not configuration.test_build_dir: + raise Exception("test_build_dir is not set") + os.environ["LLDB_BUILD"] = os.path.abspath(configuration.test_build_dir) + # Set up the LLDB_SRC environment variable, so that the tests can locate # the LLDB source code. os.environ["LLDB_SRC"] = lldbsuite.lldb_root @@ -1186,6 +1194,11 @@ configuration.lldb_platform_working_dir = None configuration.lldb_platform_url = None + # Set up the working directory. + # Note that it's not dotest's job to clean this directory. + try: os.makedirs(configuration.test_build_dir) + except: pass + target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2] checkLibcxxSupport() Index: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py +++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py @@ -159,6 +159,12 @@ metavar='Codesigning identity', default='lldb_codesign', help='The codesigning identity to use') + group.add_argument( + '--build-dir', + dest='test_build_dir', + metavar='Test build directory', + default='lldb-test-build', + help='The root build directory for the tests. It will be removed before running.') # Configuration options group = parser.add_argument_group('Remote platform options') Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py @@ -31,7 +31,8 @@ self.build() # Set breakpoint in main and run exe - self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact("a.out"), + CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True) Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py +++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py @@ -11,23 +11,24 @@ from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil -def enumerateJITFiles(): - return [f for f in os.listdir(os.getcwd()) if f.startswith("jit")] - -def countJITFiles(): - return len(enumerateJITFiles()) - -def cleanJITFiles(): - for j in enumerateJITFiles(): - os.remove(j) - return - class SaveJITObjectsTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) + def enumerateJITFiles(self): + return [f for f in os.listdir(self.getBuildDir()) if f.startswith("jit")] + + def countJITFiles(self): + return len(self.enumerateJITFiles()) + + def cleanJITFiles(self): + for j in self.enumerateJITFiles(): + os.remove(j) + return + @expectedFailureAll(oslist=["windows"]) def test_save_jit_objects(self): self.build() + os.chdir(self.getBuildDir()) src_file = "main.c" src_file_spec = lldb.SBFileSpec(src_file) @@ -36,16 +37,17 @@ frame = thread.frames[0] - cleanJITFiles() + self.cleanJITFiles() frame.EvaluateExpression("(void*)malloc(0x1)") - self.assertTrue(countJITFiles() == 0, + self.assertTrue(self.countJITFiles() == 0, "No files emitted with save-jit-objects=false") self.runCmd("settings set target.save-jit-objects true") frame.EvaluateExpression("(void*)malloc(0x1)") - jit_files_count = countJITFiles() - cleanJITFiles() + jit_files_count = self.countJITFiles() + self.cleanJITFiles() self.assertTrue(jit_files_count != 0, "At least one file emitted with save-jit-objects=true") process.Kill() + os.chdir(self.getSourceDir()) Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/Makefile +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py @@ -30,9 +30,8 @@ def address_breakpoints(self): """Test that breakpoints set on a bad address say they are bad.""" - - (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, - "Set a breakpoint here", lldb.SBFileSpec("main.c")) + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, "Set a breakpoint here", lldb.SBFileSpec("main.c")) # Now see if we can read from 0. If I can't do that, I don't have a good way to know # what an illegal address is... Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py +++ lldb/trunk/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) @@ -33,9 +32,7 @@ break bp = target.BreakpointCreateBySourceRegex( - self.BREAKPOINT_TEXT, lldb.SBFileSpec( - os.path.join( - cwd, 'main.cpp'))) + self.BREAKPOINT_TEXT, lldb.SBFileSpec('main.cpp')) self.assertTrue( bp.IsValid() and bp.GetNumLocations() == 1, VALID_BREAKPOINT) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile @@ -1,7 +1,14 @@ LEVEL = ../../../make -CXX_SOURCES := main.cpp +CXX_SOURCES := relative.cpp EXE := CompDirSymLink include $(LEVEL)/Makefile.rules + +# Force relative filenames by copying it into the build directory. +relative.cpp: main.cpp + cp -f $< $@ + +clean:: + rm -rf relative.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py @@ -13,7 +13,7 @@ _EXE_NAME = 'CompDirSymLink' # Must match Makefile -_SRC_FILE = 'main.cpp' +_SRC_FILE = 'relative.cpp' _COMP_DIR_SYM_LINK_PROP = 'plugin.symbol-file.dwarf.comp-dir-symlink-paths' @@ -25,8 +25,11 @@ # Call super's setUp(). TestBase.setUp(self) # Find the line number to break inside main(). - self.line = line_number(_SRC_FILE, '// Set break point at this line.') - self.src_path = os.path.join(os.getcwd(), _SRC_FILE) + self.line = line_number( + os.path.join(self.getSourceDir(), "main.cpp"), + '// Set break point at this line.') + self.src_path = self.getBuildArtifact(_SRC_FILE) + @skipIf(hostoslist=["windows"]) def test_symlink_paths_set(self): @@ -39,6 +42,7 @@ @skipIf(hostoslist=no_match(["linux"])) def test_symlink_paths_set_procselfcwd(self): + os.chdir(self.getBuildDir()) pwd_symlink = '/proc/self/cwd' self.doBuild(pwd_symlink) self.runCmd( @@ -59,15 +63,15 @@ self.line) def create_src_symlink(self): - pwd_symlink = os.path.join(os.getcwd(), 'pwd_symlink') + pwd_symlink = self.getBuildArtifact('pwd_symlink') if os.path.exists(pwd_symlink): os.unlink(pwd_symlink) - os.symlink(os.getcwd(), pwd_symlink) + os.symlink(self.getBuildDir(), pwd_symlink) self.addTearDownHook(lambda: os.remove(pwd_symlink)) return pwd_symlink def doBuild(self, pwd_symlink): self.build(None, None, {'PWD': pwd_symlink}, True) - exe = os.path.join(os.getcwd(), _EXE_NAME) + exe = self.getBuildArtifact(_EXE_NAME) self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py @@ -30,9 +30,10 @@ @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139") def test_command_script_immediate_output_console(self): """Test that LLDB correctly allows scripted commands to set immediate output to the console.""" + self.makeBuildDir() self.launch(timeout=10) - script = os.path.join(os.getcwd(), 'custom_command.py') + script = os.path.join(self.getSourceDir(), 'custom_command.py') prompt = "\(lldb\) " self.sendline('command script import %s' % script, patterns=[prompt]) @@ -52,14 +53,15 @@ @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139") def test_command_script_immediate_output_file(self): """Test that LLDB correctly allows scripted commands to set immediate output to a file.""" + self.makeBuildDir() self.launch(timeout=10) - test_files = {os.path.join(os.getcwd(), 'read.txt'): 'r', - os.path.join(os.getcwd(), 'write.txt'): 'w', - os.path.join(os.getcwd(), 'append.txt'): 'a', - os.path.join(os.getcwd(), 'write_plus.txt'): 'w+', - os.path.join(os.getcwd(), 'read_plus.txt'): 'r+', - os.path.join(os.getcwd(), 'append_plus.txt'): 'a+'} + test_files = {self.getBuildArtifact('read.txt'): 'r', + self.getBuildArtifact('write.txt'): 'w', + self.getBuildArtifact('append.txt'): 'a', + self.getBuildArtifact('write_plus.txt'): 'w+', + self.getBuildArtifact('read_plus.txt'): 'r+', + self.getBuildArtifact('append_plus.txt'): 'a+'} starter_string = 'Starter Garbage\n' write_string = 'writing to file with mode: ' @@ -68,7 +70,7 @@ 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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py +++ lldb/trunk/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 = self.getSourcePath("main.cpp") + o_file = self.getBuildArtifact("main.o") execute_command( "'%s' -g -O0 -arch i386 -arch x86_64 '%s' -c -o '%s'" % (os.environ["CC"], source, o_file)) execute_command( - "'%s' -g -O0 -arch i386 -arch x86_64 '%s'" % - (os.environ["CC"], o_file)) + "'%s' -g -O0 -arch i386 -arch x86_64 '%s' -o '%s'" % + (os.environ["CC"], o_file, exe)) if self.debug_info != "dsym": dsym_path = self.getBuildArtifact("a.out.dSYM") execute_command("rm -rf '%s'" % (dsym_path)) else: self.build() - exe = self.getBuildArtifact("a.out") - # Create the target target = self.dbg.CreateTarget(exe) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile @@ -1,12 +1,14 @@ -all: clean - $(CC) -arch i386 -g -c a.c +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + +all: a.c clean + $(CC) -arch i386 -g -c $(SRCDIR)/a.c ar -q liba-i386.a a.o ranlib liba-i386.a - $(CC) -arch x86_64 -g -c a.c + $(CC) -arch x86_64 -g -c $(SRCDIR)/a.c ar -q liba-x86_64.a a.o ranlib liba-x86_64.a lipo -create -output liba.a liba-i386.a liba-x86_64.a - $(CC) -g -c main.c + $(CC) -g -c $(SRCDIR)/main.c $(CC) -o a.out main.o -L. -la clean: Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile @@ -6,7 +6,7 @@ include $(LEVEL)/Makefile.rules other-2.o: other-2.cpp - $(CXX) $(CFLAGS_NO_DEBUG) -c other-2.cpp + $(CXX) $(CFLAGS_NO_DEBUG) -c $(SRCDIR)/other-2.cpp somefunc.o: somefunc.c - $(CC) $(CFLAGS) -std=c99 -c somefunc.c \ No newline at end of file + $(CC) $(CFLAGS) -std=c99 -c $(SRCDIR)/somefunc.c Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py +++ lldb/trunk/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.getSourceDir())) process = self.process() @@ -77,7 +77,7 @@ self.runCmd( 'process launch -X true -w %s -- "foo bar"' % - (os.getcwd())) + (self.getSourceDir())) process = self.process() @@ -99,7 +99,8 @@ self.runCmd("process kill") - self.runCmd('process launch -X true -w %s -- foo\ bar' % (os.getcwd())) + self.runCmd('process launch -X true -w %s -- foo\ bar' + % (self.getBuildDir())) process = self.process() Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile @@ -7,11 +7,10 @@ include $(LEVEL)/Makefile.rules -.PHONY: a.out: lib_a lib_b lib_c lib_d hidden_lib_d install_name_tool lib_%: - $(MAKE) -f $*.mk + $(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/$*.mk install_name_tool: ifeq ($(OS),Darwin) @@ -20,11 +19,11 @@ hidden_lib_d: - $(MAKE) -C hidden + $(MAKE) VPATH=$(SRCDIR)/hidden -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean:: - $(MAKE) -f a.mk clean - $(MAKE) -f b.mk clean - $(MAKE) -f c.mk clean - $(MAKE) -f d.mk clean - $(MAKE) -C hidden clean + $(MAKE) -f $(SRCDIR)/a.mk clean + $(MAKE) -f $(SRCDIR)/b.mk clean + $(MAKE) -f $(SRCDIR)/c.mk clean + $(MAKE) -f $(SRCDIR)/d.mk clean + $(MAKE) -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py @@ -22,6 +22,7 @@ def setUp(self): # Call super's setUp(). TestBase.setUp(self) + lldbutil.mkdir_p(self.getBuildArtifact("hidden")) # Find the line number to break for main.cpp. self.line = line_number( 'main.cpp', @@ -36,12 +37,12 @@ "=" + os.environ["LD_LIBRARY_PATH"] + ":" + - os.getcwd()) + self.getBuildDir()) else: if lldb.remote_platform: wd = lldb.remote_platform.GetWorkingDirectory() else: - wd = os.getcwd() + wd = self.getBuildDir() self.runCmd( "settings set target.env-vars " + self.dylibPath + @@ -63,7 +64,7 @@ cwd = os.getcwd() for f in shlibs: err = lldb.remote_platform.Put( - lldb.SBFileSpec(os.path.join(cwd, f)), + lldb.SBFileSpec(self.getBuildArtifact(f)), lldb.SBFileSpec(os.path.join(wd, f))) if err.Fail(): raise RuntimeError( @@ -78,13 +79,16 @@ raise RuntimeError( "Unable to create a directory '%s'." % hidden_dir) err = lldb.remote_platform.Put( - lldb.SBFileSpec(os.path.join(cwd, 'hidden', shlib)), + lldb.SBFileSpec(os.path.join('hidden', shlib)), lldb.SBFileSpec(hidden_file)) if err.Fail(): raise RuntimeError( "Unable copy 'libloadunload_d.so' to '%s'.\n>>> %s" % (wd, err.GetCString())) + # libloadunload_d.so does not appear in the image list because executable + # dependencies are resolved relative to the debuggers PWD. Bug? + @expectedFailureAll(oslist=["linux"]) @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @not_remote_testsuite_ready @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently @@ -100,11 +104,10 @@ dylibName = 'libloadunload_d.so' # The directory with the dynamic library we did not link to. - new_dir = os.path.join(os.getcwd(), "hidden") + new_dir = os.path.join(self.getBuildDir(), "hidden") - old_dylib = os.path.join(os.getcwd(), dylibName) + old_dylib = os.path.join(self.getBuildDir(), dylibName) new_dylib = os.path.join(new_dir, dylibName) - exe = self.getBuildArtifact("a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -115,14 +118,14 @@ # Add an image search path substitution pair. self.runCmd( "target modules search-paths add %s %s" % - (os.getcwd(), new_dir)) + (self.getBuildDir(), new_dir)) self.expect("target modules search-paths list", - substrs=[os.getcwd(), new_dir]) + substrs=[self.getBuildDir(), new_dir]) self.expect( "target modules search-paths query %s" % - os.getcwd(), + self.getBuildDir(), "Image search path successfully transformed", substrs=[new_dir]) @@ -146,6 +149,9 @@ "LLDB successfully locates the relocated dynamic library", substrs=[new_dylib]) + # libloadunload_d.so does not appear in the image list because executable + # dependencies are resolved relative to the debuggers PWD. Bug? + @expectedFailureAll(oslist=["linux"]) @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @expectedFailureAndroid # wrong source file shows up for hidden library @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently @@ -174,18 +180,19 @@ if lldb.remote_platform: wd = lldb.remote_platform.GetWorkingDirectory() else: - wd = os.getcwd() + wd = self.getBuildDir() old_dir = wd new_dir = os.path.join(wd, special_dir) old_dylib = os.path.join(old_dir, dylibName) - remove_dyld_path_cmd = "settings remove target.env-vars " + self.dylibPath + remove_dyld_path_cmd = "settings remove target.env-vars " \ + + self.dylibPath self.addTearDownHook( lambda: self.dbg.HandleCommand(remove_dyld_path_cmd)) - # For now we don't track (DY)LD_LIBRARY_PATH, so the old library will be in - # the modules list. + # For now we don't track (DY)LD_LIBRARY_PATH, so the old + # library will be in the modules list. self.expect("target modules list", substrs=[os.path.basename(old_dylib)], matching=True) @@ -203,7 +210,7 @@ if not self.platformIsDarwin(): env_cmd_string += ":" + wd self.runCmd(env_cmd_string) - + # This time, the hidden library should be picked up. self.expect("run", substrs=["return", "12345"]) @@ -233,15 +240,14 @@ self.runCmd("run", RUN_SUCCEEDED) + ctx = self.platformContext + dylibName = ctx.shlib_prefix + 'loadunload_a.' + ctx.shlib_extension + localDylibPath = self.getBuildArtifact(dylibName) if lldb.remote_platform: - shlib_dir = lldb.remote_platform.GetWorkingDirectory() - else: - shlib_dir = self.mydir - - if self.platformIsDarwin(): - dylibName = 'libloadunload_a.dylib' + wd = lldb.remote_platform.GetWorkingDirectory() + remoteDylibPath = lldbutil.join_remote_paths(wd, dylibName) else: - dylibName = 'libloadunload_a.so' + remoteDylibPath = localDylibPath # Make sure that a_function does not exist at this point. self.expect( @@ -253,13 +259,10 @@ # Use lldb 'process load' to load the dylib. self.expect( - "process load %s --install" % - dylibName, - "%s loaded correctly" % - dylibName, + "process load %s --install=%s" % (localDylibPath, remoteDylibPath), + "%s loaded correctly" % dylibName, patterns=[ - 'Loading "%s".*ok' % - dylibName, + 'Loading "%s".*ok' % localDylibPath, 'Image [0-9]+ loaded']) # Search for and match the "Image ([0-9]+) loaded" pattern. @@ -366,6 +369,9 @@ substrs=['stopped', 'stop reason = step over']) + # We can't find a breakpoint location for d_init before launching because + # executable dependencies are resolved relative to the debuggers PWD. Bug? + @expectedFailureAll(oslist=["linux"]) @skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support @skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently def test_static_init_during_load(self): Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk @@ -13,11 +13,10 @@ include $(LEVEL)/Makefile.rules -.PHONY: $(DYLIB_FILENAME): lib_b -lib_b: - "$(MAKE)" -f b.mk +.PHONY lib_b: + $(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/b.mk clean:: - "$(MAKE)" -f b.mk clean + $(MAKE) -I $(SRCDIR) -f $(SRCDIR)/b.mk clean Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py @@ -45,7 +45,7 @@ retobj = lldb.SBCommandReturnObject() retval = debugger.GetCommandInterpreter().HandleCommand( - "plugin load %s" % plugin_lib_name, retobj) + "plugin load %s" % self.getBuildArtifact(plugin_lib_name), retobj) retobj.Clear() Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py +++ lldb/trunk/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) @@ -43,13 +43,13 @@ @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails def test_attach_to_process_from_different_dir_by_id(self): """Test attach by process id""" + newdir = self.getBuildArtifact("newdir") try: - os.mkdir(os.path.join(os.getcwd(),'newdir')) + os.mkdir(newdir) except OSError, e: if e.errno != os.errno.EEXIST: raise - testdir = os.getcwd() - newdir = os.path.join(testdir,'newdir') + testdir = self.getBuildDir() exe = os.path.join(newdir, 'proc_attach') self.buildProgram('main.cpp', exe) self.addTearDownHook(lambda: shutil.rmtree(newdir)) @@ -58,7 +58,7 @@ popen = self.spawnSubprocess(exe) self.addTearDownHook(self.cleanupSubprocesses) - os.chdir('newdir') + os.chdir(newdir) self.addTearDownHook(lambda: os.chdir(testdir)) self.runCmd("process attach -p " + str(popen.pid)) @@ -71,7 +71,7 @@ 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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py @@ -132,7 +132,9 @@ out_file_name = "my_working_dir_test.out" err_file_name = "my_working_dir_test.err" - my_working_dir_path = os.path.join(os.getcwd(), mywd) + my_working_dir_path = self.getBuildArtifact(mywd) + try: os.makedirs(my_working_dir_path) + except: pass out_file_path = os.path.join(my_working_dir_path, out_file_name) err_file_path = os.path.join(my_working_dir_path, err_file_name) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py @@ -35,6 +35,8 @@ """Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it.""" import pexpect self.buildDefault() + try: os.makedirs(self.getBuildArtifact("path with '09")) + except: pass system([["cp", self.getBuildArtifact("a.out"), "\"%s\"" % self.getBuildArtifact(self.myexe)]]) Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py +++ lldb/trunk/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() @@ -114,7 +114,8 @@ def do_target_variable_command(self, exe_name): """Exercise 'target variable' command before and after starting the inferior.""" - self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact(exe_name), + CURRENT_EXECUTABLE_SET) self.expect( "target variable my_global_char", @@ -206,7 +207,8 @@ def do_target_variable_command_no_fail(self, exe_name): """Exercise 'target variable' command before and after starting the inferior.""" - self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact(exe_name), + CURRENT_EXECUTABLE_SET) self.expect( "target variable my_global_char", Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile @@ -4,6 +4,7 @@ ENABLE_THREADS := YES -VPATH = .. - include $(LEVEL)/Makefile.rules + +main.cpp: ../main.cpp + cp $< $@ Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile @@ -1,18 +1,16 @@ LEVEL := ../../../make -LD_EXTRAS := -L. -l$(LIB_PREFIX)One -l$(LIB_PREFIX)Two +LD_EXTRAS := -L. -LOne -l$(LIB_PREFIX)One -LTwo -l$(LIB_PREFIX)Two C_SOURCES := main.c -main.o : CFLAGS_EXTRAS += -g -O0 - include $(LEVEL)/Makefile.rules .PHONY: a.out: lib_One lib_Two lib_%: - $(MAKE) -f $*.mk + $(MAKE) VPATH=$(SRCDIR)/$* -I $(SRCDIR) -f $(SRCDIR)/$*.mk clean:: - $(MAKE) -f One.mk clean - $(MAKE) -f Two.mk clean + $(MAKE) -f $(SRCDIR)/One.mk clean + $(MAKE) -f $(SRCDIR)/Two.mk clean Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk @@ -1,12 +1,12 @@ LEVEL := ../../../make DYLIB_NAME := One -DYLIB_C_SOURCES := One/One.c One/OneConstant.c +DYLIB_C_SOURCES := One.c OneConstant.c DYLIB_ONLY := YES include $(LEVEL)/Makefile.rules CFLAGS_EXTRAS += -fPIC -One/OneConstant.o: One/OneConstant.c +OneConstant.o: OneConstant.c $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@ Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py @@ -16,6 +16,11 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True + def setUp(self): + TestBase.setUp(self) + lldbutil.mkdir_p(self.getBuildArtifact("One")) + lldbutil.mkdir_p(self.getBuildArtifact("Two")) + def test_conflicting_symbols(self): self.build() exe = self.getBuildArtifact("a.out") Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk +++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk @@ -1,12 +1,12 @@ LEVEL := ../../../make DYLIB_NAME := Two -DYLIB_C_SOURCES := Two/Two.c Two/TwoConstant.c +DYLIB_C_SOURCES := Two.c TwoConstant.c DYLIB_ONLY := YES include $(LEVEL)/Makefile.rules CFLAGS_EXTRAS += -fPIC -Two/TwoConstant.o: Two/TwoConstant.c +TwoConstant.o: TwoConstant.c $(CC) $(CFLAGS_NO_DEBUG) -c $< -o $@ Index: lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py @@ -13,9 +13,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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile @@ -9,11 +9,11 @@ a.out: lib_a lib_b lib_%: - $(MAKE) -f $*.mk + $(MAKE) VPATH=$(VPATH) -f $(SRCDIR)/$*.mk hidden_lib_d: $(MAKE) -C hidden clean:: - $(MAKE) -f a.mk clean - $(MAKE) -f b.mk clean + $(MAKE) -f $(SRCDIR)/a.mk clean + $(MAKE) -f $(SRCDIR)/b.mk clean Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile @@ -1,38 +1,23 @@ LEVEL = ../../../make -CC ?= clang -ifeq "$(ARCH)" "" - ARCH = x86_64 -endif +LD_EXTRAS = -lobjc -framework Foundation -ifeq "$(OS)" "" - OS = $(shell uname -s) -endif +include $(LEVEL)/Makefile.rules -CFLAGS ?= -g -O0 - -ifeq "$(OS)" "Darwin" - CFLAGS += -arch $(ARCH) -endif - -LDFLAGS = $(CFLAGS) -lobjc -framework Foundation - -all: a.out libTest.dylib libTestExt.dylib +all: a.out libTest.dylib: Test/Test.m - $(CC) $(CFLAGS) -I. -c -o Test.o Test/Test.m - $(CC) $(LDFLAGS) -shared -o libTest.dylib Test.o - dsymutil libTest.dylib + mkdir -p Test + $(MAKE) MAKE_DSYM=YES VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/Test/Test.mk all libTestExt.dylib: TestExt/TestExt.m - $(CC) $(CFLAGS) -I. -c -o TestExt.o TestExt/TestExt.m - $(CC) $(LDFLAGS) -L. -lTest -shared -o libTestExt.dylib TestExt.o - dsymutil libTestExt.dylib + mkdir -p TestExt + $(MAKE) MAKE_DSYM=YES VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/TestExt/TestExt.mk all a.out: main.m libTest.dylib libTestExt.dylib - $(CC) $(LDFLAGS) -I. -L. -lTest -lTestExt -o a.out main.m - -.PHONY: clean + $(CC) $(LDFLAGS) -I$(SRCDIR) -L. -lTest -lTestExt -o a.out $< -clean: - rm -rf libTest.dylib libTestExt.dylib a.out Test.o TestExt.o libTest.dylib.dSYM libTest.dylib.dSYM +clean:: + rm -rf libTest.dylib libTestExt.dylib a.out Test.o TestExt.o libTest.dylib.dSYM libTestExt.dylib.dSYM + $(MAKE) MAKE_DSYM=YES VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/Test/Test.mk clean + $(MAKE) MAKE_DSYM=YES VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/TestExt/TestExt.mk clean Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk @@ -0,0 +1,10 @@ +LEVEL = ../../../make + +DYLIB_NAME := Test +DYLIB_ONLY := YES +CFLAGS_EXTRAS = -I$(SRCDIR)/.. +LD_EXTRAS = -lobjc -framework Foundation + +DYLIB_OBJC_SOURCES = Test/Test.m + +include $(LEVEL)/Makefile.rules Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk @@ -0,0 +1,10 @@ +LEVEL = ../../../make + +DYLIB_NAME := TestExt +DYLIB_ONLY := YES +CFLAGS_EXTRAS = -I$(SRCDIR)/.. +LD_EXTRAS = -L. -lTest -lobjc -framework Foundation + +DYLIB_OBJC_SOURCES = TestExt/TestExt.m + +include $(LEVEL)/Makefile.rules Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py @@ -84,10 +84,12 @@ if strip: self.assertTrue(subprocess.call( - ['/usr/bin/strip', '-Sx', 'libInternalDefiner.dylib']) == 0, 'stripping dylib succeeded') - self.assertTrue(subprocess.call(['/bin/rm', - '-rf', - 'libInternalDefiner.dylib.dSYM']) == 0, + ['/usr/bin/strip', '-Sx', + self.getBuildArtifact('libInternalDefiner.dylib')]) == 0, + 'stripping dylib succeeded') + self.assertTrue(subprocess.call( + ['/bin/rm', '-rf', + self.getBuildArtifact('libInternalDefiner.dylib.dSYM')]) == 0, 'remove dylib dSYM file succeeded') self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx', self.getBuildArtifact("a.out") Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile @@ -19,8 +19,8 @@ all: aout aout: - $(CC) $(CFLAGS_NO_DEBUG) myclass.m -c -o myclass.o - $(CC) $(CFLAGS) myclass.o repro.m -framework Foundation + $(CC) $(CFLAGS_NO_DEBUG) $(SRCDIR)/myclass.m -c -o myclass.o + $(CC) $(CFLAGS) myclass.o $(SRCDIR)/repro.m -framework Foundation clean:: rm -f myclass.o Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile @@ -3,7 +3,7 @@ OBJC_SOURCES := main.m LDFLAGS = $(CFLAGS) -lobjc -framework Foundation -default: a.out.stripped +all: a.out.stripped a.out.stripped: a.out.dSYM strip -o a.out.stripped a.out Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py @@ -554,6 +554,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")) @@ -718,9 +719,28 @@ lldb.remote_platform.Run(shell_cmd) self.addTearDownHook(clean_working_directory) + def getSourceDir(self): + """Return the full path to the current test.""" + return os.path.join(os.environ["LLDB_TEST"], self.mydir) + + def getBuildDir(self): + """Return the full path to the current test.""" + return os.path.join(os.environ["LLDB_BUILD"], self.mydir) + + + def makeBuildDir(self): + """Create the test-specific working directory.""" + # See also dotest.py which sets up ${LLDB_BUILD}. + try: os.makedirs(self.getBuildDir()) + except: pass + def getBuildArtifact(self, name="a.out"): """Return absolute path to an artifact in the test's build directory.""" - return os.path.join(os.getcwd(), name) + return os.path.join(self.getBuildDir(), name) + + def getSourcePath(self, name): + """Return absolute path to a file in the test's source directory.""" + return os.path.join(self.getSourceDir(), name) def setUp(self): """Fixture for unittest test case setup. @@ -855,6 +875,7 @@ self.framework_dir = None self.dsym = None self.darwinWithFramework = False + self.makeBuildDir() def setAsync(self, value): """ Sets async mode to True/False and ensures it is reset after the testcase completes.""" @@ -1407,7 +1428,6 @@ """ Platform-specific way to build a program that links with LLDB (via the liblldb.so or LLDB.framework). """ - stdflag = self.getstdFlag() stdlibflag = self.getstdlibFlag() @@ -1495,18 +1515,18 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build the default binaries.""" + if not testdir: + testdir = self.mydir if self.debug_info: raise Exception("buildDefault tests must set NO_DEBUG_INFO_TESTCASE") module = builder_module() + self.makeBuildDir() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildDefault( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildDefault(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build default binary") def buildDsym( @@ -1514,16 +1534,15 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dsym info.""" + if not testdir: + testdir = self.mydir module = builder_module() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildDsym( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildDsym(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build binary with dsym") def buildDwarf( @@ -1531,16 +1550,15 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dwarf maps.""" + if not testdir: + testdir = self.mydir module = builder_module() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildDwarf( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildDwarf(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build binary with dwarf") def buildDwo( @@ -1548,16 +1566,15 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with dwarf maps.""" + if not testdir: + testdir = self.mydir module = builder_module() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildDwo( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildDwo(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build binary with dwo") def buildGModules( @@ -1565,16 +1582,15 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Platform specific way to build binaries with gmodules info.""" + if not testdir: + testdir = self.mydir module = builder_module() dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) - if not module.buildGModules( - self, - architecture, - compiler, - dictionary, - clean): + if not module.buildGModules(self, architecture, compiler, + dictionary, clean, testdir): raise Exception("Don't know how to build binary with gmodules") def buildGo(self): @@ -1869,8 +1885,9 @@ timeWaitNextLaunch = 1.0 def generateSource(self, source): + self.makeBuildDir() template = source + '.template' - temp = os.path.join(os.getcwd(), template) + temp = os.path.join(self.getSourceDir(), template) with open(temp, 'r') as f: content = f.read() @@ -1889,7 +1906,7 @@ header.startswith("SB") and header.endswith(".h"))] includes = '\n'.join(list) new_content = content.replace('%include_SB_APIs%', includes) - src = os.path.join(os.getcwd(), source) + src = os.path.join(self.getBuildDir(), source) with open(src, 'w') as f: f.write(new_content) @@ -1950,12 +1967,12 @@ else: # Check relative names local_shlib_path = os.path.join( - os.getcwd(), shlib_prefix + name + shlib_extension) + self.getBuildDir(), shlib_prefix + name + shlib_extension) if not os.path.exists(local_shlib_path): local_shlib_path = os.path.join( - os.getcwd(), name + shlib_extension) + self.getBuildDir(), name + shlib_extension) if not os.path.exists(local_shlib_path): - local_shlib_path = os.path.join(os.getcwd(), name) + local_shlib_path = os.path.join(self.getBuildDir(), name) # Make sure we found the local shared library in the above code self.assertTrue(os.path.exists(local_shlib_path)) @@ -2002,7 +2019,7 @@ return lldb.remote_platform.GetWorkingDirectory() else: # local tests change directory into each test subdirectory - return os.getcwd() + return self.getBuildDir() def tearDown(self): #import traceback @@ -2287,18 +2304,24 @@ clean=True): """Platform specific way to build the default binaries.""" module = builder_module() + self.makeBuildDir() + dictionary = lldbplatformutil.finalize_build_dictionary(dictionary) if self.debug_info is None: - return self.buildDefault(architecture, compiler, dictionary, clean) + return self.buildDefault(architecture, compiler, dictionary, + clean, self.mydir) elif self.debug_info == "dsym": - return self.buildDsym(architecture, compiler, dictionary, clean) + return self.buildDsym(architecture, compiler, dictionary, + clean, self.mydir) elif self.debug_info == "dwarf": - return self.buildDwarf(architecture, compiler, dictionary, clean) + return self.buildDwarf(architecture, compiler, dictionary, + clean, self.mydir) elif self.debug_info == "dwo": - return self.buildDwo(architecture, compiler, dictionary, clean) + return self.buildDwo(architecture, compiler, dictionary, + clean, self.mydir) elif self.debug_info == "gmodules": - return self.buildGModules( - architecture, compiler, dictionary, clean) + return self.buildGModules(architecture, compiler, dictionary, + clean, self.mydir) else: self.fail("Can't build for debug info: %s" % self.debug_info) Index: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py +++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py @@ -9,6 +9,7 @@ # System modules import collections +import errno import os import re import sys @@ -44,6 +45,14 @@ return exe_file return None +def mkdir_p(path): + try: + os.makedirs(path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + if not os.path.isdir(path): + raise OSError(errno.ENOTDIR, "%s is not a directory"%path) # =================================================== # Disassembly for an SBFunction or an SBSymbol object # =================================================== Index: lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile @@ -13,10 +13,10 @@ CFLAGS += -arch $(ARCH) endif -all: clean +all: main.c clean mkdir hide.app mkdir hide.app/Contents - $(CC) $(CFLAGS) -g main.c + $(CC) $(CFLAGS) -g $< mv a.out.dSYM hide.app/Contents strip -x a.out Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile @@ -1,3 +1,5 @@ +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + CC ?= clang ifeq "$(ARCH)" "" @@ -8,9 +10,12 @@ all: TestApp.app/Contents/MacOS/TestApp -TestApp.app/Contents/MacOS/TestApp: - $(CC) $(CFLAGS) -o TestApp main.c +TestApp.app/Contents/MacOS/TestApp: $(SRCDIR)/main.c + $(CC) $(CFLAGS) -o TestApp $< + rm -rf TestApp.app + cp -r $(SRCDIR)/TestApp.app . mv TestApp TestApp.app/Contents/MacOS/TestApp mv TestApp.dSYM TestApp.app.dSYM + clean: rm -rf TestApp.app/Contents/MacOS/TestApp TestApp.app.dSYM Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile @@ -1,3 +1,5 @@ +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + CC ?= clang ifeq "$(ARCH)" "" @@ -7,7 +9,7 @@ CFLAGS ?= -g -O0 -arch $(ARCH) all: clean - $(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd bundle.c + $(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd $(SRCDIR)/bundle.c mkdir com.apple.sbd.xpc mv com.apple.sbd com.apple.sbd.xpc/ mkdir -p com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF @@ -15,7 +17,7 @@ rm -rf com.apple.sbd.dSYM mkdir hide.app tar cf - com.apple.sbd.xpc com.apple.sbd.xpc.dSYM | ( cd hide.app;tar xBpf -) - $(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn main.c + $(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn $(SRCDIR)/main.c clean: rm -rf a.out a.out.dSYM hide.app com.apple.sbd com.apple.sbd.dSYM com.apple.sbd.xpc com.apple.sbd.xpc.dSYM find-bundle-with-dots-in-fn find-bundle-with-dots-in-fn.dSYM Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py @@ -37,8 +37,9 @@ def test_attach_and_check_dsyms(self): """Test attach to binary, see if the bundle dSYM is found""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) self.build() + os.chdir(self.getBuildDir()); popen = self.spawnSubprocess(exe) self.addTearDownHook(self.cleanupSubprocesses) @@ -66,6 +67,7 @@ dsym_name = mod.GetSymbolFileSpec().GetFilename() self.assertTrue (dsym_name == 'com.apple.sbd', "Check that we found the dSYM for the bundle that was loaded") i=i+1 + os.chdir(self.getSourceDir()); if __name__ == '__main__': unittest.main() Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile @@ -1,3 +1,5 @@ +SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ + CC ?= clang ifeq "$(ARCH)" "" @@ -7,12 +9,12 @@ CFLAGS ?= -g -O0 -arch $(ARCH) all: clean - $(CC) $(CFLAGS) -install_name $(PWD)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework myframework.c + $(CC) $(CFLAGS) -install_name $(shell pwd)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework $(SRCDIR)/myframework.c mkdir -p MyFramework.framework/Versions/A/Headers mkdir -p MyFramework.framework/Versions/A/Resources cp MyFramework MyFramework.framework/Versions/A - cp MyFramework.h MyFramework.framework/Versions/A/Headers - cp Info.plist MyFramework.framework/Versions/A/Resources + cp $(SRCDIR)/MyFramework.h MyFramework.framework/Versions/A/Headers + cp $(SRCDIR)/Info.plist MyFramework.framework/Versions/A/Resources ( cd MyFramework.framework/Versions ; ln -s A Current ) ( cd MyFramework.framework/ ; ln -s Versions/Current/Headers . ) ( cd MyFramework.framework/ ; ln -s Versions/Current/MyFramework . ) @@ -21,8 +23,8 @@ mkdir hide.app rm -f MyFramework tar cf - MyFramework.framework MyFramework.framework.dSYM | ( cd hide.app;tar xBpf -) - $(CC) $(CFLAGS) -o deep-bundle main.c -F. -framework MyFramework - + $(CC) $(CFLAGS) -o deep-bundle $(SRCDIR)/main.c -F. -framework MyFramework + clean: rm -rf a.out a.out.dSYM deep-bundle deep-bundle.dSYM MyFramework.framework MyFramework.framework.dSYM MyFramework MyFramework.dSYM hide.app Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py @@ -37,9 +37,9 @@ def test_attach_and_check_dsyms(self): """Test attach to binary, see if the framework dSYM is found""" - exe = os.path.join(os.getcwd(), exe_name) + exe = self.getBuildArtifact(exe_name) self.build() - popen = self.spawnSubprocess(exe) + popen = self.spawnSubprocess(exe, [self.getBuildDir()]) self.addTearDownHook(self.cleanupSubprocesses) # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in @@ -49,7 +49,6 @@ # binary & dSYM via target.exec-search-paths settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app" self.runCmd(settings_str) - self.runCmd("process attach -p " + str(popen.pid)) target = self.dbg.GetSelectedTarget() Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c @@ -1,12 +1,17 @@ #include #include +#include #include int setup_is_complete = 0; -int main() +int main(int argc, const char **argv) { - system ("/bin/rm -rf MyFramework MyFramework.framework MyFramework.framework.dSYM"); + char command[8192]; + sprintf (command, + "/bin/rm -rf %s/MyFramework %s/MyFramework.framework %s/MyFramework.framework.dSYM", + argv[1], argv[1], argv[1]); + system (command); setup_is_complete = 1; Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile @@ -1,7 +1,7 @@ LEVEL = ../../make C_SOURCES := main.c -LDFLAGS = $(CFLAGS) -Xlinker -order_file -Xlinker ./order-file +LDFLAGS = $(CFLAGS) -Xlinker -order_file -Xlinker $(SRCDIR)/order-file MAKE_DSYM := NO include $(LEVEL)/Makefile.rules Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/Makefile +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/Makefile =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/Makefile @@ -1,19 +1,21 @@ CC ?= clang +all: testit + testit: testit.i386 testit.x86_64 - lipo -create -o testit testit.i386 testit.x86_64 + lipo -create -o testit $^ testit.i386: testit.i386.o - $(CC) -arch i386 -o testit.i386 testit.i386.o + $(CC) -arch i386 -o testit.i386 $< testit.x86_64: testit.x86_64.o - $(CC) -arch x86_64 -o testit.x86_64 testit.x86_64.o + $(CC) -arch x86_64 -o testit.x86_64 $< testit.i386.o: main.c - $(CC) -g -O0 -arch i386 -c -o testit.i386.o main.c + $(CC) -g -O0 -arch i386 -c -o testit.i386.o $< testit.x86_64.o: main.c - $(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o main.c + $(CC) -g -O0 -arch x86_64 -c -o testit.x86_64.o $< clean: rm -rf $(wildcard testit* *~) Index: lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules +++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules @@ -6,6 +6,7 @@ # OBJC_SOURCES := # OBJCXX_SOURCES := # DYLIB_C_SOURCES := +# DYLIB_OBJC_SOURCES := # DYLIB_CXX_SOURCES := # # Specifying DYLIB_ONLY has the effect of building dylib only, skipping @@ -27,7 +28,8 @@ # Uncomment line below for debugging shell commands # SHELL = /bin/sh -x -THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ +SRCDIR := $(shell dirname $(firstword $(MAKEFILE_LIST)))/ +THIS_FILE_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/ LLDB_BASE_DIR := $(THIS_FILE_DIR)../../../../../ @@ -223,7 +225,7 @@ CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) -I$(LLDB_BASE_DIR)include endif -CFLAGS += -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR) +CFLAGS += -I$(SRCDIR) -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR) CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS) # Use this one if you want to build one part of the result without debug information: @@ -494,23 +496,6 @@ #---------------------------------------------------------------------- #---------------------------------------------------------------------- -# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO" -#---------------------------------------------------------------------- -ifneq "$(DYLIB_ONLY)" "YES" -$(DSYM) : $(EXE) -ifeq "$(OS)" "Darwin" -ifneq "$(MAKE_DSYM)" "NO" - "$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)" -endif -else -ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" - $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)" - $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)" -endif -endif -endif - -#---------------------------------------------------------------------- # Compile the executable from all the objects. #---------------------------------------------------------------------- ifneq "$(DYLIB_NAME)" "" @@ -526,6 +511,22 @@ endif #---------------------------------------------------------------------- +# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO" +#---------------------------------------------------------------------- +$(DSYM) : $(EXE) +ifeq "$(OS)" "Darwin" +ifneq "$(MAKE_DSYM)" "NO" + "$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)" +else +endif +else +ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" + $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)" + $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)" +endif +endif + +#---------------------------------------------------------------------- # Make the archive #---------------------------------------------------------------------- ifneq "$(ARCHIVE_NAME)" "" @@ -565,7 +566,7 @@ #ifneq "$(PCH_OUTPUT)" "" $(PCH_OUTPUT) : $(PCH_CXX_SOURCE) - $(CXX) $(CXXFLAGS) -x c++-header -o $(PCH_OUTPUT) $(PCH_CXX_SOURCE) + $(CXX) $(CXXFLAGS) -x c++-header -o $@ $< %.o : %.cpp $(PCH_OUTPUT) $(CXX) $(PCHFLAGS) $(CXXFLAGS) -c -o $@ $< #endif Index: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py +++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py @@ -50,13 +50,31 @@ return ("ARCHFLAG=" + archflag) if archflag else "" - -def getMake(): - """Returns the name for GNU make""" +def getMake(test_subdir): + """Returns the invocation for GNU make. + The argument test_subdir is the relative path to the testcase.""" if platform.system() == "FreeBSD" or platform.system() == "NetBSD": - return "gmake" + make = "gmake" else: - return "make" + make = "make" + + # Construct the base make invocation. + lldb_test = os.environ["LLDB_TEST"] + lldb_build = os.environ["LLDB_BUILD"] + if not (lldb_test and lldb_build and test_subdir and + (not os.path.isabs(test_subdir))): + raise Exception("Could not derive test directories") + build_dir = os.path.join(lldb_build, test_subdir) + test_dir = os.path.join(lldb_test, test_subdir) + # This is a bit of a hack to make inline testcases work. + makefile = os.path.join(test_dir, "Makefile") + if not os.path.isfile(makefile): + makefile = os.path.join(build_dir, "Makefile") + return [make, + "VPATH="+test_dir, + "-C", build_dir, + "-I", test_dir, + "-f", makefile] def getArchSpec(architecture): @@ -121,12 +139,13 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries the default way.""" commands = [] if clean: - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - commands.append([getMake(), getArchSpec(architecture), + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + [getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) @@ -140,12 +159,13 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries with dwarf debug info.""" commands = [] if clean: - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec( + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + ["MAKE_DSYM=NO", getArchSpec( architecture), getCCSpec(compiler), getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) @@ -158,13 +178,17 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries with dwarf debug info.""" commands = [] if clean: - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec( - architecture), getCCSpec(compiler), getCmdLine(dictionary)]) + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + + ["MAKE_DSYM=NO", "MAKE_DWO=YES", + getArchSpec(architecture), + getCCSpec(compiler), + getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) # True signifies that we can handle building dwo. @@ -176,13 +200,14 @@ architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries with dwarf debug info.""" commands = [] if clean: - commands.append([getMake(), "clean", getCmdLine(dictionary)]) - commands.append([getMake(), - "MAKE_DSYM=NO", + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + + ["MAKE_DSYM=NO", "MAKE_GMODULES=YES", getArchSpec(architecture), getCCSpec(compiler), @@ -195,12 +220,4 @@ def 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 Index: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py +++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py @@ -5,20 +5,23 @@ from builder_base import * - def buildDsym( sender=None, architecture=None, compiler=None, dictionary=None, - clean=True): + clean=True, + testdir=None): """Build the binaries with dsym debug info.""" commands = [] if clean: - commands.append(["make", "clean", getCmdLine(dictionary)]) - commands.append(["make", "MAKE_DSYM=YES", getArchSpec( - architecture), getCCSpec(compiler), getCmdLine(dictionary)]) + commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)]) + commands.append(getMake(testdir) + + ["MAKE_DSYM=YES", + getArchSpec(architecture), + getCCSpec(compiler), + "all", getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) Index: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py @@ -28,10 +28,12 @@ self.setTearDownCleanup() """Test Python APIs for working with formatters""" - self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact("a.out"), + CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( - self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + self, "main.cpp", self.line, num_expected_locations=1, + loc_exact=True) self.runCmd("run", RUN_SUCCEEDED) @@ -439,7 +441,8 @@ self.build(dictionary={'EXE': 'no_synth'}) self.setTearDownCleanup() - self.runCmd("file no_synth", CURRENT_EXECUTABLE_SET) + self.runCmd("file " + self.getBuildArtifact("no_synth"), + CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) Index: lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py +++ lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py @@ -19,7 +19,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: lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py +++ lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py @@ -22,7 +22,7 @@ @classmethod def classCleanup(cls): """Cleanup the test byproducts.""" - cls.RemoveTempFile("stdout.txt") + cls.RemoveTempFile(self.getBuildArtifact("stdout.txt")) @no_debug_info_test def test_no_quote(self): @@ -82,16 +82,22 @@ exe = self.getBuildArtifact("a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) - self.runCmd("process launch -- " + args_in) + local_outfile = self.getBuildArtifact("output.txt") + if lldb.remote_platform: + remote_outfile = "output.txt" # Relative to platform's PWD + else: + remote_outfile = local_outfile + + self.runCmd("process launch -- %s %s" %(remote_outfile, args_in)) if lldb.remote_platform: - src_file_spec = lldb.SBFileSpec('output.txt', False) - dst_file_spec = lldb.SBFileSpec('output.txt', True) + src_file_spec = lldb.SBFileSpec(remote_outfile, False) + dst_file_spec = lldb.SBFileSpec(local_outfile, True) lldb.remote_platform.Get(src_file_spec, dst_file_spec) - with open('output.txt', 'r') as f: + with open(local_outfile, 'r') as f: output = f.read() - self.RemoveTempFile("output.txt") + self.RemoveTempFile(local_outfile) self.assertEqual(output, args_out) Index: lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/main.c =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/main.c +++ lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/main.c @@ -8,11 +8,11 @@ { int i; - FILE *output = fopen ("output.txt", "w"); + FILE *output = fopen (argv[1], "w"); if (output == NULL) exit (1); - for (i = 1; i < argc; ++i) + for (i = 2; i < argc; ++i) fwrite(argv[i], strlen(argv[i])+1, 1, output); fclose (output); Index: lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py @@ -13,6 +13,7 @@ mydir = None myexe = None mylog = None + NO_DEBUG_INFO_TESTCASE = True @classmethod def classCleanup(cls): @@ -22,7 +23,11 @@ TestBase.RemoveTempFile(cls.mylog) def setUp(self): + if not self.mydir: + raise("mydir is empty") + Base.setUp(self) + self.makeBuildDir() self.buildDefault() self.child_prompt = "(gdb)" self.myexe = self.getBuildArtifact("a.out") Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py +++ lldb/trunk/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: lldb/trunk/packages/Python/lldbsuite/test/types/AbstractBase.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/types/AbstractBase.py +++ lldb/trunk/packages/Python/lldbsuite/test/types/AbstractBase.py @@ -34,7 +34,7 @@ # module cacheing subsystem to be confused with executable name "a.out" # used for all the test cases. self.exe_name = self.testMethodName - self.golden_filename = os.path.join(os.getcwd(), "golden-output.txt") + self.golden_filename = self.getBuildArtifact("golden-output.txt") def tearDown(self): """Cleanup the test byproducts.""" @@ -113,8 +113,8 @@ quotedDisplay=False, blockCaptured=False): """Test that variables with basic types are displayed correctly.""" - - self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET) + self.runCmd("file %s" % self.getBuildArtifact(exe_name), + CURRENT_EXECUTABLE_SET) # First, capture the golden output emitted by the oracle, i.e., the # series of printf statements. @@ -210,7 +210,8 @@ 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: lldb/trunk/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py =================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py +++ lldb/trunk/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py @@ -64,7 +64,7 @@ def generate_main_cpp(self, version=0): """Generate main.cpp from main.cpp.template.""" - temp = os.path.join(os.getcwd(), self.template) + temp = os.path.join(self.getSourceDir(), self.template) with open(temp, 'r') as f: content = f.read() @@ -72,7 +72,8 @@ '%ADD_EXTRA_CODE%', 'printf("This is version %d\\n");' % version) - src = os.path.join(os.getcwd(), self.source) + self.makeBuildDir() + src = os.path.join(self.getBuildDir(), self.source) with open(src, 'w') as f: f.write(new_content) @@ -86,11 +87,13 @@ exe_path = self.getBuildArtifact(exe_name) self.runCmd("file " + exe_path, CURRENT_EXECUTABLE_SET) - wrong_path = os.path.join("%s.dSYM" % exe_name, "Contents") + wrong_path = os.path.join(self.getBuildDir(), + "%s.dSYM" % exe_name, "Contents") self.expect("add-dsym " + wrong_path, error=True, substrs=['invalid module path']) right_path = os.path.join( + self.getBuildDir(), "%s.dSYM" % exe_path, "Contents", @@ -108,6 +111,7 @@ # This time, the UUID should match and we expect some feedback from # lldb. right_path = os.path.join( + self.getBuildDir(), "%s.dSYM" % exe_path, "Contents", Index: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -5136,10 +5136,8 @@ FileSpec file_spec = exec_dir.CopyByAppendingPathComponent(at_exec_relative_path); file_spec = file_spec.GetNormalizedPath(); - if (file_spec.Exists() && files.AppendIfUnique(file_spec)) { + if (file_spec.Exists() && files.AppendIfUnique(file_spec)) count++; - break; - } } } } Index: lldb/trunk/test/CMakeLists.txt =================================================================== --- lldb/trunk/test/CMakeLists.txt +++ lldb/trunk/test/CMakeLists.txt @@ -6,6 +6,8 @@ ) add_custom_target(${name} + # Clear the test directory first. + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/lldb-test-build COMMAND ${PYTHON_TEST_COMMAND} ${ARG_DEFAULT_ARGS} COMMENT "${comment}" DEPENDS ${LLDB_TEST_DEPS} @@ -60,6 +62,8 @@ --executable $ -s ${CMAKE_BINARY_DIR}/lldb-test-traces + --build-dir + ${CMAKE_BINARY_DIR}/lldb-test-build -S nm -u CXXFLAGS -u CFLAGS