[Lldb-commits] [lldb] r369484 - Update a few tests that may change the platform to save & restore

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 20 17:27:30 PDT 2019


Author: jmolenda
Date: Tue Aug 20 17:27:30 2019
New Revision: 369484

URL: http://llvm.org/viewvc/llvm-project?rev=369484&view=rev
Log:
Update a few tests that may change the platform to save & restore
the platform in the setUp/tearDown methods.  I want to migrate the
re-instatement of the correct plaform to the setUp base method but
haven't had time to look at that yet, so I want to land this handful
of fixes until I get to it.

Differential revision: https://reviews.llvm.org/D66331


Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
    lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py?rev=369484&r1=369483&r2=369484&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py Tue Aug 20 17:27:30 2019
@@ -13,6 +13,14 @@ class TestWriteMemory(GDBRemoteTestBase)
             def setBreakpoint(self, packet):
                 return "OK"
 
+    def setUp(self):
+        super(TestWriteMemory, self).setUp()
+        self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+    def tearDown(self):
+        lldb.DBG.SetSelectedPlatform(self._initial_platform)
+        super(TestWriteMemory, self).tearDown()
+
         self.server.responder = MyResponder()
         target = self.dbg.CreateTargetWithFileAndTargetTriple('', 'x86_64-pc-linux')
         process = self.connect(target)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py?rev=369484&r1=369483&r2=369484&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py Tue Aug 20 17:27:30 2019
@@ -15,7 +15,13 @@ class GCoreTestCase(TestBase):
     NO_DEBUG_INFO_TESTCASE = True
 
     mydir = TestBase.compute_mydir(__file__)
-    _initial_platform = lldb.DBG.GetSelectedPlatform()
+    def setUp(self):
+        super(GCoreTestCase, self).setUp()
+        self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+    def tearDown(self):
+        lldb.DBG.SetSelectedPlatform(self._initial_platform)
+        super(GCoreTestCase, self).tearDown()
 
     _i386_pid = 5586
     _x86_64_pid = 5669
@@ -47,4 +53,3 @@ class GCoreTestCase(TestBase):
             self.assertEqual(signal, 19)
 
         self.dbg.DeleteTarget(target)
-        lldb.DBG.SetSelectedPlatform(self._initial_platform)

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py?rev=369484&r1=369483&r2=369484&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py Tue Aug 20 17:27:30 2019
@@ -15,7 +15,14 @@ class LinuxCoreThreadsTestCase(TestBase)
     NO_DEBUG_INFO_TESTCASE = True
 
     mydir = TestBase.compute_mydir(__file__)
-    _initial_platform = lldb.DBG.GetSelectedPlatform()
+
+    def setUp(self):
+        super(LinuxCoreThreadsTestCase, self).setUp()
+        self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+    def tearDown(self):
+        lldb.DBG.SetSelectedPlatform(self._initial_platform)
+        super(LinuxCoreThreadsTestCase, self).tearDown()
 
     _i386_pid = 5193
     _x86_64_pid = 5222
@@ -56,4 +63,3 @@ class LinuxCoreThreadsTestCase(TestBase)
                 self.assertEqual(signal, 0)
 
         self.dbg.DeleteTarget(target)
-        lldb.DBG.SetSelectedPlatform(self._initial_platform)

Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py?rev=369484&r1=369483&r2=369484&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py Tue Aug 20 17:27:30 2019
@@ -11,6 +11,14 @@ from lldbsuite.test import lldbutil
 class TestPlatformProcessConnect(gdbremote_testcase.GdbRemoteTestCaseBase):
     mydir = TestBase.compute_mydir(__file__)
 
+    def setUp(self):
+        super(TestPlatformProcessConnect, self).setUp()
+        self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+    def tearDown(self):
+        lldb.DBG.SetSelectedPlatform(self._initial_platform)
+        super(TestPlatformProcessConnect, self).tearDown()
+
     @llgs_test
     @no_debug_info_test
     @skipIf(remote=False)




More information about the lldb-commits mailing list