[Lldb-commits] [PATCH] D66331: Save / restore selected platform in tests that may change it

Phabricator via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 20 17:28:00 PDT 2019


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369484: Update a few tests that may change the platform to save & restore (authored by jmolenda, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66331?vs=215529&id=216297#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66331/new/

https://reviews.llvm.org/D66331

Files:
  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


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/gcore/TestGCore.py
@@ -15,7 +15,13 @@
     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 @@
             self.assertEqual(signal, 19)
 
         self.dbg.DeleteTarget(target)
-        lldb.DBG.SetSelectedPlatform(self._initial_platform)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/thread_crash/TestLinuxCoreThreads.py
@@ -15,7 +15,14 @@
     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 @@
                 self.assertEqual(signal, 0)
 
         self.dbg.DeleteTarget(target)
-        lldb.DBG.SetSelectedPlatform(self._initial_platform)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestWriteMemory.py
@@ -13,6 +13,14 @@
             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)
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/platform-process-connect/TestPlatformProcessConnect.py
@@ -11,6 +11,14 @@
 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66331.216297.patch
Type: text/x-patch
Size: 3946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190821/a40f5134/attachment.bin>


More information about the lldb-commits mailing list