diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-02-06 18:22:51 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-02-06 18:22:51 +0000 |
commit | 332351d9b98f993e4d0eb83a98ff4d4bb619b541 (patch) | |
tree | 342ad2040a651b28809035213b74aa0719f4910b /lldb/packages/Python/lldbsuite/test/python_api | |
parent | 2f6412c38962193f085f7830fd54e693579a35d2 (diff) | |
download | bcm5719-llvm-332351d9b98f993e4d0eb83a98ff4d4bb619b541.tar.gz bcm5719-llvm-332351d9b98f993e4d0eb83a98ff4d4bb619b541.zip |
Build each testcase variant in its own subdirectory and remove the srcdir lock file
This patch creates a <test>.dwarf, <test>.dwo, etc., build directory for each testcase variant.
Most importantly, this eliminates the need for the per-test lock file in the source directory.
Tests that are marked as NO_DEBUG_INFO_TESTCASE and build with
buildDefault() are built in a <test>.default build directory.
Differential Revision: https://reviews.llvm.org/D42763
llvm-svn: 324368
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api')
5 files changed, 34 insertions, 29 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py b/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py index 5ab4fad9643..f42eb883597 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py @@ -20,9 +20,6 @@ class HelloWorldTestCase(TestBase): def setUp(self): # Call super's setUp(). TestBase.setUp(self) - # Get the full path to our executable to be attached/debugged. - 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.') self.line2 = line_number('main.c', '// Waiting to be attached...') @@ -37,9 +34,12 @@ class HelloWorldTestCase(TestBase): @skipIfiOSSimulator def test_with_process_launch_api(self): """Create target, breakpoint, launch a process, and then kill it.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - target = self.dbg.CreateTarget(self.exe) + # Get the full path to our executable to be attached/debugged. + exe = self.getBuildArtifact(self.testMethodName) + d = {'EXE': exe} + self.build(dictionary=d) + self.setTearDownCleanup(dictionary=d) + target = self.dbg.CreateTarget(exe) breakpoint = target.BreakpointCreateByLocation("main.c", self.line1) @@ -82,12 +82,14 @@ class HelloWorldTestCase(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_with_attach_to_process_with_id_api(self): """Create target, spawn a process, and attach to it with process id.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - target = self.dbg.CreateTarget(self.exe) + exe = self.getBuildArtifact(self.testMethodName) + d = {'EXE': exe} + self.build(dictionary=d) + self.setTearDownCleanup(dictionary=d) + target = self.dbg.CreateTarget(exe) # Spawn a new process - popen = self.spawnSubprocess(self.exe, ["abc", "xyz"]) + popen = self.spawnSubprocess(exe, ["abc", "xyz"]) self.addTearDownHook(self.cleanupSubprocesses) # Give the subprocess time to start and wait for user input @@ -112,12 +114,14 @@ class HelloWorldTestCase(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_with_attach_to_process_with_name_api(self): """Create target, spawn a process, and attach to it with process name.""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - target = self.dbg.CreateTarget(self.exe) + exe = self.getBuildArtifact(self.testMethodName) + d = {'EXE': exe} + self.build(dictionary=d) + self.setTearDownCleanup(dictionary=d) + target = self.dbg.CreateTarget(exe) # Spawn a new process - popen = self.spawnSubprocess(self.exe, ["abc", "xyz"]) + popen = self.spawnSubprocess(exe, ["abc", "xyz"]) self.addTearDownHook(self.cleanupSubprocesses) # Give the subprocess time to start and wait for user input @@ -127,7 +131,7 @@ class HelloWorldTestCase(TestBase): error = lldb.SBError() # Pass 'False' since we don't want to wait for new instance of # "hello_world" to be launched. - name = os.path.basename(self.exe) + name = os.path.basename(exe) # While we're at it, make sure that passing a None as the process name # does not hang LLDB. diff --git a/lldb/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py b/lldb/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py index 0be34022315..e25083d6efb 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py @@ -19,6 +19,8 @@ class ProcessIOTestCase(TestBase): def setUp(self): # Call super's setUp(). TestBase.setUp(self) + + def setup_test(self): # Get the full path to our executable to be debugged. self.exe = self.getBuildArtifact("process_io") self.local_input_file = self.getBuildArtifact("input.txt") @@ -38,6 +40,7 @@ class ProcessIOTestCase(TestBase): @expectedFlakeyLinux(bugnumber="llvm.org/pr26437") def test_stdin_by_api(self): """Exercise SBProcess.PutSTDIN().""" + self.setup_test() self.build() self.create_target() self.run_process(True) @@ -49,6 +52,7 @@ class ProcessIOTestCase(TestBase): @expectedFlakeyLinux(bugnumber="llvm.org/pr26437") def test_stdin_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDIN without specifying STDOUT or STDERR.""" + self.setup_test() self.build() self.create_target() self.redirect_stdin() @@ -62,6 +66,7 @@ class ProcessIOTestCase(TestBase): @skipIfDarwinEmbedded # debugserver can't create/write files on the device def test_stdout_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT without specifying STDIN or STDERR.""" + self.setup_test() self.build() self.create_target() self.redirect_stdout() @@ -76,6 +81,7 @@ class ProcessIOTestCase(TestBase): @skipIfDarwinEmbedded # debugserver can't create/write files on the device def test_stderr_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDERR without specifying STDIN or STDOUT.""" + self.setup_test() self.build() self.create_target() self.redirect_stderr() @@ -90,6 +96,7 @@ class ProcessIOTestCase(TestBase): @skipIfDarwinEmbedded # debugserver can't create/write files on the device def test_stdout_stderr_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT and STDERR without redirecting STDIN.""" + self.setup_test() self.build() self.create_target() self.redirect_stdout() diff --git a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py index c546cf86230..2b783fb90e5 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py @@ -73,10 +73,7 @@ class SymbolContextAPITestCase(TestBase): str(compileUnit), "The compile unit should match", exe=False, - substrs=[ - os.path.join( - self.mydir, - 'main.c')]) + substrs=[self.getSourcePath('main.c')]) function = context.GetFunction() self.assertTrue(function) @@ -92,8 +89,7 @@ class SymbolContextAPITestCase(TestBase): lineEntry.GetFileSpec().GetDirectory(), "The line entry should have the correct directory", exe=False, - substrs=[ - self.mydir]) + substrs=[self.mydir]) self.expect( lineEntry.GetFileSpec().GetFilename(), "The line entry should have the correct filename", diff --git a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py index 41e44eea0a5..8640abe5625 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py @@ -22,7 +22,6 @@ class SymbolContextTwoFilesTestCase(TestBase): """Test lookup by address in a module with multiple compilation units""" self.build() exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) @@ -45,7 +44,6 @@ class SymbolContextTwoFilesTestCase(TestBase): compile unit contains DW_AT_ranges and DW_AT_ranges_base attributes.""" self.build() exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) self.assertTrue(target, VALID_TARGET) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py b/lldb/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py index e4795f22455..a83fd6e1239 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py @@ -20,16 +20,16 @@ class HelloWorldTestCase(TestBase): def setUp(self): # Call super's setUp(). TestBase.setUp(self) - # Get the full path to our executable to be attached/debugged. - self.exe = self.getBuildArtifact(self.testMethodName) - self.d = {'EXE': self.testMethodName} @add_test_categories(['pyapi']) def test_with_process_launch_api(self): """Test SBValue::GetValueDidChange""" - self.build(dictionary=self.d) - self.setTearDownCleanup(dictionary=self.d) - target = self.dbg.CreateTarget(self.exe) + # Get the full path to our executable to be attached/debugged. + exe = self.getBuildArtifact(self.testMethodName) + d = {'EXE': exe} + self.build(dictionary=d) + self.setTearDownCleanup(dictionary=d) + target = self.dbg.CreateTarget(exe) breakpoint = target.BreakpointCreateBySourceRegex( "break here", lldb.SBFileSpec("main.c")) |