From dc8b2d3d3aa4cedd66ee5b113ee8cc535f2c5a04 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 26 Oct 2015 09:28:32 +0000 Subject: Port the python api decorator to use test categories Summary: Per discussions on the mailing list, I have implemented a decorator which annotates individual test methods with categories. I have used this framework to replace the '-a' and '+a' command-line switches (now '-G pyapi' and '--skip-category pyapi') and the @python_api_test decorator (now @add_test_categories('pyapi')). The test suite now gives an error message suggesting the new options if the user specifies the deprecated +/-a switches. If the general direction is good, I will follow this up with other switches. Reviewers: tberghammer, tfiala, granata.enrico, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D14020 llvm-svn: 251277 --- lldb/test/python_api/process/TestProcessAPI.py | 10 +++++----- lldb/test/python_api/process/io/TestProcessIO.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lldb/test/python_api/process') diff --git a/lldb/test/python_api/process/TestProcessAPI.py b/lldb/test/python_api/process/TestProcessAPI.py index e75b78c62f3..0f0d3242010 100644 --- a/lldb/test/python_api/process/TestProcessAPI.py +++ b/lldb/test/python_api/process/TestProcessAPI.py @@ -21,7 +21,7 @@ class ProcessAPITestCase(TestBase): # Find the line number to break inside main(). self.line = line_number("main.cpp", "// Set break point at this line and check variable 'my_char'.") - @python_api_test + @add_test_categories(['pyapi']) def test_read_memory(self): """Test Python SBProcess.ReadMemory() API.""" self.build() @@ -104,7 +104,7 @@ class ProcessAPITestCase(TestBase): if my_uint32 != 12345: self.fail("Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output") - @python_api_test + @add_test_categories(['pyapi']) def test_write_memory(self): """Test Python SBProcess.WriteMemory() API.""" self.build() @@ -156,7 +156,7 @@ class ProcessAPITestCase(TestBase): exe=False, startstr = 'a') - @python_api_test + @add_test_categories(['pyapi']) def test_access_my_int(self): """Test access 'my_int' using Python SBProcess.GetByteOrder() and other APIs.""" self.build() @@ -246,7 +246,7 @@ class ProcessAPITestCase(TestBase): for i in new_bytes: print("byte:", i) - @python_api_test + @add_test_categories(['pyapi']) def test_remote_launch(self): """Test SBProcess.RemoteLaunch() API with a process not in eStateConnected, and it should fail.""" self.build() @@ -266,7 +266,7 @@ class ProcessAPITestCase(TestBase): success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error) self.assertTrue(not success, "RemoteLaunch() should fail for process state != eStateConnected") - @python_api_test + @add_test_categories(['pyapi']) def test_get_num_supported_hardware_watchpoints(self): """Test SBProcess.GetNumSupportedHardwareWatchpoints() API with a process.""" self.build() diff --git a/lldb/test/python_api/process/io/TestProcessIO.py b/lldb/test/python_api/process/io/TestProcessIO.py index 162003f6bcf..2dc3f40ac9b 100644 --- a/lldb/test/python_api/process/io/TestProcessIO.py +++ b/lldb/test/python_api/process/io/TestProcessIO.py @@ -28,7 +28,7 @@ class ProcessIOTestCase(TestBase): self.lines = ["Line 1", "Line 2", "Line 3"] @skipIfWindows # stdio manipulation unsupported on Windows - @python_api_test + @add_test_categories(['pyapi']) def test_stdin_by_api(self): """Exercise SBProcess.PutSTDIN().""" self.build() @@ -38,7 +38,7 @@ class ProcessIOTestCase(TestBase): self.check_process_output(output, output) @skipIfWindows # stdio manipulation unsupported on Windows - @python_api_test + @add_test_categories(['pyapi']) def test_stdin_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDIN without specifying STDOUT or STDERR.""" self.build() @@ -49,7 +49,7 @@ class ProcessIOTestCase(TestBase): self.check_process_output(output, output) @skipIfWindows # stdio manipulation unsupported on Windows - @python_api_test + @add_test_categories(['pyapi']) def test_stdout_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT without specifying STDIN or STDERR.""" self.build() @@ -61,7 +61,7 @@ class ProcessIOTestCase(TestBase): self.check_process_output(output, error) @skipIfWindows # stdio manipulation unsupported on Windows - @python_api_test + @add_test_categories(['pyapi']) def test_stderr_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDERR without specifying STDIN or STDOUT.""" self.build() @@ -73,7 +73,7 @@ class ProcessIOTestCase(TestBase): self.check_process_output(output, error) @skipIfWindows # stdio manipulation unsupported on Windows - @python_api_test + @add_test_categories(['pyapi']) def test_stdout_stderr_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT and STDERR without redirecting STDIN.""" self.build() -- cgit v1.2.3