[Lldb-commits] [lldb] r323803 - Compile the LLDB tests out-of-tree.

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 30 10:29:17 PST 2018


Author: adrian
Date: Tue Jan 30 10:29:16 2018
New Revision: 323803

URL: http://llvm.org/viewvc/llvm-project?rev=323803&view=rev
Log:
Compile the LLDB tests out-of-tree.

This patch is the result of a discussion on lldb-dev, see
http://lists.llvm.org/pipermail/lldb-dev/2018-January/013111.html for
background.

For each test (should be eventually: each test configuration) a
separate build directory is created and we execute

  make VPATH=$srcdir/path/to/test -C $builddir/path/to/test -f $srcdir/path/to/test/Makefile -I $srcdir/path/to/test

In order to make this work all LLDB tests need to be updated to find
the executable in the test build directory, since CWD still points at
the test's source directory, which is a requirement for unittest2.

Although we have done extensive testing, I'm expecting that this first
attempt will break a few bots. Please DO NOT HESITATE TO REVERT this
patch in order to get the bots green again. We will likely have to
iterate on this some more.

Differential Revision: https://reviews.llvm.org/D42281

Added:
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk
Removed:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/my_working_dir/.keep
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/path with '09/.keep
Modified:
    lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt
    lldb/trunk/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py
    lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py
    lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py
    lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
    lldb/trunk/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py
    lldb/trunk/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py
    lldb/trunk/packages/Python/lldbsuite/test/configuration.py
    lldb/trunk/packages/Python/lldbsuite/test/darwin_log.py
    lldb/trunk/packages/Python/lldbsuite/test/dotest.py
    lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
    lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py
    lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py
    lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
    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_one_delay_breakpoint_threads/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/crash_with_break/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_watchpoint/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/delay_signal_break/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_watch_break/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_watchpoint/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_crash/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_watchpoints/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/signal_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_watch/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_watch/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/two_breakpoint_threads/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_signal/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_watchpoint_threads/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_delay_breakpoint/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/watch_break/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/watchpoint_delay_watchpoint_one_breakpoint/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.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/TestWatchpointCommandPython.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk
    lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk
    lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
    lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
    lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
    lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py
    lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py
    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/TestBundleWithDotInFilename.py
    lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
    lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c
    lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
    lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
    lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/Makefile
    lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
    lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
    lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
    lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py
    lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
    lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py
    lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
    lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py
    lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
    lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py
    lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
    lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/main.c
    lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py
    lldb/trunk/packages/Python/lldbsuite/test/types/AbstractBase.py
    lldb/trunk/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt (original)
+++ lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt Tue Jan 30 10:29:16 2018
@@ -135,15 +135,16 @@ see test/array_types/TestArrayTypes.py:
         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 @@ execution.  This can be accomplished by
 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 @@ door and grabs the output from the comma
 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 @@ And this asserts that the file 'stdout.t
 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 @@ file:
 
     @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

Modified: lldb/trunk/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py Tue Jan 30 10:29:16 2018
@@ -21,7 +21,6 @@ class SBDirCheckerCase(TestBase):
     def setUp(self):
         TestBase.setUp(self)
         self.source = 'main.cpp'
-        self.exe_name = self.getBuildArtifact("a.out")
         self.generateSource(self.source)
 
     @skipIfNoSBHeaders
@@ -35,16 +34,19 @@ class SBDirCheckerCase(TestBase):
             self.skipTest(
                 "LLDB is 64-bit and cannot be linked to 32-bit test program.")
 
-        self.buildDriver(self.source, self.exe_name)
-        self.sanity_check_executable(self.exe_name)
+        exe_name = self.getBuildArtifact("a.out")
+        self.buildDriver(self.source, exe_name)
+        self.sanity_check_executable(exe_name)
 
     def sanity_check_executable(self, exe_name):
         """Sanity check executable compiled from the auto-generated program."""
+        exe_name = self.getBuildArtifact("a.out")
         exe = self.getBuildArtifact(exe_name)
         self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET)
 
+        # This test uses a generated source file, so it's in the build directory.
         self.line_to_break = line_number(
-            self.source, '// Set breakpoint here.')
+            self.getBuildArtifact(self.source), '// Set breakpoint here.')
 
         env_cmd = "settings set target.env-vars %s=%s" % (
             self.dylibPath, self.getLLDBLibraryEnvVal())

Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py Tue Jan 30 10:29:16 2018
@@ -32,12 +32,12 @@ class TestMultipleSimultaneousDebuggers(
     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))
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multiple-targets/TestMultipleTargets.py Tue Jan 30 10:29:16 2018
@@ -26,7 +26,7 @@ class TestMultipleTargets(TestBase):
     def test_multiple_targets(self):
         env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
 
-        self.driver_exe = os.path.join(os.getcwd(), "multi-target")
+        self.driver_exe = self.getBuildArtifact("multi-target")
         self.buildDriver('main.cpp', self.driver_exe)
         self.addTearDownHook(lambda: os.remove(self.driver_exe))
         self.signBinary(self.driver_exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py Tue Jan 30 10:29:16 2018
@@ -89,14 +89,16 @@ class SBBreakpointCallbackCase(TestBase)
 
         self.inferior = 'inferior_program'
         self.buildProgram('inferior.cpp', self.inferior)
-        self.addTearDownHook(lambda: os.remove(self.inferior))
+        self.addTearDownHook(lambda:
+                             os.remove(self.getBuildArtifact(self.inferior)))
 
         self.buildDriver(sources, test_name)
-        self.addTearDownHook(lambda: os.remove(test_name))
+        self.addTearDownHook(lambda:
+                             os.remove(self.getBuildArtifact(test_name)))
 
-        test_exe = os.path.join(os.getcwd(), test_name)
+        test_exe = self.getBuildArtifact(test_name)
         self.signBinary(test_exe)
-        exe = [test_exe, self.inferior]
+        exe = [test_exe, self.getBuildArtifact(self.inferior)]
 
         env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
         if self.TraceOn():

Modified: lldb/trunk/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/arm/emulation/TestEmulations.py Tue Jan 30 10:29:16 2018
@@ -19,8 +19,7 @@ class ARMEmulationTestCase(TestBase):
 
     @no_debug_info_test
     def test_thumb_emulations(self):
-        current_dir = os.getcwd()
-        test_dir = os.path.join(current_dir, "new-test-files")
+        test_dir = os.path.join(self.getSourceDir(), "new-test-files")
         files = os.listdir(test_dir)
         thumb_files = list()
         for f in files:
@@ -33,8 +32,7 @@ class ARMEmulationTestCase(TestBase):
 
     @no_debug_info_test
     def test_arm_emulations(self):
-        current_dir = os.getcwd()
-        test_dir = os.path.join(current_dir, "new-test-files")
+        test_dir = os.path.join(self.getSourceDir(), "new-test-files")
         files = os.listdir(test_dir)
         arm_files = list()
         for f in files:

Modified: lldb/trunk/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/benchmarks/expression/TestRepeatedExprs.py Tue Jan 30 10:29:16 2018
@@ -94,7 +94,7 @@ class RepeatedExprsCase(BenchBase):
 
     def run_gdb_repeated_exprs(self, exe_name, count):
         import pexpect
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         # Set self.child_prompt, which is "(gdb) ".
         self.child_prompt = '(gdb) '

Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Tue Jan 30 10:29:16 2018
@@ -107,6 +107,9 @@ lldb_platform_name = None
 lldb_platform_url = None
 lldb_platform_working_dir = None
 
+# The base directory in which the tests are being built.
+test_build_dir = None
+
 # Parallel execution settings
 is_inferior_test_runner = False
 multiprocess_test_subdir = None

Modified: lldb/trunk/packages/Python/lldbsuite/test/darwin_log.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/darwin_log.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/darwin_log.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/darwin_log.py Tue Jan 30 10:29:16 2018
@@ -162,7 +162,7 @@ class DarwinLogTestBase(lldbtest.TestBas
         if enable_options is not None and len(enable_options) > 0:
             enable_cmd += ' ' + ' '.join(enable_options)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.run_lldb_to_breakpoint(exe, self.source, self.line,
                                     enable_command=enable_cmd,
                                     settings_commands=settings_commands)
@@ -382,7 +382,7 @@ class DarwinLogEventBasedTestBase(lldbte
         # 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.

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Tue Jan 30 10:29:16 2018
@@ -474,6 +474,8 @@ def parseOptionsAndInitTestdirs():
         configuration.lldb_platform_url = args.lldb_platform_url
     if args.lldb_platform_working_dir:
         configuration.lldb_platform_working_dir = args.lldb_platform_working_dir
+    if args.test_build_dir:
+        configuration.test_build_dir = args.test_build_dir
 
     if args.event_add_entries and len(args.event_add_entries) > 0:
         entries = {}
@@ -623,6 +625,12 @@ def setupSysPath():
 
     os.environ["LLDB_TEST"] = scriptPath
 
+    # Set up the root build directory.
+    builddir = configuration.test_build_dir
+    if not configuration.test_build_dir:
+        raise Exception("test_build_dir is not set")
+    os.environ["LLDB_BUILD"] = os.path.abspath(configuration.test_build_dir)
+
     # Set up the LLDB_SRC environment variable, so that the tests can locate
     # the LLDB source code.
     os.environ["LLDB_SRC"] = lldbsuite.lldb_root
@@ -1186,6 +1194,11 @@ def run_suite():
         configuration.lldb_platform_working_dir = None
         configuration.lldb_platform_url = None
 
+    # Set up the working directory.
+    # Note that it's not dotest's job to clean this directory.
+    try: os.makedirs(configuration.test_build_dir)
+    except: pass
+
     target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
 
     checkLibcxxSupport()

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py Tue Jan 30 10:29:16 2018
@@ -159,6 +159,12 @@ def create_parser():
         metavar='Codesigning identity',
         default='lldb_codesign',
         help='The codesigning identity to use')
+    group.add_argument(
+        '--build-dir',
+        dest='test_build_dir',
+        metavar='Test build directory',
+        default='lldb-test-build',
+        help='The root build directory for the tests. It will be removed before running.')
 
     # Configuration options
     group = parser.add_argument_group('Remote platform options')

Modified: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-overridden-method/TestCallOverriddenMethod.py Tue Jan 30 10:29:16 2018
@@ -31,7 +31,8 @@ class ExprCommandCallOverriddenMethod(Te
         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)
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py Tue Jan 30 10:29:16 2018
@@ -11,23 +11,24 @@ from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
-def enumerateJITFiles():
-    return [f for f in os.listdir(os.getcwd()) if f.startswith("jit")]
-    
-def countJITFiles():
-    return len(enumerateJITFiles())
-
-def cleanJITFiles():
-    for j in enumerateJITFiles():
-        os.remove(j)
-    return
-
 class SaveJITObjectsTestCase(TestBase):
     mydir = TestBase.compute_mydir(__file__)
 
+    def enumerateJITFiles(self):
+        return [f for f in os.listdir(self.getBuildDir()) if f.startswith("jit")]
+    
+    def countJITFiles(self):
+        return len(self.enumerateJITFiles())
+
+    def cleanJITFiles(self):
+        for j in self.enumerateJITFiles():
+            os.remove(j)
+        return
+
     @expectedFailureAll(oslist=["windows"])
     def test_save_jit_objects(self):
         self.build()
+        os.chdir(self.getBuildDir())
         src_file = "main.c"
         src_file_spec = lldb.SBFileSpec(src_file)
   
@@ -36,16 +37,17 @@ class SaveJITObjectsTestCase(TestBase):
 
         frame = thread.frames[0]
 
-        cleanJITFiles()
+        self.cleanJITFiles()
         frame.EvaluateExpression("(void*)malloc(0x1)")
-        self.assertTrue(countJITFiles() == 0,
+        self.assertTrue(self.countJITFiles() == 0,
                         "No files emitted with save-jit-objects=false")
 
         self.runCmd("settings set target.save-jit-objects true")
         frame.EvaluateExpression("(void*)malloc(0x1)")
-        jit_files_count = countJITFiles()
-        cleanJITFiles()
+        jit_files_count = self.countJITFiles()
+        self.cleanJITFiles()
         self.assertTrue(jit_files_count != 0,
                         "At least one file emitted with save-jit-objects=true")
 
         process.Kill()
+        os.chdir(self.getSourceDir())

Modified: lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/Makefile Tue Jan 30 10:29:16 2018
@@ -7,7 +7,7 @@ include $(LEVEL)/Makefile.rules
 a.out: dummy
 
 dummy:
-	$(MAKE) -f dummy.mk
+	$(MAKE) VPATH=$(VPATH) -I $(SRCDIR) -f $(SRCDIR)/dummy.mk
 
 clean::
-	$(MAKE) -f dummy.mk clean
+	$(MAKE) VPATH=$(VPATH) -I $(SRCDIR) -f $(SRCDIR)/dummy.mk clean

Modified: lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/top-level/TestTopLevelExprs.py Tue Jan 30 10:29:16 2018
@@ -45,7 +45,8 @@ class TopLevelExpressionsTestCase(TestBa
         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,

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/attach_resume/TestAttachResume.py Tue Jan 30 10:29:16 2018
@@ -30,7 +30,7 @@ class AttachResumeTestCase(TestBase):
     def process_attach_continue_interrupt_detach(self):
         """Test attach/continue/interrupt/detach"""
 
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         popen = self.spawnSubprocess(exe)
         self.addTearDownHook(self.cleanupSubprocesses)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py Tue Jan 30 10:29:16 2018
@@ -30,9 +30,8 @@ class BadAddressBreakpointTestCase(TestB
 
     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...

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py Tue Jan 30 10:29:16 2018
@@ -44,16 +44,16 @@ class BreakpointCaseSensitivityTestCase(
         # Create a target by the debugger.
         self.target = self.dbg.CreateTarget(exe)
         self.assertTrue(self.target, VALID_TARGET)
-        cwd = os.getcwd()
+        srcdir = self.getSourceDir()
 
         # try both BreakpointCreateByLocation and BreakpointCreateBySourceRegex
         for regex in [False, True]:
             # should always hit
             self.check_breakpoint('main.c', regex, True)
             # should always hit
-            self.check_breakpoint(os.path.join(cwd, 'main.c'), regex, True)
+            self.check_breakpoint(os.path.join(srcdir, 'main.c'), regex, True)
             # different case for directory
-            self.check_breakpoint(os.path.join(cwd.upper(), 'main.c'),
+            self.check_breakpoint(os.path.join(srcdir.upper(), 'main.c'),
                                   regex,
                                   case_insensitive)
             # different case for file
@@ -61,7 +61,7 @@ class BreakpointCaseSensitivityTestCase(
                                   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)
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py Tue Jan 30 10:29:16 2018
@@ -54,7 +54,7 @@ class RegexpBreakCommandTestCase(TestBas
             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(

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py Tue Jan 30 10:29:16 2018
@@ -63,7 +63,7 @@ class BreakpointNames(TestBase):
         # Create a targets we are making breakpoint in and copying to:
         self.target = self.dbg.CreateTarget(exe)
         self.assertTrue(self.target, VALID_TARGET)
-        self.main_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "main.c"))
+        self.main_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "main.c"))
         
     def check_name_in_target(self, bkpt_name):
         name_list = lldb.SBStringList()

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py Tue Jan 30 10:29:16 2018
@@ -15,7 +15,6 @@ class BreakpointSetRestart(TestBase):
     def test_breakpoint_set_restart(self):
         self.build()
 
-        cwd = os.getcwd()
         exe = self.getBuildArtifact("a.out")
 
         target = self.dbg.CreateTarget(exe)
@@ -33,9 +32,7 @@ class BreakpointSetRestart(TestBase):
                 break
 
         bp = target.BreakpointCreateBySourceRegex(
-            self.BREAKPOINT_TEXT, lldb.SBFileSpec(
-                os.path.join(
-                    cwd, 'main.cpp')))
+            self.BREAKPOINT_TEXT, lldb.SBFileSpec('main.cpp'))
         self.assertTrue(
             bp.IsValid() and bp.GetNumLocations() == 1,
             VALID_BREAKPOINT)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/Makefile Tue Jan 30 10:29:16 2018
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py Tue Jan 30 10:29:16 2018
@@ -13,7 +13,7 @@ from lldbsuite.test import lldbutil
 
 
 _EXE_NAME = 'CompDirSymLink'  # Must match Makefile
-_SRC_FILE = 'main.cpp'
+_SRC_FILE = 'relative.cpp'
 _COMP_DIR_SYM_LINK_PROP = 'plugin.symbol-file.dwarf.comp-dir-symlink-paths'
 
 
@@ -25,8 +25,11 @@ class CompDirSymLinkTestCase(TestBase):
         # Call super's setUp().
         TestBase.setUp(self)
         # Find the line number to break inside main().
-        self.line = line_number(_SRC_FILE, '// Set break point at this line.')
-        self.src_path = os.path.join(os.getcwd(), _SRC_FILE)
+        self.line = line_number(
+            os.path.join(self.getSourceDir(), "main.cpp"),
+            '// Set break point at this line.')
+        self.src_path = self.getBuildArtifact(_SRC_FILE)
+
 
     @skipIf(hostoslist=["windows"])
     def test_symlink_paths_set(self):
@@ -39,6 +42,7 @@ class CompDirSymLinkTestCase(TestBase):
 
     @skipIf(hostoslist=no_match(["linux"]))
     def test_symlink_paths_set_procselfcwd(self):
+        os.chdir(self.getBuildDir())
         pwd_symlink = '/proc/self/cwd'
         self.doBuild(pwd_symlink)
         self.runCmd(
@@ -59,15 +63,15 @@ class CompDirSymLinkTestCase(TestBase):
             self.line)
 
     def create_src_symlink(self):
-        pwd_symlink = os.path.join(os.getcwd(), 'pwd_symlink')
+        pwd_symlink = self.getBuildArtifact('pwd_symlink')
         if os.path.exists(pwd_symlink):
             os.unlink(pwd_symlink)
-        os.symlink(os.getcwd(), pwd_symlink)
+        os.symlink(self.getBuildDir(), pwd_symlink)
         self.addTearDownHook(lambda: os.remove(pwd_symlink))
         return pwd_symlink
 
     def doBuild(self, pwd_symlink):
         self.build(None, None, {'PWD': pwd_symlink}, True)
 
-        exe = os.path.join(os.getcwd(), _EXE_NAME)
+        exe = self.getBuildArtifact(_EXE_NAME)
         self.runCmd('file ' + exe, CURRENT_EXECUTABLE_SET)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py Tue Jan 30 10:29:16 2018
@@ -73,7 +73,7 @@ class BreakpointSerialization(TestBase):
         # Call super's setUp().
         TestBase.setUp(self)
 
-        self.bkpts_file_path = os.path.join(os.getcwd(), "breakpoints.json")
+        self.bkpts_file_path = self.getBuildArtifact("breakpoints.json")
         self.bkpts_file_spec = lldb.SBFileSpec(self.bkpts_file_path)
 
     def check_equivalence(self, source_bps, do_write = True):
@@ -119,7 +119,7 @@ class BreakpointSerialization(TestBase):
 
         empty_module_list = lldb.SBFileSpecList()
         empty_cu_list = lldb.SBFileSpecList()
-        blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+        blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c"))
 
         # It isn't actually important for these purposes that these breakpoint
         # actually have locations.
@@ -147,7 +147,7 @@ class BreakpointSerialization(TestBase):
         cu_list.Append(lldb.SBFileSpec("AnotherCU.c"))
         cu_list.Append(lldb.SBFileSpec("ThirdCU.c"))
 
-        blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+        blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c"))
 
         # It isn't actually important for these purposes that these breakpoint
         # actually have locations.
@@ -174,7 +174,7 @@ class BreakpointSerialization(TestBase):
 
         empty_module_list = lldb.SBFileSpecList()
         empty_cu_list = lldb.SBFileSpecList()
-        blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+        blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c"))
 
         # It isn't actually important for these purposes that these breakpoint
         # actually have locations.
@@ -218,7 +218,7 @@ class BreakpointSerialization(TestBase):
 
         empty_module_list = lldb.SBFileSpecList()
         empty_cu_list = lldb.SBFileSpecList()
-        blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+        blubby_file_spec = lldb.SBFileSpec(os.path.join(self.getSourceDir(), "blubby.c"))
 
         # It isn't actually important for these purposes that these breakpoint
         # actually have locations.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/command_script_immediate_output/TestCommandScriptImmediateOutput.py Tue Jan 30 10:29:16 2018
@@ -30,9 +30,10 @@ class CommandScriptImmediateOutputTestCa
     @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139")
     def test_command_script_immediate_output_console(self):
         """Test that LLDB correctly allows scripted commands to set immediate output to the console."""
+        self.makeBuildDir()
         self.launch(timeout=10)
 
-        script = os.path.join(os.getcwd(), 'custom_command.py')
+        script = os.path.join(self.getSourceDir(), 'custom_command.py')
         prompt = "\(lldb\) "
 
         self.sendline('command script import %s' % script, patterns=[prompt])
@@ -52,14 +53,15 @@ class CommandScriptImmediateOutputTestCa
     @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr26139")
     def test_command_script_immediate_output_file(self):
         """Test that LLDB correctly allows scripted commands to set immediate output to a file."""
+        self.makeBuildDir()
         self.launch(timeout=10)
 
-        test_files = {os.path.join(os.getcwd(), 'read.txt'): 'r',
-                      os.path.join(os.getcwd(), 'write.txt'): 'w',
-                      os.path.join(os.getcwd(), 'append.txt'): 'a',
-                      os.path.join(os.getcwd(), 'write_plus.txt'): 'w+',
-                      os.path.join(os.getcwd(), 'read_plus.txt'): 'r+',
-                      os.path.join(os.getcwd(), 'append_plus.txt'): 'a+'}
+        test_files = {self.getBuildArtifact('read.txt'): 'r',
+                      self.getBuildArtifact('write.txt'): 'w',
+                      self.getBuildArtifact('append.txt'): 'a',
+                      self.getBuildArtifact('write_plus.txt'): 'w+',
+                      self.getBuildArtifact('read_plus.txt'): 'r+',
+                      self.getBuildArtifact('append_plus.txt'): 'a+'}
 
         starter_string = 'Starter Garbage\n'
         write_string = 'writing to file with mode: '
@@ -68,7 +70,7 @@ class CommandScriptImmediateOutputTestCa
             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])

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py Tue Jan 30 10:29:16 2018
@@ -41,23 +41,23 @@ class ExecTestCase(TestBase):
         self.do_test(True)
 
     def do_test(self, skip_exec):
+        self.makeBuildDir()
+        exe = self.getBuildArtifact("a.out")
         if self.getArchitecture() == 'x86_64':
-            source = os.path.join(os.getcwd(), "main.cpp")
-            o_file = os.path.join(os.getcwd(), "main.o")
+            source = self.getSourcePath("main.cpp")
+            o_file = self.getBuildArtifact("main.o")
             execute_command(
                 "'%s' -g -O0 -arch i386 -arch x86_64 '%s' -c -o '%s'" %
                 (os.environ["CC"], source, o_file))
             execute_command(
-                "'%s' -g -O0 -arch i386 -arch x86_64 '%s'" %
-                (os.environ["CC"], o_file))
+                "'%s' -g -O0 -arch i386 -arch x86_64 '%s' -o '%s'" %
+                (os.environ["CC"], o_file, exe))
             if self.debug_info != "dsym":
                 dsym_path = self.getBuildArtifact("a.out.dSYM")
                 execute_command("rm -rf '%s'" % (dsym_path))
         else:
             self.build()
 
-        exe = self.getBuildArtifact("a.out")
-
         # Create the target
         target = self.dbg.CreateTarget(exe)
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/fat_archives/Makefile Tue Jan 30 10:29:16 2018
@@ -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:

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/frame-language/Makefile Tue Jan 30 10:29:16 2018
@@ -6,7 +6,7 @@ C_SOURCES := somefunc.c
 include $(LEVEL)/Makefile.rules
 
 other-2.o: other-2.cpp
-	$(CXX) $(CFLAGS_NO_DEBUG) -c other-2.cpp
+	$(CXX) $(CFLAGS_NO_DEBUG) -c $(SRCDIR)/other-2.cpp
 
 somefunc.o: somefunc.c
-	$(CC) $(CFLAGS) -std=c99 -c somefunc.c
\ No newline at end of file
+	$(CC) $(CFLAGS) -std=c99 -c $(SRCDIR)/somefunc.c

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/launch_with_shellexpand/TestLaunchWithShellExpand.py Tue Jan 30 10:29:16 2018
@@ -39,7 +39,7 @@ class LaunchWithShellExpandTestCase(Test
 
         self.runCmd(
             "process launch -X true -w %s -- fi*.tx? () > <" %
-            (os.getcwd()))
+            (self.getSourceDir()))
 
         process = self.process()
 
@@ -77,7 +77,7 @@ class LaunchWithShellExpandTestCase(Test
 
         self.runCmd(
             'process launch -X true -w %s -- "foo bar"' %
-            (os.getcwd()))
+            (self.getSourceDir()))
 
         process = self.process()
 
@@ -99,7 +99,8 @@ class LaunchWithShellExpandTestCase(Test
 
         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()
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/Makefile Tue Jan 30 10:29:16 2018
@@ -7,11 +7,10 @@ CXX_SOURCES := main.cpp
 
 include $(LEVEL)/Makefile.rules
 
-.PHONY:
 a.out: lib_a lib_b lib_c lib_d hidden_lib_d install_name_tool
 
 lib_%:
-	$(MAKE) -f $*.mk
+	$(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/$*.mk
 
 install_name_tool:
 ifeq ($(OS),Darwin)
@@ -20,11 +19,11 @@ endif
 
 
 hidden_lib_d:
-	$(MAKE) -C hidden
+	$(MAKE) VPATH=$(SRCDIR)/hidden -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile
 
 clean::
-	$(MAKE) -f a.mk clean
-	$(MAKE) -f b.mk clean
-	$(MAKE) -f c.mk clean
-	$(MAKE) -f d.mk clean
-	$(MAKE) -C hidden clean
+	$(MAKE) -f $(SRCDIR)/a.mk clean
+	$(MAKE) -f $(SRCDIR)/b.mk clean
+	$(MAKE) -f $(SRCDIR)/c.mk clean
+	$(MAKE) -f $(SRCDIR)/d.mk clean
+	$(MAKE) -I $(SRCDIR)/hidden -C hidden -f $(SRCDIR)/hidden/Makefile clean

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py Tue Jan 30 10:29:16 2018
@@ -22,6 +22,7 @@ class LoadUnloadTestCase(TestBase):
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
+        lldbutil.mkdir_p(self.getBuildArtifact("hidden"))
         # Find the line number to break for main.cpp.
         self.line = line_number(
             'main.cpp',
@@ -36,12 +37,12 @@ class LoadUnloadTestCase(TestBase):
                     "=" +
                     os.environ["LD_LIBRARY_PATH"] +
                     ":" +
-                    os.getcwd())
+                    self.getBuildDir())
             else:
                 if lldb.remote_platform:
                     wd = lldb.remote_platform.GetWorkingDirectory()
                 else:
-                    wd = os.getcwd()
+                    wd = self.getBuildDir()
                 self.runCmd(
                     "settings set target.env-vars " +
                     self.dylibPath +
@@ -63,7 +64,7 @@ class LoadUnloadTestCase(TestBase):
             cwd = os.getcwd()
             for f in shlibs:
                 err = lldb.remote_platform.Put(
-                    lldb.SBFileSpec(os.path.join(cwd, f)),
+                    lldb.SBFileSpec(self.getBuildArtifact(f)),
                     lldb.SBFileSpec(os.path.join(wd, f)))
                 if err.Fail():
                     raise RuntimeError(
@@ -78,13 +79,16 @@ class LoadUnloadTestCase(TestBase):
                     raise RuntimeError(
                         "Unable to create a directory '%s'." % hidden_dir)
                 err = lldb.remote_platform.Put(
-                    lldb.SBFileSpec(os.path.join(cwd, 'hidden', shlib)),
+                    lldb.SBFileSpec(os.path.join('hidden', shlib)),
                     lldb.SBFileSpec(hidden_file))
                 if err.Fail():
                     raise RuntimeError(
                         "Unable copy 'libloadunload_d.so' to '%s'.\n>>> %s" %
                         (wd, err.GetCString()))
 
+    # libloadunload_d.so does not appear in the image list because executable
+    # dependencies are resolved relative to the debuggers PWD. Bug?
+    @expectedFailureAll(oslist=["linux"])
     @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     @not_remote_testsuite_ready
     @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic libraries work differently
@@ -100,11 +104,10 @@ class LoadUnloadTestCase(TestBase):
             dylibName = 'libloadunload_d.so'
 
         # The directory with the dynamic library we did not link to.
-        new_dir = os.path.join(os.getcwd(), "hidden")
+        new_dir = os.path.join(self.getBuildDir(), "hidden")
 
-        old_dylib = os.path.join(os.getcwd(), dylibName)
+        old_dylib = os.path.join(self.getBuildDir(), dylibName)
         new_dylib = os.path.join(new_dir, dylibName)
-
         exe = self.getBuildArtifact("a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
@@ -115,14 +118,14 @@ class LoadUnloadTestCase(TestBase):
         # Add an image search path substitution pair.
         self.runCmd(
             "target modules search-paths add %s %s" %
-            (os.getcwd(), new_dir))
+            (self.getBuildDir(), new_dir))
 
         self.expect("target modules search-paths list",
-                    substrs=[os.getcwd(), new_dir])
+                    substrs=[self.getBuildDir(), new_dir])
 
         self.expect(
             "target modules search-paths query %s" %
-            os.getcwd(),
+            self.getBuildDir(),
             "Image search path successfully transformed",
             substrs=[new_dir])
 
@@ -146,6 +149,9 @@ class LoadUnloadTestCase(TestBase):
             "LLDB successfully locates the relocated dynamic library",
             substrs=[new_dylib])
 
+    # libloadunload_d.so does not appear in the image list because executable
+    # dependencies are resolved relative to the debuggers PWD. Bug?
+    @expectedFailureAll(oslist=["linux"])
     @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     @expectedFailureAndroid  # wrong source file shows up for hidden library
     @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic libraries work differently
@@ -174,18 +180,19 @@ class LoadUnloadTestCase(TestBase):
         if lldb.remote_platform:
             wd = lldb.remote_platform.GetWorkingDirectory()
         else:
-            wd = os.getcwd()
+            wd = self.getBuildDir()
 
         old_dir = wd
         new_dir = os.path.join(wd, special_dir)
         old_dylib = os.path.join(old_dir, dylibName)
 
-        remove_dyld_path_cmd = "settings remove target.env-vars " + self.dylibPath
+        remove_dyld_path_cmd = "settings remove target.env-vars " \
+                               + self.dylibPath
         self.addTearDownHook(
             lambda: self.dbg.HandleCommand(remove_dyld_path_cmd))
 
-        # For now we don't track (DY)LD_LIBRARY_PATH, so the old library will be in
-        # the modules list.
+        # For now we don't track (DY)LD_LIBRARY_PATH, so the old
+        # library will be in the modules list.
         self.expect("target modules list",
                     substrs=[os.path.basename(old_dylib)],
                     matching=True)
@@ -203,7 +210,7 @@ class LoadUnloadTestCase(TestBase):
         if not self.platformIsDarwin():
             env_cmd_string += ":" + wd
         self.runCmd(env_cmd_string)
-
+        
         # This time, the hidden library should be picked up.
         self.expect("run", substrs=["return", "12345"])
 
@@ -233,15 +240,14 @@ class LoadUnloadTestCase(TestBase):
 
         self.runCmd("run", RUN_SUCCEEDED)
 
+        ctx = self.platformContext
+        dylibName = ctx.shlib_prefix + 'loadunload_a.' + ctx.shlib_extension
+        localDylibPath = self.getBuildArtifact(dylibName)
         if lldb.remote_platform:
-            shlib_dir = lldb.remote_platform.GetWorkingDirectory()
-        else:
-            shlib_dir = self.mydir
-
-        if self.platformIsDarwin():
-            dylibName = 'libloadunload_a.dylib'
+            wd = lldb.remote_platform.GetWorkingDirectory()
+            remoteDylibPath = lldbutil.join_remote_paths(wd, dylibName)
         else:
-            dylibName = 'libloadunload_a.so'
+            remoteDylibPath = localDylibPath
 
         # Make sure that a_function does not exist at this point.
         self.expect(
@@ -253,13 +259,10 @@ class LoadUnloadTestCase(TestBase):
 
         # Use lldb 'process load' to load the dylib.
         self.expect(
-            "process load %s --install" %
-            dylibName,
-            "%s loaded correctly" %
-            dylibName,
+            "process load %s --install=%s" % (localDylibPath, remoteDylibPath),
+            "%s loaded correctly" % dylibName,
             patterns=[
-                'Loading "%s".*ok' %
-                dylibName,
+                'Loading "%s".*ok' % localDylibPath,
                 'Image [0-9]+ loaded'])
 
         # Search for and match the "Image ([0-9]+) loaded" pattern.
@@ -366,6 +369,9 @@ class LoadUnloadTestCase(TestBase):
                     substrs=['stopped',
                              'stop reason = step over'])
 
+    # We can't find a breakpoint location for d_init before launching because
+    # executable dependencies are resolved relative to the debuggers PWD. Bug?
+    @expectedFailureAll(oslist=["linux"])
     @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic libraries work differently
     def test_static_init_during_load(self):

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/a.mk Tue Jan 30 10:29:16 2018
@@ -13,11 +13,10 @@ CXXFLAGS += -fPIC
 
 include $(LEVEL)/Makefile.rules
 
-.PHONY:
 $(DYLIB_FILENAME): lib_b
 
-lib_b:
-	"$(MAKE)" -f b.mk
+.PHONY lib_b:
+	$(MAKE) VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/b.mk
 
 clean::
-	"$(MAKE)" -f b.mk clean
+	$(MAKE) -I $(SRCDIR) -f $(SRCDIR)/b.mk clean

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py Tue Jan 30 10:29:16 2018
@@ -45,7 +45,7 @@ class PluginCommandTestCase(TestBase):
         retobj = lldb.SBCommandReturnObject()
 
         retval = debugger.GetCommandInterpreter().HandleCommand(
-            "plugin load %s" % plugin_lib_name, retobj)
+            "plugin load %s" % self.getBuildArtifact(plugin_lib_name), retobj)
 
         retobj.Clear()
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py Tue Jan 30 10:29:16 2018
@@ -44,9 +44,9 @@ class PluginPythonOSPlugin(TestBase):
         self.dbg.SetAsync(False)
 
         # Create a target by the debugger.
-        cwd = os.getcwd()
         exe = self.getBuildArtifact("a.out")
-        python_os_plugin_path = os.path.join(cwd, "operating_system.py")
+        python_os_plugin_path = os.path.join(self.getSourceDir(),
+                                             "operating_system.py")
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
 
@@ -128,9 +128,9 @@ class PluginPythonOSPlugin(TestBase):
         self.dbg.SetAsync(False)
 
         # Create a target by the debugger.
-        cwd = os.getcwd()
         exe = self.getBuildArtifact("a.out")
-        python_os_plugin_path = os.path.join(cwd, "operating_system2.py")
+        python_os_plugin_path = os.path.join(self.getSourceDir(),
+                                             "operating_system2.py")
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py Tue Jan 30 10:29:16 2018
@@ -64,7 +64,7 @@ class MiniDumpTestCase(TestBase):
         """Test that we can examine a more interesting stack in a mini dump."""
         self.build()
         exe = self.getBuildArtifact("a.out")
-        core = os.path.join(os.getcwd(), "core.dmp")
+        core = self.getBuildArtifact("core.dmp")
         try:
             # Set a breakpoint and capture a mini dump.
             target = self.dbg.CreateTarget(exe)
@@ -100,7 +100,7 @@ class MiniDumpTestCase(TestBase):
         """Test that we can examine local variables in a mini dump."""
         self.build()
         exe = self.getBuildArtifact("a.out")
-        core = os.path.join(os.getcwd(), "core.dmp")
+        core = self.getBuildArtifact("core.dmp")
         try:
             # Set a breakpoint and capture a mini dump.
             target = self.dbg.CreateTarget(exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py Tue Jan 30 10:29:16 2018
@@ -27,7 +27,7 @@ class ProcessAttachTestCase(TestBase):
     def test_attach_to_process_by_id(self):
         """Test attach by process id"""
         self.build()
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         # Spawn a new process
         popen = self.spawnSubprocess(exe)
@@ -43,13 +43,13 @@ class ProcessAttachTestCase(TestBase):
     @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
     def test_attach_to_process_from_different_dir_by_id(self):
         """Test attach by process id"""
+        newdir = self.getBuildArtifact("newdir")
         try:
-            os.mkdir(os.path.join(os.getcwd(),'newdir'))
+            os.mkdir(newdir)
         except OSError, e:
             if e.errno != os.errno.EEXIST:
                 raise
-        testdir = os.getcwd()
-        newdir = os.path.join(testdir,'newdir')
+        testdir = self.getBuildDir()
         exe = os.path.join(newdir, 'proc_attach')
         self.buildProgram('main.cpp', exe)
         self.addTearDownHook(lambda: shutil.rmtree(newdir))
@@ -58,7 +58,7 @@ class ProcessAttachTestCase(TestBase):
         popen = self.spawnSubprocess(exe)
         self.addTearDownHook(self.cleanupSubprocesses)
 
-        os.chdir('newdir')
+        os.chdir(newdir)
         self.addTearDownHook(lambda: os.chdir(testdir))
         self.runCmd("process attach -p " + str(popen.pid))
 
@@ -71,7 +71,7 @@ class ProcessAttachTestCase(TestBase):
     def test_attach_to_process_by_name(self):
         """Test attach by process name"""
         self.build()
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         # Spawn a new process
         popen = self.spawnSubprocess(exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py Tue Jan 30 10:29:16 2018
@@ -25,7 +25,7 @@ class AttachDeniedTestCase(TestBase):
     def test_attach_to_process_by_id_denied(self):
         """Test attach by process id denied"""
         self.build()
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         # Use a file as a synchronization point between test and inferior.
         pid_file_path = lldbutil.append_to_process_working_directory(

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py Tue Jan 30 10:29:16 2018
@@ -132,7 +132,9 @@ class ProcessLaunchTestCase(TestBase):
         out_file_name = "my_working_dir_test.out"
         err_file_name = "my_working_dir_test.err"
 
-        my_working_dir_path = os.path.join(os.getcwd(), mywd)
+        my_working_dir_path = self.getBuildArtifact(mywd)
+        try: os.makedirs(my_working_dir_path)
+        except: pass
         out_file_path = os.path.join(my_working_dir_path, out_file_name)
         err_file_path = os.path.join(my_working_dir_path, err_file_name)
 

Removed: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/my_working_dir/.keep
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/my_working_dir/.keep?rev=323802&view=auto
==============================================================================
    (empty)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_save_core/TestProcessSaveCore.py Tue Jan 30 10:29:16 2018
@@ -22,7 +22,7 @@ class ProcessSaveCoreTestCase(TestBase):
         """Test that SaveCore fails if the process isn't stopped."""
         self.build()
         exe = self.getBuildArtifact("a.out")
-        core = os.path.join(os.getcwd(), "core.dmp")
+        core = self.getBuildArtifact("core.dmp")
         target = self.dbg.CreateTarget(exe)
         process = target.LaunchSimple(
             None, None, self.get_process_working_directory())
@@ -36,7 +36,7 @@ class ProcessSaveCoreTestCase(TestBase):
         """Test that we can save a Windows mini dump."""
         self.build()
         exe = self.getBuildArtifact("a.out")
-        core = os.path.join(os.getcwd(), "core.dmp")
+        core = self.getBuildArtifact("core.dmp")
         try:
             target = self.dbg.CreateTarget(exe)
             breakpoint = target.BreakpointCreateByName("bar")

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py Tue Jan 30 10:29:16 2018
@@ -149,7 +149,7 @@ class RegisterCommandsTestCase(TestBase)
             self.platform = "posix"
 
         if self.platform != "":
-            self.log_file = os.path.join(os.getcwd(), 'TestRegisters.log')
+            self.log_file = self.getBuildArtifact('TestRegisters.log')
             self.runCmd(
                 "log enable " +
                 self.platform +

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py Tue Jan 30 10:29:16 2018
@@ -35,6 +35,8 @@ class SingleQuoteInCommandLineTestCase(T
         """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)]])

Removed: lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/path with '09/.keep
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/path%20with%20%2709/.keep?rev=323802&view=auto
==============================================================================
    (empty)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/step-avoids-no-debug/Makefile Tue Jan 30 10:29:16 2018
@@ -5,4 +5,4 @@ C_SOURCES := with-debug.c without-debug.
 include $(LEVEL)/Makefile.rules
 
 without-debug.o: without-debug.c
-	$(CC) $(CFLAGS_NO_DEBUG) -c without-debug.c	
+	$(CC) $(CFLAGS_NO_DEBUG) -c $<

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/stop-hook/multiple_threads/TestStopHookMultipleThreads.py Tue Jan 30 10:29:16 2018
@@ -46,7 +46,7 @@ class StopHookForMultipleThreadsTestCase
         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.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py Tue Jan 30 10:29:16 2018
@@ -62,8 +62,8 @@ class targetCommandTestCase(TestBase):
     def do_target_command(self):
         """Exercise 'target create', 'target list', 'target select' commands."""
         exe_a = self.getBuildArtifact("a.out")
-        exe_b = os.path.join(os.getcwd(), "b.out")
-        exe_c = os.path.join(os.getcwd(), "c.out")
+        exe_b = self.getBuildArtifact("b.out")
+        exe_c = self.getBuildArtifact("c.out")
 
         self.runCmd("target list")
         output = self.res.GetOutput()
@@ -114,7 +114,8 @@ class targetCommandTestCase(TestBase):
 
     def do_target_variable_command(self, exe_name):
         """Exercise 'target variable' command before and after starting the inferior."""
-        self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET)
+        self.runCmd("file " + self.getBuildArtifact(exe_name),
+                    CURRENT_EXECUTABLE_SET)
 
         self.expect(
             "target variable my_global_char",
@@ -206,7 +207,8 @@ class targetCommandTestCase(TestBase):
 
     def do_target_variable_command_no_fail(self, exe_name):
         """Exercise 'target variable' command before and after starting the inferior."""
-        self.runCmd("file " + exe_name, CURRENT_EXECUTABLE_SET)
+        self.runCmd("file " + self.getBuildArtifact(exe_name),
+                    CURRENT_EXECUTABLE_SET)
 
         self.expect(
             "target variable my_global_char",

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_delay_breakpoint_one_signal/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoint_one_delay_breakpoint_threads/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/breakpoints_delayed_breakpoint_one_watchpoint/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_signal/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/crash_with_watchpoint_breakpoint_signal/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_signal_watch/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delay_watch_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_signal/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/delayed_crash_with_breakpoint_watchpoint/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_breakpoints/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_crash/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_signals/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/many_watchpoints/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/n_watch_n_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_delay_watch/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_n_watch_n_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/signal_watch_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoint_threads/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_delay_signal/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_signal/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_breakpoints_one_watchpoint/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoint_threads/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_breakpoint/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_delay_breakpoint/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/two_watchpoints_one_signal/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watch_break_delay/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_delay_watchpoint_one_breakpoint/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/watchpoint_with_delay_watchpoint_threads/Makefile Tue Jan 30 10:29:16 2018
@@ -4,6 +4,7 @@ CXX_SOURCES := main.cpp
 
 ENABLE_THREADS := YES
 
-VPATH = ..
-
 include $(LEVEL)/Makefile.rules
+
+main.cpp: ../main.cpp
+	cp $< $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py Tue Jan 30 10:29:16 2018
@@ -46,7 +46,7 @@ class HelloWatchLocationTestCase(TestBas
         """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.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py Tue Jan 30 10:29:16 2018
@@ -40,7 +40,7 @@ class HelloWatchpointTestCase(TestBase):
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multi_watchpoint_slots/TestWatchpointMultipleSlots.py Tue Jan 30 10:29:16 2018
@@ -37,7 +37,7 @@ class WatchpointSlotsTestCase(TestBase):
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Detect line number after which we are going to increment arrayName.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py Tue Jan 30 10:29:16 2018
@@ -42,7 +42,7 @@ class WatchedVariableHitWhenInScopeTestC
         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.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py Tue Jan 30 10:29:16 2018
@@ -46,7 +46,7 @@ class WatchpointCommandsTestCase(TestBas
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
@@ -117,7 +117,7 @@ class WatchpointCommandsTestCase(TestBas
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
@@ -174,7 +174,7 @@ class WatchpointCommandsTestCase(TestBas
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
@@ -234,7 +234,7 @@ class WatchpointCommandsTestCase(TestBas
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
@@ -304,7 +304,7 @@ class WatchpointCommandsTestCase(TestBas
         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.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py Tue Jan 30 10:29:16 2018
@@ -45,7 +45,7 @@ class WatchpointLLDBCommandTestCase(Test
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
@@ -113,7 +113,7 @@ class WatchpointLLDBCommandTestCase(Test
         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.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py Tue Jan 30 10:29:16 2018
@@ -46,7 +46,7 @@ class WatchpointPythonCommandTestCase(Te
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
@@ -116,7 +116,7 @@ class WatchpointPythonCommandTestCase(Te
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
@@ -144,7 +144,8 @@ class WatchpointPythonCommandTestCase(Te
                 (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(

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py Tue Jan 30 10:29:16 2018
@@ -45,7 +45,7 @@ class WatchpointConditionCmdTestCase(Tes
         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.

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py Tue Jan 30 10:29:16 2018
@@ -41,8 +41,6 @@ class TestWatchpointSetEnable(TestBase):
         # Create a target by the debugger.
         self.target = self.dbg.CreateTarget(exe)
         self.assertTrue(self.target, VALID_TARGET)
-        cwd = os.getcwd()
-        
 
         bkpt_before = self.target.BreakpointCreateBySourceRegex("Set a breakpoint here", main_file_spec)
         self.assertEqual(bkpt_before.GetNumLocations(),  1, "Failed setting the before breakpoint.")

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_size/TestWatchpointSizes.py Tue Jan 30 10:29:16 2018
@@ -62,7 +62,7 @@ class WatchpointSizeTestCase(TestBase):
         self.build(dictionary=self.d)
         self.setTearDownCleanup(dictionary=self.d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         # Detect line number after which we are going to increment arrayName.

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Makefile Tue Jan 30 10:29:16 2018
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One.mk Tue Jan 30 10:29:16 2018
@@ -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 $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/TestConflictingSymbol.py Tue Jan 30 10:29:16 2018
@@ -16,6 +16,11 @@ class TestConflictingSymbols(TestBase):
     mydir = TestBase.compute_mydir(__file__)
     NO_DEBUG_INFO_TESTCASE = True
 
+    def setUp(self):
+        TestBase.setUp(self)
+        lldbutil.mkdir_p(self.getBuildArtifact("One"))
+        lldbutil.mkdir_p(self.getBuildArtifact("Two"))
+
     def test_conflicting_symbols(self):
         self.build()
         exe = self.getBuildArtifact("a.out")

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two.mk Tue Jan 30 10:29:16 2018
@@ -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 $@

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py Tue Jan 30 10:29:16 2018
@@ -29,10 +29,10 @@ class TlsGlobalTestCase(TestBase):
                     "=" +
                     os.environ["LD_LIBRARY_PATH"] +
                     ":" +
-                    os.getcwd())
+                    self.getBuildDir())
             else:
                 self.runCmd("settings set target.env-vars " +
-                            self.dylibPath + "=" + os.getcwd())
+                            self.dylibPath + "=" + self.getBuildDir())
             self.addTearDownHook(
                 lambda: self.runCmd(
                     "settings remove target.env-vars " +

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py Tue Jan 30 10:29:16 2018
@@ -40,9 +40,7 @@ class TestUnionMembers(TestBase):
     def _load_exe(self):
         self.build()
 
-        cwd = os.getcwd()
-
-        src_file = os.path.join(cwd, "main.c")
+        src_file = os.path.join(self.getSourceDir(), "main.c")
         self.src_file_spec = lldb.SBFileSpec(src_file)
         self.assertTrue(self.src_file_spec.IsValid(), "breakpoint file")
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py Tue Jan 30 10:29:16 2018
@@ -18,9 +18,7 @@ class TestCppChainedCalls(TestBase):
         self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
         # Get the path of the executable
-        cwd = os.getcwd()
-        exe_file = self.getBuildArtifact("a.out")
-        exe_path = os.path.join(cwd, exe_file)
+        exe_path = self.getBuildArtifact("a.out")
 
         # Load the executable
         target = self.dbg.CreateTarget(exe_path)

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py Tue Jan 30 10:29:16 2018
@@ -51,7 +51,7 @@ class CppValueCastTestCase(TestBase):
 
     def do_sbvalue_cast(self, exe_name):
         """Test SBValue::Cast(SBType) API for C++ types."""
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         # Create a target from the debugger.
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py Tue Jan 30 10:29:16 2018
@@ -20,7 +20,6 @@ class TestCppGlobalOperators(TestBase):
         self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
         # Get the path of the executable
-        cwd = os.getcwd()
         exe_path = self.getBuildArtifact("a.out")
 
         # Load the executable

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py Tue Jan 30 10:29:16 2018
@@ -13,9 +13,8 @@ class TestWithGmodulesDebugInfo(TestBase
     @add_test_categories(["gmodules"])
     def test_specialized_typedef_from_pch(self):
         self.build()
-        cwd = os.getcwd()
 
-        src_file = os.path.join(cwd, "main.cpp")
+        src_file = os.path.join(self.getSourceDir(), "main.cpp")
         src_file_spec = lldb.SBFileSpec(src_file)
         self.assertTrue(src_file_spec.IsValid(), "breakpoint file")
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/Makefile Tue Jan 30 10:29:16 2018
@@ -19,16 +19,16 @@ nolimit: main.o length_nolimit.o a.o
 	$(CXX) main.o length_nolimit.o a.o -o nolimit $(LDFLAGS)
 
 main.o: main.cpp
-	$(CXX) $(CFLAGS_LIMIT) main.cpp -o main.o
+	$(CXX) $(CFLAGS_LIMIT) $(SRCDIR)/main.cpp -o main.o
 
 length_limit.o: length.cpp
-	$(CXX) $(CFLAGS_LIMIT) length.cpp -o length_limit.o
+	$(CXX) $(CFLAGS_LIMIT) $(SRCDIR)/length.cpp -o length_limit.o
 
 length_nolimit.o: length.cpp
-	$(CXX) $(CFLAGS_NO_LIMIT) length.cpp -o length_nolimit.o
+	$(CXX) $(CFLAGS_NO_LIMIT) $(SRCDIR)/length.cpp -o length_nolimit.o
 
 a.o: a.cpp
-	$(CXX) $(CFLAGS_NO_DEBUG) -c a.cpp -o a.o
+	$(CXX) $(CFLAGS_NO_DEBUG) -c $(SRCDIR)/a.cpp -o a.o
 
 clean: OBJECTS += limit nolimit length_limit.o length_nolimit.o length_limit.dwo length_nolimit.dwo
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py Tue Jan 30 10:29:16 2018
@@ -51,8 +51,7 @@ class TestCppIncompleteTypes(TestBase):
         self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
         # Get the path of the executable
-        cwd = os.getcwd()
-        exe_path = os.path.join(cwd, exe)
+        exe_path = self.getBuildArtifact(exe)
 
         # Load the executable
         target = self.dbg.CreateTarget(exe_path)

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py Tue Jan 30 10:29:16 2018
@@ -12,9 +12,7 @@ class TestWithLimitDebugInfo(TestBase):
     def test_limit_debug_info(self):
         self.build()
 
-        cwd = os.getcwd()
-
-        src_file = os.path.join(cwd, "main.cpp")
+        src_file = os.path.join(self.getSourceDir(), "main.cpp")
         src_file_spec = lldb.SBFileSpec(src_file)
         self.assertTrue(src_file_spec.IsValid(), "breakpoint file")
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/Makefile Tue Jan 30 10:29:16 2018
@@ -9,11 +9,11 @@ include $(LEVEL)/Makefile.rules
 a.out: lib_a lib_b
 
 lib_%:
-	$(MAKE) -f $*.mk
+	$(MAKE) VPATH=$(VPATH) -f $(SRCDIR)/$*.mk
 
 hidden_lib_d:
 	$(MAKE) -C hidden
 
 clean::
-	$(MAKE) -f a.mk clean
-	$(MAKE) -f b.mk clean
+	$(MAKE) -f $(SRCDIR)/a.mk clean
+	$(MAKE) -f $(SRCDIR)/b.mk clean

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py Tue Jan 30 10:29:16 2018
@@ -16,12 +16,11 @@ class TestCppNsImport(TestBase):
         self.build()
 
         # Get main source file
-        src_file = "main.cpp"
+        src_file = os.path.join(self.getSourceDir(), "main.cpp")
         src_file_spec = lldb.SBFileSpec(src_file)
         self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
         # Get the path of the executable
-        cwd = os.getcwd()
         exe_path = self.getBuildArtifact("a.out")
 
         # Load the executable

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py Tue Jan 30 10:29:16 2018
@@ -23,12 +23,11 @@ class TestCppScopes(TestBase):
         self.build()
 
         # Get main source file
-        src_file = "main.cpp"
+        src_file = os.path.join(self.getSourceDir(), "main.cpp")
         src_file_spec = lldb.SBFileSpec(src_file)
         self.assertTrue(src_file_spec.IsValid(), "Main source file")
 
         # Get the path of the executable
-        cwd = os.getcwd()
         exe_path = self.getBuildArtifact("a.out")
 
         # Load the executable

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Makefile Tue Jan 30 10:29:16 2018
@@ -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

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk?rev=323803&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/Test/Test.mk Tue Jan 30 10:29:16 2018
@@ -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

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk?rev=323803&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/conflicting-definition/TestExt/TestExt.mk Tue Jan 30 10:29:16 2018
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py Tue Jan 30 10:29:16 2018
@@ -296,7 +296,7 @@ class FoundationTestCase(TestBase):
         # Log any DWARF lookups
         ++file_index
         logfile = os.path.join(
-            os.getcwd(),
+            self.getBuildDir(),
             "dwarf-lookups-" +
             self.getArchitecture() +
             "-" +

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py Tue Jan 30 10:29:16 2018
@@ -34,7 +34,7 @@ class ObjectDescriptionAPITestCase(TestB
         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)

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py Tue Jan 30 10:29:16 2018
@@ -84,10 +84,12 @@ class HiddenIvarsTestCase(TestBase):
 
         if strip:
             self.assertTrue(subprocess.call(
-                ['/usr/bin/strip', '-Sx', 'libInternalDefiner.dylib']) == 0, 'stripping dylib succeeded')
-            self.assertTrue(subprocess.call(['/bin/rm',
-                                             '-rf',
-                                             'libInternalDefiner.dylib.dSYM']) == 0,
+                ['/usr/bin/strip', '-Sx',
+                 self.getBuildArtifact('libInternalDefiner.dylib')]) == 0,
+                            'stripping dylib succeeded')
+            self.assertTrue(subprocess.call(
+                ['/bin/rm', '-rf',
+                 self.getBuildArtifact('libInternalDefiner.dylib.dSYM')]) == 0,
                             'remove dylib dSYM file succeeded')
             self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx',
                                              self.getBuildArtifact("a.out")

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/Makefile Tue Jan 30 10:29:16 2018
@@ -19,8 +19,8 @@ endif
 all: aout
 
 aout: 
-	$(CC) $(CFLAGS_NO_DEBUG) myclass.m -c -o myclass.o
-	$(CC) $(CFLAGS) myclass.o repro.m -framework Foundation
+	$(CC) $(CFLAGS_NO_DEBUG) $(SRCDIR)/myclass.m -c -o myclass.o
+	$(CC) $(CFLAGS) myclass.o $(SRCDIR)/repro.m -framework Foundation
 
 clean::
 	rm -f myclass.o

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py Tue Jan 30 10:29:16 2018
@@ -47,7 +47,7 @@ class IncompleteModulesTestCase(TestBase
 
         self.runCmd(
             "settings set target.clang-module-search-paths \"" +
-            os.getcwd() +
+            self.getSourceDir() +
             "\"")
 
         self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py Tue Jan 30 10:29:16 2018
@@ -50,7 +50,7 @@ class ModulesInlineFunctionsTestCase(Tes
 
         self.runCmd(
             "settings set target.clang-module-search-paths \"" +
-            os.getcwd() +
+            self.getSourceDir() +
             "\"")
 
         self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py Tue Jan 30 10:29:16 2018
@@ -34,7 +34,7 @@ class ObjCDynamicSBTypeTestCase(TestBase
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_break_set_by_file_and_line(

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/Makefile Tue Jan 30 10:29:16 2018
@@ -3,7 +3,7 @@ LEVEL = ../../../make
 OBJC_SOURCES := main.m
 LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
 
-default:        a.out.stripped
+all:        a.out.stripped
 
 a.out.stripped: a.out.dSYM
 	strip -o a.out.stripped a.out

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py Tue Jan 30 10:29:16 2018
@@ -38,7 +38,7 @@ class PrintObjTestCase(TestBase):
         d = {'EXE': 'b.out'}
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
-        exe = os.path.join(os.getcwd(), 'b.out')
+        exe = self.getBuildArtifact('b.out')
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py Tue Jan 30 10:29:16 2018
@@ -33,7 +33,7 @@ class MethodReturningBOOLTestCase(TestBa
         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(

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py Tue Jan 30 10:29:16 2018
@@ -33,7 +33,7 @@ class Rdar10967107TestCase(TestBase):
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_break_set_by_file_and_line(

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py Tue Jan 30 10:29:16 2018
@@ -33,7 +33,7 @@ class Rdar10967107TestCase(TestBase):
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_break_set_by_file_and_line(

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py Tue Jan 30 10:29:16 2018
@@ -41,7 +41,7 @@ class Rdar12408181TestCase(TestBase):
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
 
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_break_set_by_file_and_line(

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py Tue Jan 30 10:29:16 2018
@@ -97,12 +97,14 @@ class InlineTest(TestBase):
             return "-N dsym %s" % (self.mydir)
 
     def BuildMakefile(self):
-        if os.path.exists("Makefile"):
+        self.makeBuildDir()
+        makefilePath = self.getBuildArtifact("Makefile")
+        if os.path.exists(makefilePath):
             return
 
         categories = {}
 
-        for f in os.listdir(os.getcwd()):
+        for f in os.listdir(self.getSourceDir()):
             t = source_type(f)
             if t:
                 if t in list(categories.keys()):
@@ -110,7 +112,7 @@ class InlineTest(TestBase):
                 else:
                     categories[t] = [f]
 
-        makefile = open("Makefile", 'w+')
+        makefile = open(makefilePath, 'w+')
 
         level = os.sep.join(
             [".."] * len(self.mydir.split(os.sep))) + os.sep + "make"
@@ -137,29 +139,33 @@ class InlineTest(TestBase):
     @add_test_categories(["dsym"])
     def __test_with_dsym(self):
         self.using_dsym = True
+        self.debug_info = "dsym"
         self.BuildMakefile()
-        self.buildDsym()
+        self.build()
         self.do_test()
 
     @add_test_categories(["dwarf"])
     def __test_with_dwarf(self):
         self.using_dsym = False
+        self.debug_info = "dwarf"
         self.BuildMakefile()
-        self.buildDwarf()
+        self.build()
         self.do_test()
 
     @add_test_categories(["dwo"])
     def __test_with_dwo(self):
         self.using_dsym = False
+        self.debug_info = "dwo"
         self.BuildMakefile()
-        self.buildDwo()
+        self.build()
         self.do_test()
 
     @add_test_categories(["gmodules"])
     def __test_with_gmodules(self):
         self.using_dsym = False
+        self.debug_info = "gmodules"
         self.BuildMakefile()
-        self.buildGModules()
+        self.build()
         self.do_test()
 
     def execute_user_command(self, __command):
@@ -167,14 +173,15 @@ class InlineTest(TestBase):
 
     def do_test(self):
         exe = self.getBuildArtifact("a.out")
-        source_files = [f for f in os.listdir(os.getcwd()) if source_type(f)]
+        source_files = [f for f in os.listdir(self.getSourceDir())
+                        if source_type(f)]
         target = self.dbg.CreateTarget(exe)
 
         parser = CommandParser()
         parser.parse_source_files(source_files)
         parser.set_breakpoints(target)
 
-        process = target.LaunchSimple(None, None, os.getcwd())
+        process = target.LaunchSimple(None, None, self.getBuildDir())
 
         while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint):
             thread = lldbutil.get_stopped_thread(

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Tue Jan 30 10:29:16 2018
@@ -554,6 +554,7 @@ class Base(unittest2.TestCase):
                 print("Change dir to:", full_dir, file=sys.stderr)
             os.chdir(os.path.join(os.environ["LLDB_TEST"], cls.mydir))
 
+        # TODO: Obsolete this by creating one working dir per configuration.
         if debug_confirm_directory_exclusivity:
             import lock
             cls.dir_lock = lock.Lock(os.path.join(full_dir, ".dirlock"))
@@ -718,9 +719,28 @@ class Base(unittest2.TestCase):
             lldb.remote_platform.Run(shell_cmd)
         self.addTearDownHook(clean_working_directory)
 
+    def getSourceDir(self):
+        """Return the full path to the current test."""
+        return os.path.join(os.environ["LLDB_TEST"], self.mydir)
+
+    def getBuildDir(self):
+        """Return the full path to the current test."""
+        return os.path.join(os.environ["LLDB_BUILD"], self.mydir)
+    
+     
+    def makeBuildDir(self):
+        """Create the test-specific working directory."""
+        # See also dotest.py which sets up ${LLDB_BUILD}.
+        try: os.makedirs(self.getBuildDir())
+        except: pass
+ 
     def getBuildArtifact(self, name="a.out"):
         """Return absolute path to an artifact in the test's build directory."""
-        return os.path.join(os.getcwd(), name)
+        return os.path.join(self.getBuildDir(), name)
+ 
+    def getSourcePath(self, name):
+        """Return absolute path to a file in the test's source directory."""
+        return os.path.join(self.getSourceDir(), name)
 
     def setUp(self):
         """Fixture for unittest test case setup.
@@ -855,6 +875,7 @@ class Base(unittest2.TestCase):
                 self.framework_dir = None
                 self.dsym = None
                 self.darwinWithFramework = False
+        self.makeBuildDir()
 
     def setAsync(self, value):
         """ Sets async mode to True/False and ensures it is reset after the testcase completes."""
@@ -1407,7 +1428,6 @@ class Base(unittest2.TestCase):
         """ Platform-specific way to build a program that links with LLDB (via the liblldb.so
             or LLDB.framework).
         """
-
         stdflag = self.getstdFlag()
         stdlibflag = self.getstdlibFlag()
 
@@ -1495,18 +1515,18 @@ class Base(unittest2.TestCase):
             architecture=None,
             compiler=None,
             dictionary=None,
-            clean=True):
+            clean=True,
+            testdir=None):
         """Platform specific way to build the default binaries."""
+        if not testdir:
+            testdir = self.mydir
         if self.debug_info:
             raise Exception("buildDefault tests must set NO_DEBUG_INFO_TESTCASE")
         module = builder_module()
+        self.makeBuildDir()
         dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
-        if not module.buildDefault(
-                self,
-                architecture,
-                compiler,
-                dictionary,
-                clean):
+        if not module.buildDefault(self, architecture, compiler,
+                                   dictionary, clean, testdir):
             raise Exception("Don't know how to build default binary")
 
     def buildDsym(
@@ -1514,16 +1534,15 @@ class Base(unittest2.TestCase):
             architecture=None,
             compiler=None,
             dictionary=None,
-            clean=True):
+            clean=True,
+            testdir=None):
         """Platform specific way to build binaries with dsym info."""
+        if not testdir:
+            testdir = self.mydir
         module = builder_module()
         dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
-        if not module.buildDsym(
-                self,
-                architecture,
-                compiler,
-                dictionary,
-                clean):
+        if not module.buildDsym(self, architecture, compiler,
+                                dictionary, clean, testdir):
             raise Exception("Don't know how to build binary with dsym")
 
     def buildDwarf(
@@ -1531,16 +1550,15 @@ class Base(unittest2.TestCase):
             architecture=None,
             compiler=None,
             dictionary=None,
-            clean=True):
+            clean=True,
+            testdir=None):
         """Platform specific way to build binaries with dwarf maps."""
+        if not testdir:
+            testdir = self.mydir
         module = builder_module()
         dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
-        if not module.buildDwarf(
-                self,
-                architecture,
-                compiler,
-                dictionary,
-                clean):
+        if not module.buildDwarf(self, architecture, compiler,
+                                   dictionary, clean, testdir):
             raise Exception("Don't know how to build binary with dwarf")
 
     def buildDwo(
@@ -1548,16 +1566,15 @@ class Base(unittest2.TestCase):
             architecture=None,
             compiler=None,
             dictionary=None,
-            clean=True):
+            clean=True,
+            testdir=None):
         """Platform specific way to build binaries with dwarf maps."""
+        if not testdir:
+            testdir = self.mydir
         module = builder_module()
         dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
-        if not module.buildDwo(
-                self,
-                architecture,
-                compiler,
-                dictionary,
-                clean):
+        if not module.buildDwo(self, architecture, compiler,
+                                   dictionary, clean, testdir):
             raise Exception("Don't know how to build binary with dwo")
 
     def buildGModules(
@@ -1565,16 +1582,15 @@ class Base(unittest2.TestCase):
             architecture=None,
             compiler=None,
             dictionary=None,
-            clean=True):
+            clean=True,
+            testdir=None):
         """Platform specific way to build binaries with gmodules info."""
+        if not testdir:
+            testdir = self.mydir
         module = builder_module()
         dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
-        if not module.buildGModules(
-                self,
-                architecture,
-                compiler,
-                dictionary,
-                clean):
+        if not module.buildGModules(self, architecture, compiler,
+                                   dictionary, clean, testdir):
             raise Exception("Don't know how to build binary with gmodules")
 
     def buildGo(self):
@@ -1869,8 +1885,9 @@ class TestBase(Base):
     timeWaitNextLaunch = 1.0
 
     def generateSource(self, source):
+        self.makeBuildDir()
         template = source + '.template'
-        temp = os.path.join(os.getcwd(), template)
+        temp = os.path.join(self.getSourceDir(), template)
         with open(temp, 'r') as f:
             content = f.read()
             
@@ -1889,7 +1906,7 @@ class TestBase(Base):
             header.startswith("SB") and header.endswith(".h"))]
         includes = '\n'.join(list)
         new_content = content.replace('%include_SB_APIs%', includes)
-        src = os.path.join(os.getcwd(), source)
+        src = os.path.join(self.getBuildDir(), source)
         with open(src, 'w') as f:
             f.write(new_content)
 
@@ -1950,12 +1967,12 @@ class TestBase(Base):
             else:
                 # Check relative names
                 local_shlib_path = os.path.join(
-                    os.getcwd(), shlib_prefix + name + shlib_extension)
+                    self.getBuildDir(), shlib_prefix + name + shlib_extension)
                 if not os.path.exists(local_shlib_path):
                     local_shlib_path = os.path.join(
-                        os.getcwd(), name + shlib_extension)
+                        self.getBuildDir(), name + shlib_extension)
                     if not os.path.exists(local_shlib_path):
-                        local_shlib_path = os.path.join(os.getcwd(), name)
+                        local_shlib_path = os.path.join(self.getBuildDir(), name)
 
                 # Make sure we found the local shared library in the above code
                 self.assertTrue(os.path.exists(local_shlib_path))
@@ -2002,7 +2019,7 @@ class TestBase(Base):
             return lldb.remote_platform.GetWorkingDirectory()
         else:
             # local tests change directory into each test subdirectory
-            return os.getcwd()
+            return self.getBuildDir()
 
     def tearDown(self):
         #import traceback
@@ -2287,18 +2304,24 @@ class TestBase(Base):
             clean=True):
         """Platform specific way to build the default binaries."""
         module = builder_module()
+        self.makeBuildDir()
+
         dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
         if self.debug_info is None:
-            return self.buildDefault(architecture, compiler, dictionary, clean)
+            return self.buildDefault(architecture, compiler, dictionary,
+                                     clean, self.mydir)
         elif self.debug_info == "dsym":
-            return self.buildDsym(architecture, compiler, dictionary, clean)
+            return self.buildDsym(architecture, compiler, dictionary,
+                                  clean, self.mydir)
         elif self.debug_info == "dwarf":
-            return self.buildDwarf(architecture, compiler, dictionary, clean)
+            return self.buildDwarf(architecture, compiler, dictionary,
+                                   clean, self.mydir)
         elif self.debug_info == "dwo":
-            return self.buildDwo(architecture, compiler, dictionary, clean)
+            return self.buildDwo(architecture, compiler, dictionary,
+                                 clean, self.mydir)
         elif self.debug_info == "gmodules":
-            return self.buildGModules(
-                architecture, compiler, dictionary, clean)
+            return self.buildGModules(architecture, compiler, dictionary,
+                                      clean, self.mydir)
         else:
             self.fail("Can't build for debug info: %s" % self.debug_info)
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py Tue Jan 30 10:29:16 2018
@@ -9,6 +9,7 @@ from __future__ import absolute_import
 
 # System modules
 import collections
+import errno
 import os
 import re
 import sys
@@ -44,6 +45,14 @@ def which(program):
                 return exe_file
     return None
 
+def mkdir_p(path):
+    try:
+        os.makedirs(path)
+    except OSError as e:
+        if e.errno != errno.EEXIST:
+            raise
+    if not os.path.isdir(path):
+        raise OSError(errno.ENOTDIR, "%s is not a directory"%path)
 # ===================================================
 # Disassembly for an SBFunction or an SBSymbol object
 # ===================================================

Modified: lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py Tue Jan 30 10:29:16 2018
@@ -39,7 +39,7 @@ class LogTestCase(TestBase):
                     patterns=["Current executable set to .*a.out"])
 
         log_file = os.path.join(
-            os.getcwd(),
+            self.getBuildDir(),
             "lldb-commands-log-%s-%s-%s.txt" %
             (type,
              os.path.basename(

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/Makefile Tue Jan 30 10:29:16 2018
@@ -13,10 +13,10 @@ ifeq "$(OS)" "Darwin"
 	CFLAGS += -arch $(ARCH)
 endif
 
-all: clean
+all: main.c clean
 	mkdir hide.app
 	mkdir hide.app/Contents
-	$(CC) $(CFLAGS) -g main.c
+	$(CC) $(CFLAGS) -g $<
 	mv a.out.dSYM hide.app/Contents
 	strip -x a.out
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/Makefile Tue Jan 30 10:29:16 2018
@@ -1,3 +1,5 @@
+SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
+
 CC ?= clang
 
 ifeq "$(ARCH)" ""
@@ -8,9 +10,12 @@ CFLAGS ?= -g -O0 -arch $(ARCH)
 
 all:  TestApp.app/Contents/MacOS/TestApp
 
-TestApp.app/Contents/MacOS/TestApp: 
-	$(CC) $(CFLAGS) -o TestApp main.c
+TestApp.app/Contents/MacOS/TestApp: $(SRCDIR)/main.c
+	$(CC) $(CFLAGS) -o TestApp $<
+	rm -rf TestApp.app
+	cp -r $(SRCDIR)/TestApp.app .
 	mv TestApp TestApp.app/Contents/MacOS/TestApp
 	mv TestApp.dSYM TestApp.app.dSYM
+
 clean:
 	rm -rf TestApp.app/Contents/MacOS/TestApp TestApp.app.dSYM

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py Tue Jan 30 10:29:16 2018
@@ -38,7 +38,7 @@ class FindAppInMacOSAppBundle(TestBase):
         # breakpoint, runs to it, and returns the thread, process & target.
         # It optionally takes an SBLaunchOption argument if you want to pass
         # arguments or environment variables.
-        exe = os.path.join(os.getcwd(), "TestApp.app")
+        exe = self.getBuildArtifact("TestApp.app")
         error = lldb.SBError()
         target = self.dbg.CreateTarget(exe, None, None, False, error)
         self.assertTrue(error.Success(), "Could not create target: %s"%(error.GetCString()))

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/Makefile Tue Jan 30 10:29:16 2018
@@ -1,3 +1,5 @@
+SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
+
 CC ?= clang
 
 ifeq "$(ARCH)" ""
@@ -7,7 +9,7 @@ endif
 CFLAGS ?= -g -O0 -arch $(ARCH)
 
 all: clean
-	$(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd bundle.c
+	$(CC) $(CFLAGS) -dynamiclib -o com.apple.sbd $(SRCDIR)/bundle.c
 	mkdir com.apple.sbd.xpc
 	mv com.apple.sbd com.apple.sbd.xpc/
 	mkdir -p com.apple.sbd.xpc.dSYM/Contents/Resources/DWARF
@@ -15,7 +17,7 @@ all: clean
 	rm -rf com.apple.sbd.dSYM
 	mkdir hide.app
 	tar cf - com.apple.sbd.xpc com.apple.sbd.xpc.dSYM | ( cd hide.app;tar xBpf -)
-	$(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn main.c
+	$(CC) $(CFLAGS) -o find-bundle-with-dots-in-fn $(SRCDIR)/main.c
 
 clean:
 	rm -rf a.out a.out.dSYM hide.app com.apple.sbd com.apple.sbd.dSYM com.apple.sbd.xpc com.apple.sbd.xpc.dSYM find-bundle-with-dots-in-fn find-bundle-with-dots-in-fn.dSYM

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py Tue Jan 30 10:29:16 2018
@@ -37,8 +37,9 @@ class BundleWithDotInFilenameTestCase(Te
 
     def test_attach_and_check_dsyms(self):
         """Test attach to binary, see if the bundle dSYM is found"""
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
         self.build()
+        os.chdir(self.getBuildDir());
         popen = self.spawnSubprocess(exe)
         self.addTearDownHook(self.cleanupSubprocesses)
 
@@ -66,6 +67,7 @@ class BundleWithDotInFilenameTestCase(Te
                 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()

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/Makefile Tue Jan 30 10:29:16 2018
@@ -1,3 +1,5 @@
+SRCDIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
+
 CC ?= clang
 
 ifeq "$(ARCH)" ""
@@ -7,12 +9,12 @@ endif
 CFLAGS ?= -g -O0 -arch $(ARCH)
 
 all: clean
-	$(CC) $(CFLAGS) -install_name $(PWD)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework myframework.c
+	$(CC) $(CFLAGS) -install_name $(shell pwd)/MyFramework.framework/Versions/A/MyFramework -dynamiclib -o MyFramework $(SRCDIR)/myframework.c
 	mkdir -p MyFramework.framework/Versions/A/Headers
 	mkdir -p MyFramework.framework/Versions/A/Resources
 	cp MyFramework MyFramework.framework/Versions/A
-	cp MyFramework.h MyFramework.framework/Versions/A/Headers
-	cp Info.plist MyFramework.framework/Versions/A/Resources
+	cp $(SRCDIR)/MyFramework.h MyFramework.framework/Versions/A/Headers
+	cp $(SRCDIR)/Info.plist MyFramework.framework/Versions/A/Resources
 	( cd MyFramework.framework/Versions ; ln -s A Current )
 	( cd MyFramework.framework/ ; ln -s Versions/Current/Headers . )
 	( cd MyFramework.framework/ ; ln -s Versions/Current/MyFramework . )
@@ -21,8 +23,8 @@ all: clean
 	mkdir hide.app
 	rm -f MyFramework
 	tar cf - MyFramework.framework MyFramework.framework.dSYM | ( cd hide.app;tar xBpf -)
-	$(CC) $(CFLAGS) -o deep-bundle main.c -F. -framework MyFramework
-	
+	$(CC) $(CFLAGS) -o deep-bundle $(SRCDIR)/main.c -F. -framework MyFramework
+
 
 clean:
 	rm -rf a.out a.out.dSYM deep-bundle deep-bundle.dSYM MyFramework.framework MyFramework.framework.dSYM MyFramework MyFramework.dSYM hide.app

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/TestDeepBundle.py Tue Jan 30 10:29:16 2018
@@ -37,9 +37,9 @@ class DeepBundleTestCase(TestBase):
 
     def test_attach_and_check_dsyms(self):
         """Test attach to binary, see if the framework dSYM is found"""
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
         self.build()
-        popen = self.spawnSubprocess(exe)
+        popen = self.spawnSubprocess(exe, [self.getBuildDir()])
         self.addTearDownHook(self.cleanupSubprocesses)
 
         # Give the inferior time to start up, dlopen a bundle, remove the bundle it linked in
@@ -49,7 +49,6 @@ class DeepBundleTestCase(TestBase):
         # binary & dSYM via target.exec-search-paths 
         settings_str = "settings set target.exec-search-paths " + self.get_process_working_directory() + "/hide.app"
         self.runCmd(settings_str)
-
         self.runCmd("process attach -p " + str(popen.pid))
 
         target = self.dbg.GetSelectedTarget()

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/find-dsym/deep-bundle/main.c Tue Jan 30 10:29:16 2018
@@ -1,12 +1,17 @@
 #include <MyFramework/MyFramework.h>
 #include <unistd.h>
+#include <stdio.h>
 #include <stdlib.h>
 
 int setup_is_complete = 0;
 
-int main()
+int main(int argc, const char **argv)
 {
-    system ("/bin/rm -rf MyFramework MyFramework.framework MyFramework.framework.dSYM");
+    char command[8192];
+    sprintf (command,
+             "/bin/rm -rf %s/MyFramework %s/MyFramework.framework %s/MyFramework.framework.dSYM",
+             argv[1], argv[1], argv[1]);
+    system (command);
 
     setup_is_complete = 1;
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/Makefile Tue Jan 30 10:29:16 2018
@@ -1,14 +1,6 @@
-CC ?= clang
-ifeq "$(ARCH)" ""
-	ARCH = x86_64
-endif
-
-ifeq "$(OS)" ""
-	OS = $(shell uname -s)
-endif
+LEVEL = ../../make
 
-CFLAGS ?= -g -O0
-CWD := $(shell pwd)
+include $(LEVEL)/Makefile.rules
 
 LIB_PREFIX := lib
 
@@ -28,21 +20,21 @@ all: a.out $(LIB_INDIRECT) $(LIB_REEXPOR
 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)

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py Tue Jan 30 10:29:16 2018
@@ -32,8 +32,8 @@ class TestIndirectFunctions(TestBase):
         self.assertTrue(target, VALID_TARGET)
 
         if self.platformIsDarwin():
-            lib1 = os.path.join(os.getcwd(), 'libindirect.dylib')
-            lib2 = os.path.join(os.getcwd(), 'libreexport.dylib')
+            lib1 = self.getBuildArtifact('libindirect.dylib')
+            lib2 = self.getBuildArtifact('libreexport.dylib')
             self.registerSharedLibrariesWithTarget(target, [lib1, lib2])
 
         self.main_source_spec = lldb.SBFileSpec(self.main_source)

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py Tue Jan 30 10:29:16 2018
@@ -111,7 +111,7 @@ class DarwinNSLogOutputTestCase(lldbtest
         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()

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/order/Makefile Tue Jan 30 10:29:16 2018
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/Makefile Tue Jan 30 10:29:16 2018
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/Makefile Tue Jan 30 10:29:16 2018
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/thread-names/Makefile Tue Jan 30 10:29:16 2018
@@ -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

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/Makefile?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/Makefile (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/Makefile Tue Jan 30 10:29:16 2018
@@ -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* *~)

Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py Tue Jan 30 10:29:16 2018
@@ -33,7 +33,7 @@ class UniversalTestCase(TestBase):
         self.build()
 
         # Note that "testit" is a universal binary.
-        exe = os.path.join(os.getcwd(), "testit")
+        exe = self.getBuildArtifact("testit")
 
         # Create a target by the debugger.
         target = self.dbg.CreateTargetWithFileAndTargetTriple(
@@ -57,7 +57,7 @@ class UniversalTestCase(TestBase):
         self.build()
 
         # Note that "testit" is a universal binary.
-        exe = os.path.join(os.getcwd(), "testit")
+        exe = self.getBuildArtifact("testit")
 
         # By default, x86_64 is assumed if no architecture is specified.
         self.expect("file " + exe, CURRENT_EXECUTABLE_SET,
@@ -130,7 +130,7 @@ class UniversalTestCase(TestBase):
         self.build()
 
         # Note that "testit" is a universal binary.
-        exe = os.path.join(os.getcwd(), "testit")
+        exe = self.getBuildArtifact("testit")
 
         # Create a target by the debugger.
         target = self.dbg.CreateTargetWithFileAndTargetTriple(

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Tue Jan 30 10:29:16 2018
@@ -6,6 +6,7 @@
 # OBJC_SOURCES :=
 # OBJCXX_SOURCES :=
 # DYLIB_C_SOURCES :=
+# DYLIB_OBJC_SOURCES :=
 # DYLIB_CXX_SOURCES :=
 #
 # Specifying DYLIB_ONLY has the effect of building dylib only, skipping
@@ -27,7 +28,8 @@
 # Uncomment line below for debugging shell commands
 # SHELL = /bin/sh -x
 
-THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/
+SRCDIR := $(shell dirname $(firstword $(MAKEFILE_LIST)))/
+THIS_FILE_DIR := $(shell dirname $(lastword $(MAKEFILE_LIST)))/
 LLDB_BASE_DIR := $(THIS_FILE_DIR)../../../../../
 
 
@@ -223,7 +225,7 @@ else
 	CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) -I$(LLDB_BASE_DIR)include
 endif
 
-CFLAGS += -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR)
+CFLAGS += -I$(SRCDIR) -include $(THIS_FILE_DIR)test_common.h -I$(THIS_FILE_DIR)
 CFLAGS += $(NO_LIMIT_DEBUG_INFO_FLAGS) $(ARCH_CFLAGS) $(CFLAGS_EXTRAS)
 
 # Use this one if you want to build one part of the result without debug information:
@@ -494,23 +496,6 @@ endif
 #----------------------------------------------------------------------
 
 #----------------------------------------------------------------------
-# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
-#----------------------------------------------------------------------
-ifneq "$(DYLIB_ONLY)" "YES"
-$(DSYM) : $(EXE)
-ifeq "$(OS)" "Darwin"
-ifneq "$(MAKE_DSYM)" "NO"
-	"$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
-endif
-else
-ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-	$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
-	$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
-endif
-endif
-endif
-
-#----------------------------------------------------------------------
 # Compile the executable from all the objects.
 #----------------------------------------------------------------------
 ifneq "$(DYLIB_NAME)" ""
@@ -526,6 +511,22 @@ $(EXE) : $(OBJECTS) $(ARCHIVE_NAME)
 endif
 
 #----------------------------------------------------------------------
+# Make the dSYM file from the executable if $(MAKE_DSYM) != "NO"
+#----------------------------------------------------------------------
+$(DSYM) : $(EXE)
+ifeq "$(OS)" "Darwin"
+ifneq "$(MAKE_DSYM)" "NO"
+	"$(DS)" $(DSFLAGS) -o "$(DSYM)" "$(EXE)"
+else
+endif
+else
+ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
+	$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
+	$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
+endif
+endif
+
+#----------------------------------------------------------------------
 # Make the archive
 #----------------------------------------------------------------------
 ifneq "$(ARCHIVE_NAME)" ""
@@ -565,7 +566,7 @@ endif
 
 #ifneq "$(PCH_OUTPUT)" ""
 $(PCH_OUTPUT) : $(PCH_CXX_SOURCE)
-	$(CXX) $(CXXFLAGS) -x c++-header -o $(PCH_OUTPUT) $(PCH_CXX_SOURCE)
+	$(CXX) $(CXXFLAGS) -x c++-header -o $@ $<
 %.o : %.cpp $(PCH_OUTPUT)
 	$(CXX) $(PCHFLAGS) $(CXXFLAGS) -c -o $@ $<
 #endif

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py Tue Jan 30 10:29:16 2018
@@ -50,13 +50,31 @@ def getArchFlag():
 
     return ("ARCHFLAG=" + archflag) if archflag else ""
 
-
-def getMake():
-    """Returns the name for GNU make"""
+def getMake(test_subdir):
+    """Returns the invocation for GNU make.
+       The argument test_subdir is the relative path to the testcase."""
     if platform.system() == "FreeBSD" or platform.system() == "NetBSD":
-        return "gmake"
+        make = "gmake"
     else:
-        return "make"
+        make = "make"
+
+    # Construct the base make invocation.
+    lldb_test = os.environ["LLDB_TEST"]
+    lldb_build = os.environ["LLDB_BUILD"]
+    if not (lldb_test and lldb_build and test_subdir and
+            (not os.path.isabs(test_subdir))):
+        raise Exception("Could not derive test directories")
+    build_dir = os.path.join(lldb_build, test_subdir)
+    test_dir = os.path.join(lldb_test, test_subdir)
+    # This is a bit of a hack to make inline testcases work.
+    makefile = os.path.join(test_dir, "Makefile")
+    if not os.path.isfile(makefile):
+        makefile = os.path.join(build_dir, "Makefile")
+    return [make,
+            "VPATH="+test_dir,
+            "-C", build_dir,
+            "-I", test_dir,
+            "-f", makefile]
 
 
 def getArchSpec(architecture):
@@ -121,12 +139,13 @@ def buildDefault(
         architecture=None,
         compiler=None,
         dictionary=None,
-        clean=True):
+        clean=True,
+        testdir=None):
     """Build the binaries the default way."""
     commands = []
     if clean:
-        commands.append([getMake(), "clean", getCmdLine(dictionary)])
-    commands.append([getMake(), getArchSpec(architecture),
+        commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)])
+    commands.append(getMake(testdir) + [getArchSpec(architecture),
                      getCCSpec(compiler), getCmdLine(dictionary)])
 
     runBuildCommands(commands, sender=sender)
@@ -140,12 +159,13 @@ def buildDwarf(
         architecture=None,
         compiler=None,
         dictionary=None,
-        clean=True):
+        clean=True,
+        testdir=None):
     """Build the binaries with dwarf debug info."""
     commands = []
     if clean:
-        commands.append([getMake(), "clean", getCmdLine(dictionary)])
-    commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec(
+        commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)])
+    commands.append(getMake(testdir) + ["MAKE_DSYM=NO", getArchSpec(
         architecture), getCCSpec(compiler), getCmdLine(dictionary)])
 
     runBuildCommands(commands, sender=sender)
@@ -158,13 +178,17 @@ def buildDwo(
         architecture=None,
         compiler=None,
         dictionary=None,
-        clean=True):
+        clean=True,
+        testdir=None):
     """Build the binaries with dwarf debug info."""
     commands = []
     if clean:
-        commands.append([getMake(), "clean", getCmdLine(dictionary)])
-    commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec(
-        architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+        commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)])
+    commands.append(getMake(testdir) +
+                    ["MAKE_DSYM=NO", "MAKE_DWO=YES",
+                     getArchSpec(architecture),
+                     getCCSpec(compiler),
+                     getCmdLine(dictionary)])
 
     runBuildCommands(commands, sender=sender)
     # True signifies that we can handle building dwo.
@@ -176,13 +200,14 @@ def buildGModules(
         architecture=None,
         compiler=None,
         dictionary=None,
-        clean=True):
+        clean=True,
+        testdir=None):
     """Build the binaries with dwarf debug info."""
     commands = []
     if clean:
-        commands.append([getMake(), "clean", getCmdLine(dictionary)])
-    commands.append([getMake(),
-                     "MAKE_DSYM=NO",
+        commands.append(getMake(testdir) + ["clean", getCmdLine(dictionary)])
+    commands.append(getMake(testdir) +
+                    ["MAKE_DSYM=NO",
                      "MAKE_GMODULES=YES",
                      getArchSpec(architecture),
                      getCCSpec(compiler),
@@ -195,12 +220,4 @@ def buildGModules(
 
 def cleanup(sender=None, dictionary=None):
     """Perform a platform-specific cleanup after the test."""
-    #import traceback
-    # traceback.print_stack()
-    commands = []
-    if os.path.isfile("Makefile"):
-        commands.append([getMake(), "clean", getCmdLine(dictionary)])
-
-    runBuildCommands(commands, sender=sender)
-    # True signifies that we can handle cleanup.
     return True

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py Tue Jan 30 10:29:16 2018
@@ -5,20 +5,23 @@ import lldbsuite.test.lldbtest as lldbte
 
 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)
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py Tue Jan 30 10:29:16 2018
@@ -6,5 +6,6 @@ def buildDsym(
         architecture=None,
         compiler=None,
         dictionary=None,
-        clean=True):
+        clean=True,
+        testdir=None):
     return False

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py Tue Jan 30 10:29:16 2018
@@ -6,5 +6,6 @@ def buildDsym(
         architecture=None,
         compiler=None,
         dictionary=None,
-        clean=True):
+        clean=True,
+        testdir=None):
     return False

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py Tue Jan 30 10:29:16 2018
@@ -6,5 +6,6 @@ def buildDsym(
         architecture=None,
         compiler=None,
         dictionary=None,
-        clean=True):
+        clean=True,
+        testdir=None):
     return False

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py Tue Jan 30 10:29:16 2018
@@ -6,5 +6,6 @@ def buildDsym(
         architecture=None,
         compiler=None,
         dictionary=None,
-        clean=True):
+        clean=True,
+        testdir=None):
     return False

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py Tue Jan 30 10:29:16 2018
@@ -34,7 +34,7 @@ class SBTypeMemberFunctionsTest(TestBase
         d = {'EXE': self.exe_name}
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
 
         # Create a target by the debugger.
         target = self.dbg.CreateTarget(exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py Tue Jan 30 10:29:16 2018
@@ -28,10 +28,12 @@ class SBFormattersAPITestCase(TestBase):
         self.setTearDownCleanup()
 
         """Test Python APIs for working with formatters"""
-        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
+        self.runCmd("file " + self.getBuildArtifact("a.out"),
+                    CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_break_set_by_file_and_line(
-            self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+            self, "main.cpp", self.line, num_expected_locations=1,
+            loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -439,7 +441,8 @@ class SBFormattersAPITestCase(TestBase):
         self.build(dictionary={'EXE': 'no_synth'})
         self.setTearDownCleanup()
 
-        self.runCmd("file no_synth", CURRENT_EXECUTABLE_SET)
+        self.runCmd("file " + self.getBuildArtifact("no_synth"),
+                    CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_break_set_by_file_and_line(
             self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py Tue Jan 30 10:29:16 2018
@@ -21,7 +21,7 @@ class HelloWorldTestCase(TestBase):
         # Call super's setUp().
         TestBase.setUp(self)
         # Get the full path to our executable to be attached/debugged.
-        self.exe = os.path.join(os.getcwd(), self.testMethodName)
+        self.exe = self.getBuildArtifact(self.testMethodName)
         self.d = {'EXE': self.testMethodName}
         # Find a couple of the line numbers within main.c.
         self.line1 = line_number('main.c', '// Set break point at this line.')

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py Tue Jan 30 10:29:16 2018
@@ -20,10 +20,10 @@ class ProcessIOTestCase(TestBase):
         # Call super's setUp().
         TestBase.setUp(self)
         # Get the full path to our executable to be debugged.
-        self.exe = os.path.join(os.getcwd(), "process_io")
-        self.local_input_file = os.path.join(os.getcwd(), "input.txt")
-        self.local_output_file = os.path.join(os.getcwd(), "output.txt")
-        self.local_error_file = os.path.join(os.getcwd(), "error.txt")
+        self.exe = self.getBuildArtifact("process_io")
+        self.local_input_file = self.getBuildArtifact("input.txt")
+        self.local_output_file = self.getBuildArtifact("output.txt")
+        self.local_error_file = self.getBuildArtifact("error.txt")
 
         self.input_file = os.path.join(
             self.get_process_working_directory(), "input.txt")

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/process/read-mem-cstring/TestReadMemCString.py Tue Jan 30 10:29:16 2018
@@ -20,8 +20,10 @@ class TestReadMemCString(TestBase):
 	self.dbg.SetAsync(False)
 
         self.main_source = "main.c"
-	self.main_source_spec = lldb.SBFileSpec(self.main_source)
-	self.exe = os.path.join(os.getcwd(), "read-mem-cstring")
+        self.main_source_path = os.path.join(self.getSourceDir(),
+                                             self.main_source)
+	self.main_source_spec = lldb.SBFileSpec(self.main_source_path)
+	self.exe = self.getBuildArtifact("read-mem-cstring")
 
         (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
             self, 'breakpoint here', self.main_source_spec, None, self.exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py Tue Jan 30 10:29:16 2018
@@ -19,7 +19,7 @@ class SectionAPITestCase(TestBase):
         d = {'EXE': 'b.out'}
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
-        exe = os.path.join(os.getcwd(), 'b.out')
+        exe = self.getBuildArtifact('b.out')
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py Tue Jan 30 10:29:16 2018
@@ -149,7 +149,7 @@ class TargetAPITestCase(TestBase):
         self.assertEqual(len(content), 1)
 
     def create_simple_target(self, fn):
-        exe = os.path.join(os.getcwd(), fn)
+        exe = self.getBuildArtifact(fn)
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
         return target
@@ -175,7 +175,7 @@ class TargetAPITestCase(TestBase):
 
     def find_global_variables(self, exe_name):
         """Exercise SBTaget.FindGlobalVariables() API."""
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         # Create a target by the debugger.
         target = self.dbg.CreateTarget(exe)
@@ -216,8 +216,7 @@ class TargetAPITestCase(TestBase):
         # While we are at it, let's also exercise the similar
         # SBModule.FindGlobalVariables() API.
         for m in target.module_iter():
-            if os.path.normpath(m.GetFileSpec().GetDirectory()) == os.getcwd(
-            ) and m.GetFileSpec().GetFilename() == exe_name:
+            if os.path.normpath(m.GetFileSpec().GetDirectory()) == self.getBuildDir() and m.GetFileSpec().GetFilename() == exe_name:
                 value_list = m.FindGlobalVariables(
                     target, 'my_global_var_of_char_type', 3)
                 self.assertTrue(value_list.GetSize() == 1)
@@ -227,7 +226,7 @@ class TargetAPITestCase(TestBase):
 
     def find_functions(self, exe_name):
         """Exercise SBTaget.FindFunctions() API."""
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         # Create a target by the debugger.
         target = self.dbg.CreateTarget(exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py Tue Jan 30 10:29:16 2018
@@ -134,7 +134,7 @@ class ThreadAPITestCase(TestBase):
 
     def step_out_of_malloc_into_function_b(self, exe_name):
         """Test Python SBThread.StepOut() API to step out of a malloc call where the call site is at function b()."""
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
@@ -181,7 +181,7 @@ class ThreadAPITestCase(TestBase):
 
     def step_over_3_times(self, exe_name):
         """Test Python SBThread.StepOver() API."""
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)
@@ -227,7 +227,7 @@ class ThreadAPITestCase(TestBase):
 
     def run_to_address(self, exe_name):
         """Test Python SBThread.RunToAddress() API."""
-        exe = os.path.join(os.getcwd(), exe_name)
+        exe = self.getBuildArtifact(exe_name)
 
         target = self.dbg.CreateTarget(exe)
         self.assertTrue(target, VALID_TARGET)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py Tue Jan 30 10:29:16 2018
@@ -34,7 +34,7 @@ class TypeAndTypeListTestCase(TestBase):
         d = {'EXE': self.exe_name}
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
 
         # Create a target by the debugger.
         target = self.dbg.CreateTarget(exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py Tue Jan 30 10:29:16 2018
@@ -33,7 +33,7 @@ class ValueAPITestCase(TestBase):
         d = {'EXE': self.exe_name}
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
 
         # Create a target by the debugger.
         target = self.dbg.CreateTarget(exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py Tue Jan 30 10:29:16 2018
@@ -38,7 +38,7 @@ class ChangeValueAPITestCase(TestBase):
         d = {'EXE': self.exe_name}
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
 
         # Create a target by the debugger.
         target = self.dbg.CreateTarget(exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py Tue Jan 30 10:29:16 2018
@@ -36,7 +36,7 @@ class ValueAsLinkedListTestCase(TestBase
         d = {'EXE': self.exe_name}
         self.build(dictionary=d)
         self.setTearDownCleanup(dictionary=d)
-        exe = os.path.join(os.getcwd(), self.exe_name)
+        exe = self.getBuildArtifact(self.exe_name)
 
         # Create a target by the debugger.
         target = self.dbg.CreateTarget(exe)

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py Tue Jan 30 10:29:16 2018
@@ -21,7 +21,7 @@ class HelloWorldTestCase(TestBase):
         # Call super's setUp().
         TestBase.setUp(self)
         # Get the full path to our executable to be attached/debugged.
-        self.exe = os.path.join(os.getcwd(), self.testMethodName)
+        self.exe = self.getBuildArtifact(self.testMethodName)
         self.d = {'EXE': self.testMethodName}
 
     @add_test_categories(['pyapi'])

Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py Tue Jan 30 10:29:16 2018
@@ -42,7 +42,7 @@ class WatchpointConditionAPITestCase(Tes
         """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)

Modified: lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py Tue Jan 30 10:29:16 2018
@@ -155,7 +155,7 @@ class SettingsCommandTestCase(TestBase):
         self.runCmd("breakpoint set -n main")
         self.runCmd("run")
         self.expect("thread backtrace",
-                    substrs=["`main", os.getcwd()])
+                    substrs=["`main", self.getSourceDir()])
 
     def test_set_auto_confirm(self):
         """Test that after 'set auto-confirm true', manual confirmation should not kick in."""
@@ -421,8 +421,8 @@ class SettingsCommandTestCase(TestBase):
                     startstr='target.arg0 (string) = "cde"')
         self.runCmd("settings clear target.arg0", check=False)
         # file
-        path1 = os.path.join(os.getcwd(), "path1.txt")
-        path2 = os.path.join(os.getcwd(), "path2.txt")
+        path1 = self.getBuildArtifact("path1.txt")
+        path2 = self.getBuildArtifact("path2.txt")
         self.runCmd(
             "settings set target.output-path %s" %
             path1)   # Set to known value

Modified: lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py Tue Jan 30 10:29:16 2018
@@ -22,7 +22,7 @@ class SettingsCommandTestCase(TestBase):
     @classmethod
     def classCleanup(cls):
         """Cleanup the test byproducts."""
-        cls.RemoveTempFile("stdout.txt")
+        cls.RemoveTempFile(self.getBuildArtifact("stdout.txt"))
 
     @no_debug_info_test
     def test_no_quote(self):
@@ -82,16 +82,22 @@ class SettingsCommandTestCase(TestBase):
         exe = self.getBuildArtifact("a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        self.runCmd("process launch -- " + args_in)
+        local_outfile = self.getBuildArtifact("output.txt")
+        if lldb.remote_platform:
+            remote_outfile = "output.txt" # Relative to platform's PWD
+        else:
+            remote_outfile = local_outfile
+
+        self.runCmd("process launch -- %s %s" %(remote_outfile, args_in))
 
         if lldb.remote_platform:
-            src_file_spec = lldb.SBFileSpec('output.txt', False)
-            dst_file_spec = lldb.SBFileSpec('output.txt', True)
+            src_file_spec = lldb.SBFileSpec(remote_outfile, False)
+            dst_file_spec = lldb.SBFileSpec(local_outfile, True)
             lldb.remote_platform.Get(src_file_spec, dst_file_spec)
 
-        with open('output.txt', 'r') as f:
+        with open(local_outfile, 'r') as f:
             output = f.read()
 
-        self.RemoveTempFile("output.txt")
+        self.RemoveTempFile(local_outfile)
 
         self.assertEqual(output, args_out)

Modified: lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/main.c?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/main.c (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/main.c Tue Jan 30 10:29:16 2018
@@ -8,11 +8,11 @@ main(int argc, char const *argv[])
 {
     int i;
 
-    FILE *output = fopen ("output.txt", "w");
+    FILE *output = fopen (argv[1], "w");
     if (output == NULL)
         exit (1);
 
-    for (i = 1; i < argc; ++i)
+    for (i = 2; i < argc; ++i)
         fwrite(argv[i], strlen(argv[i])+1, 1, output);
 
     fclose (output);

Modified: lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py Tue Jan 30 10:29:16 2018
@@ -140,10 +140,12 @@ class SourceManagerTestCase(TestBase):
 
         # Set target.source-map settings.
         self.runCmd("settings set target.source-map %s %s" %
-                    (os.getcwd(), os.path.join(os.getcwd(), "hidden")))
+                    (self.getSourceDir(),
+                     os.path.join(self.getSourceDir(), "hidden")))
         # And verify that the settings work.
         self.expect("settings show target.source-map",
-                    substrs=[os.getcwd(), os.path.join(os.getcwd(), "hidden")])
+                    substrs=[self.getSourceDir(),
+                             os.path.join(self.getSourceDir(), "hidden")])
 
         # Display main() and verify that the source mapping has been kicked in.
         self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
@@ -235,10 +237,11 @@ class SourceManagerTestCase(TestBase):
     def test_set_breakpoint_with_absolute_path(self):
         self.build()
         self.runCmd("settings set target.source-map %s %s" %
-                    (os.getcwd(), os.path.join(os.getcwd(), "hidden")))
+                    (self.getSourceDir(),
+                     os.path.join(self.getSourceDir(), "hidden")))
 
         exe = self.getBuildArtifact("a.out")
-        main = os.path.join(os.getcwd(), "hidden", "main.c")
+        main = os.path.join(self.getSourceDir(), "hidden", "main.c")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_break_set_by_file_and_line(

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py Tue Jan 30 10:29:16 2018
@@ -29,7 +29,7 @@ class MiLibraryLoadedTestCase(lldbmi_tes
 
         # 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",

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py Tue Jan 30 10:29:16 2018
@@ -200,7 +200,7 @@ class MiBreakTestCase(lldbmi_testcase.Mi
         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\"")

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py Tue Jan 30 10:29:16 2018
@@ -13,6 +13,7 @@ class MiTestCaseBase(Base):
     mydir = None
     myexe = None
     mylog = None
+    NO_DEBUG_INFO_TESTCASE = True
 
     @classmethod
     def classCleanup(cls):
@@ -22,7 +23,11 @@ class MiTestCaseBase(Base):
             TestBase.RemoveTempFile(cls.mylog)
 
     def setUp(self):
+        if not self.mydir:
+            raise("mydir is empty")
+
         Base.setUp(self)
+        self.makeBuildDir()
         self.buildDefault()
         self.child_prompt = "(gdb)"
         self.myexe = self.getBuildArtifact("a.out")

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py Tue Jan 30 10:29:16 2018
@@ -92,7 +92,7 @@ class MiSymbolTestCase(lldbmi_testcase.M
         # 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+\"\})+\]" %

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py Tue Jan 30 10:29:16 2018
@@ -32,7 +32,7 @@ class MiTargetTestCase(lldbmi_testcase.M
         # Load executable
         # FIXME: -file-exec-and-sybmols is not required for target attach, but
         # the test will not pass without this
-        self.runCmd("-file-exec-and-symbols %s" % exeName)
+        self.runCmd("-file-exec-and-symbols %s" % self.getBuildArtifact(exeName))
         self.expect("\^done")
 
         # Set up attach
@@ -40,7 +40,7 @@ class MiTargetTestCase(lldbmi_testcase.M
         time.sleep(4)  # Give attach time to setup
 
         # Start target process
-        self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName))
+        self.spawnSubprocess(self.getBuildArtifact(exeName))
         self.addTearDownHook(self.cleanupSubprocesses)
         self.expect("\^done")
 
@@ -71,8 +71,7 @@ class MiTargetTestCase(lldbmi_testcase.M
         self.addTearDownCleanup(dictionary=d)
 
         # Start target process
-        targetProcess = self.spawnSubprocess(
-            os.path.join(os.path.dirname(__file__), exeName))
+        targetProcess = self.spawnSubprocess(self.getBuildArtifact(exeName))
         self.addTearDownHook(self.cleanupSubprocesses)
 
         self.spawnLldbMi(args=None)
@@ -109,7 +108,7 @@ class MiTargetTestCase(lldbmi_testcase.M
 
         # 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)

Modified: lldb/trunk/packages/Python/lldbsuite/test/types/AbstractBase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/types/AbstractBase.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/types/AbstractBase.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/types/AbstractBase.py Tue Jan 30 10:29:16 2018
@@ -34,7 +34,7 @@ class GenericTester(TestBase):
         # module cacheing subsystem to be confused with executable name "a.out"
         # used for all the test cases.
         self.exe_name = self.testMethodName
-        self.golden_filename = os.path.join(os.getcwd(), "golden-output.txt")
+        self.golden_filename = self.getBuildArtifact("golden-output.txt")
 
     def tearDown(self):
         """Cleanup the test byproducts."""
@@ -113,8 +113,8 @@ class GenericTester(TestBase):
             quotedDisplay=False,
             blockCaptured=False):
         """Test that variables with basic types are displayed correctly."""
-
-        self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+        self.runCmd("file %s" % self.getBuildArtifact(exe_name),
+                    CURRENT_EXECUTABLE_SET)
 
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
@@ -210,7 +210,8 @@ class GenericTester(TestBase):
             blockCaptured=False):
         """Test that variable expressions with basic types are evaluated correctly."""
 
-        self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+        self.runCmd("file %s" % self.getBuildArtifact(exe_name),
+                    CURRENT_EXECUTABLE_SET)
 
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.

Modified: lldb/trunk/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/warnings/uuid/TestAddDsymCommand.py Tue Jan 30 10:29:16 2018
@@ -64,7 +64,7 @@ class AddDsymCommandCase(TestBase):
 
     def generate_main_cpp(self, version=0):
         """Generate main.cpp from main.cpp.template."""
-        temp = os.path.join(os.getcwd(), self.template)
+        temp = os.path.join(self.getSourceDir(), self.template)
         with open(temp, 'r') as f:
             content = f.read()
 
@@ -72,7 +72,8 @@ class AddDsymCommandCase(TestBase):
             '%ADD_EXTRA_CODE%',
             'printf("This is version %d\\n");' %
             version)
-        src = os.path.join(os.getcwd(), self.source)
+        self.makeBuildDir()
+        src = os.path.join(self.getBuildDir(), self.source)
         with open(src, 'w') as f:
             f.write(new_content)
 
@@ -86,11 +87,13 @@ class AddDsymCommandCase(TestBase):
         exe_path = self.getBuildArtifact(exe_name)
         self.runCmd("file " + exe_path, CURRENT_EXECUTABLE_SET)
 
-        wrong_path = os.path.join("%s.dSYM" % exe_name, "Contents")
+        wrong_path = os.path.join(self.getBuildDir(),
+                                  "%s.dSYM" % exe_name, "Contents")
         self.expect("add-dsym " + wrong_path, error=True,
                     substrs=['invalid module path'])
 
         right_path = os.path.join(
+            self.getBuildDir(),
             "%s.dSYM" %
             exe_path,
             "Contents",
@@ -108,6 +111,7 @@ class AddDsymCommandCase(TestBase):
         # This time, the UUID should match and we expect some feedback from
         # lldb.
         right_path = os.path.join(
+            self.getBuildDir(),
             "%s.dSYM" %
             exe_path,
             "Contents",

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Jan 30 10:29:16 2018
@@ -5136,10 +5136,8 @@ uint32_t ObjectFileMachO::GetDependentMo
         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;
-        }
       }
     }
   }

Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=323803&r1=323802&r2=323803&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Tue Jan 30 10:29:16 2018
@@ -6,6 +6,8 @@ function(add_python_test_target name tes
     )
 
   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 @@ set(LLDB_TEST_COMMON_ARGS
   --executable $<TARGET_FILE:lldb>
   -s
   ${CMAKE_BINARY_DIR}/lldb-test-traces
+  --build-dir
+  ${CMAKE_BINARY_DIR}/lldb-test-build
   -S nm
   -u CXXFLAGS
   -u CFLAGS




More information about the lldb-commits mailing list