[Lldb-commits] [lldb] 33c0f93 - [lldb/test] Move gdb client utils into the packages tree

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 16 02:38:36 PST 2021


Author: Pavel Labath
Date: 2021-11-16T11:35:56+01:00
New Revision: 33c0f93f6c10acff885fe11b9897943313cd5c26

URL: https://github.com/llvm/llvm-project/commit/33c0f93f6c10acff885fe11b9897943313cd5c26
DIFF: https://github.com/llvm/llvm-project/commit/33c0f93f6c10acff885fe11b9897943313cd5c26.diff

LOG: [lldb/test] Move gdb client utils into the packages tree

This infrastructure has proven proven its worth, so give it a more
prominent place.

My immediate motivation for this is the desire to reuse this
infrastructure for qemu platform testing, but I believe this move makes
sense independently of that. Moving this code to the packages tree will
allow as to add more structure to the gdb client tests -- currently they
are all crammed into the same test folder as that was the only way they
could access this code.

I'm splitting the code into two parts while moving it. The first once
contains just the generic gdb protocol wrappers, while the other one
contains the unit test glue. The reason for that is that for qemu
testing, I need to run the gdb code in a separate process, so I will
only be using the first part there.

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

Added: 
    lldb/packages/Python/lldbsuite/test/gdbclientutils.py
    lldb/packages/Python/lldbsuite/test/lldbgdbclient.py

Modified: 
    lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
    lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
    lldb/test/API/functionalities/gdb_remote_client/TestFork.py
    lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
    lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteDiskFileCompletion.py
    lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
    lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
    lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py
    lldb/test/API/functionalities/gdb_remote_client/TestIOSSimulator.py
    lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
    lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
    lldb/test/API/functionalities/gdb_remote_client/TestMultiprocess.py
    lldb/test/API/functionalities/gdb_remote_client/TestNestedRegDefinitions.py
    lldb/test/API/functionalities/gdb_remote_client/TestNoGPacketSupported.py
    lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
    lldb/test/API/functionalities/gdb_remote_client/TestPartialGPacket.py
    lldb/test/API/functionalities/gdb_remote_client/TestPlatformClient.py
    lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
    lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
    lldb/test/API/functionalities/gdb_remote_client/TestPty.py
    lldb/test/API/functionalities/gdb_remote_client/TestQemuAArch64TargetXml.py
    lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
    lldb/test/API/functionalities/gdb_remote_client/TestRegDefinitionInParts.py
    lldb/test/API/functionalities/gdb_remote_client/TestRemoteRegNums.py
    lldb/test/API/functionalities/gdb_remote_client/TestRestartBug.py
    lldb/test/API/functionalities/gdb_remote_client/TestStopPCs.py
    lldb/test/API/functionalities/gdb_remote_client/TestTargetXMLArch.py
    lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py
    lldb/test/API/functionalities/gdb_remote_client/TestThreadSelectionBug.py
    lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
    lldb/test/API/functionalities/gdb_remote_client/TestWriteMemory.py
    lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py

Removed: 
    lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py


################################################################################
diff  --git a/lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
similarity index 84%
rename from lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
rename to lldb/packages/Python/lldbsuite/test/gdbclientutils.py
index cc95564675b83..183e6a0c597a9 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
+++ b/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
@@ -1,17 +1,10 @@
 import ctypes
 import errno
 import io
-import os
-import os.path
 import threading
 import socket
-import lldb
-import binascii
 import traceback
 from lldbsuite.support import seven
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbtest_config
-
 
 def checksum(message):
     """
@@ -618,100 +611,3 @@ def _handlePacket(self, packet):
     class InvalidPacketException(Exception):
         pass
 
-
-class GDBRemoteTestBase(TestBase):
-    """
-    Base class for GDB client tests.
-
-    This class will setup and start a mock GDB server for the test to use.
-    It also provides assertPacketLogContains, which simplifies the checking
-    of packets sent by the client.
-    """
-
-    NO_DEBUG_INFO_TESTCASE = True
-    mydir = TestBase.compute_mydir(__file__)
-    server = None
-    server_socket_class = TCPServerSocket
-
-    def setUp(self):
-        TestBase.setUp(self)
-        self.server = MockGDBServer(socket_class=self.server_socket_class)
-        self.server.start()
-
-    def tearDown(self):
-        # TestBase.tearDown will kill the process, but we need to kill it early
-        # so its client connection closes and we can stop the server before
-        # finally calling the base tearDown.
-        if self.process() is not None:
-            self.process().Kill()
-        self.server.stop()
-        TestBase.tearDown(self)
-
-    def createTarget(self, yaml_path):
-        """
-        Create a target by auto-generating the object based on the given yaml
-        instructions.
-
-        This will track the generated object so it can be automatically removed
-        during tearDown.
-        """
-        yaml_base, ext = os.path.splitext(yaml_path)
-        obj_path = self.getBuildArtifact(yaml_base)
-        self.yaml2obj(yaml_path, obj_path)
-        return self.dbg.CreateTarget(obj_path)
-
-    def connect(self, target):
-        """
-        Create a process by connecting to the mock GDB server.
-
-        Includes assertions that the process was successfully created.
-        """
-        listener = self.dbg.GetListener()
-        error = lldb.SBError()
-        process = target.ConnectRemote(listener,
-                self.server.get_connect_url(), "gdb-remote", error)
-        self.assertTrue(error.Success(), error.description)
-        self.assertTrue(process, PROCESS_IS_VALID)
-        return process
-
-    def assertPacketLogContains(self, packets):
-        """
-        Assert that the mock server's packet log contains the given packets.
-
-        The packet log includes all packets sent by the client and received
-        by the server.  This fuction makes it easy to verify that the client
-        sent the expected packets to the server.
-
-        The check does not require that the packets be consecutive, but does
-        require that they are ordered in the log as they ordered in the arg.
-        """
-        i = 0
-        j = 0
-        log = self.server.responder.packetLog
-
-        while i < len(packets) and j < len(log):
-            if log[j] == packets[i]:
-                i += 1
-            j += 1
-        if i < len(packets):
-            self.fail(u"Did not receive: %s\nLast 10 packets:\n\t%s" %
-                    (packets[i], u'\n\t'.join(log)))
-
-
-class GDBPlatformClientTestBase(GDBRemoteTestBase):
-    """
-    Base class for platform server clients.
-
-    This class extends GDBRemoteTestBase by automatically connecting
-    via "platform connect" in the setUp() method.
-    """
-
-    def setUp(self):
-        super().setUp()
-        self.runCmd("platform select remote-gdb-server")
-        self.runCmd("platform connect " + self.server.get_connect_url())
-        self.assertTrue(self.dbg.GetSelectedPlatform().IsConnected())
-
-    def tearDown(self):
-        self.dbg.GetSelectedPlatform().DisconnectRemote()
-        super().tearDown()

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbgdbclient.py b/lldb/packages/Python/lldbsuite/test/lldbgdbclient.py
new file mode 100644
index 0000000000000..28ccb1db95583
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lldbgdbclient.py
@@ -0,0 +1,101 @@
+import os
+import os.path
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.gdbclientutils import *
+
+class GDBRemoteTestBase(TestBase):
+    """
+    Base class for GDB client tests.
+
+    This class will setup and start a mock GDB server for the test to use.
+    It also provides assertPacketLogContains, which simplifies the checking
+    of packets sent by the client.
+    """
+
+    NO_DEBUG_INFO_TESTCASE = True
+    server = None
+    server_socket_class = TCPServerSocket
+
+    def setUp(self):
+        TestBase.setUp(self)
+        self.server = MockGDBServer(socket_class=self.server_socket_class)
+        self.server.start()
+
+    def tearDown(self):
+        # TestBase.tearDown will kill the process, but we need to kill it early
+        # so its client connection closes and we can stop the server before
+        # finally calling the base tearDown.
+        if self.process() is not None:
+            self.process().Kill()
+        self.server.stop()
+        TestBase.tearDown(self)
+
+    def createTarget(self, yaml_path):
+        """
+        Create a target by auto-generating the object based on the given yaml
+        instructions.
+
+        This will track the generated object so it can be automatically removed
+        during tearDown.
+        """
+        yaml_base, ext = os.path.splitext(yaml_path)
+        obj_path = self.getBuildArtifact(yaml_base)
+        self.yaml2obj(yaml_path, obj_path)
+        return self.dbg.CreateTarget(obj_path)
+
+    def connect(self, target):
+        """
+        Create a process by connecting to the mock GDB server.
+
+        Includes assertions that the process was successfully created.
+        """
+        listener = self.dbg.GetListener()
+        error = lldb.SBError()
+        process = target.ConnectRemote(listener,
+                self.server.get_connect_url(), "gdb-remote", error)
+        self.assertTrue(error.Success(), error.description)
+        self.assertTrue(process, PROCESS_IS_VALID)
+        return process
+
+    def assertPacketLogContains(self, packets):
+        """
+        Assert that the mock server's packet log contains the given packets.
+
+        The packet log includes all packets sent by the client and received
+        by the server.  This fuction makes it easy to verify that the client
+        sent the expected packets to the server.
+
+        The check does not require that the packets be consecutive, but does
+        require that they are ordered in the log as they ordered in the arg.
+        """
+        i = 0
+        j = 0
+        log = self.server.responder.packetLog
+
+        while i < len(packets) and j < len(log):
+            if log[j] == packets[i]:
+                i += 1
+            j += 1
+        if i < len(packets):
+            self.fail(u"Did not receive: %s\nLast 10 packets:\n\t%s" %
+                    (packets[i], u'\n\t'.join(log)))
+
+
+class GDBPlatformClientTestBase(GDBRemoteTestBase):
+    """
+    Base class for platform server clients.
+
+    This class extends GDBRemoteTestBase by automatically connecting
+    via "platform connect" in the setUp() method.
+    """
+
+    def setUp(self):
+        super().setUp()
+        self.runCmd("platform select remote-gdb-server")
+        self.runCmd("platform connect " + self.server.get_connect_url())
+        self.assertTrue(self.dbg.GetSelectedPlatform().IsConnected())
+
+    def tearDown(self):
+        self.dbg.GetSelectedPlatform().DisconnectRemote()
+        super().tearDown()

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py b/lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
index 8026abc7fc183..422d814ef939d 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
@@ -3,7 +3,8 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class MyResponder(MockGDBServerResponder):
@@ -92,6 +93,8 @@ def readRegisters(self):
 
 class TestAArch64XMLRegOffsets(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     @skipIfLLVMTargetMissing("AArch64")

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py b/lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
index 1f4489374c778..fd7432528a08a 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestArmRegisterDefinition.py
@@ -2,10 +2,13 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestArmRegisterDefinition(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     def test(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestFork.py b/lldb/test/API/functionalities/gdb_remote_client/TestFork.py
index 73bf829e85e09..0a2750db3fc21 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestFork.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestFork.py
@@ -3,10 +3,14 @@
 import unittest
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestMultiprocess(GDBRemoteTestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
     def base_test(self, variant):
         class MyResponder(MockGDBServerResponder):
             def __init__(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
index 7341fe13fa904..16cf4b4547c39 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
@@ -3,11 +3,14 @@
 import os.path
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestGDBRemoteClient(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     class gPacketResponder(MockGDBServerResponder):
         registers = [
             "name:rax;bitsize:64;offset:0;encoding:uint;format:hex;set:General Purpose Registers;ehframe:0;dwarf:0;",

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteDiskFileCompletion.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteDiskFileCompletion.py
index 8109caf3d7310..46a3df4a7ea8e 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteDiskFileCompletion.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteDiskFileCompletion.py
@@ -1,7 +1,10 @@
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBPlatformClientTestBase
 
 class TestGDBRemoteDiskFileCompletion(GDBPlatformClientTestBase):
 
+    mydir = GDBPlatformClientTestBase.compute_mydir(__file__)
+
     def test_autocomplete_request(self):
         """Test remote disk completion on remote-gdb-server plugin"""
 

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteLoad.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
index 33f6581976c13..6a09e17408e24 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteLoad.py
@@ -1,11 +1,14 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestGDBRemoteLoad(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @expectedFailureAll(archs=["aarch64"], oslist=["freebsd"],
                         bugnumber="llvm.org/pr49414")
     def test_module_load_address(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
index cc38e1775bbe5..061f6f2747d83 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py
@@ -1,9 +1,11 @@
-from gdbclientutils import *
-
+from lldbsuite.test.gdbclientutils import *
 from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbgdbclient import GDBPlatformClientTestBase
 
 class TestGDBRemotePlatformFile(GDBPlatformClientTestBase):
 
+    mydir = GDBPlatformClientTestBase.compute_mydir(__file__)
+
     def test_file(self):
         """Test mock operations on a remote file"""
 

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py
index e1c52b07ddc37..3bec4b5f1babd 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBServerTargetXML.py
@@ -2,10 +2,14 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestGDBServerTargetXML(GDBRemoteTestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     @skipIfLLVMTargetMissing("X86")

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestIOSSimulator.py b/lldb/test/API/functionalities/gdb_remote_client/TestIOSSimulator.py
index f196f1cc09d38..59fcdf700cd05 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestIOSSimulator.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestIOSSimulator.py
@@ -1,9 +1,13 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestIOSSimulator(GDBRemoteTestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
     """
     Test that an ios simulator process is recognized as such.
     """

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py b/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
index 27b2ece6785e8..3b7488933ba59 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
@@ -2,10 +2,13 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestJLink6Armv7RegisterDefinition(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     def test(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py b/lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
index 3844699f012b3..81cc8f5f8364b 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestMemoryRegionDirtyPages.py
@@ -1,11 +1,14 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestMemoryRegionDirtyPages(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     def test(self):
         class MyResponder(MockGDBServerResponder):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestMultiprocess.py b/lldb/test/API/functionalities/gdb_remote_client/TestMultiprocess.py
index baf9f9cddedf3..b2b36050f0a32 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestMultiprocess.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestMultiprocess.py
@@ -3,10 +3,14 @@
 import unittest
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestMultiprocess(GDBRemoteTestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
     def test_qfThreadInfo(self):
         class MyResponder(MockGDBServerResponder):
             def qfThreadInfo(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestNestedRegDefinitions.py b/lldb/test/API/functionalities/gdb_remote_client/TestNestedRegDefinitions.py
index 4407e867e70ea..564fd561ae65c 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestNestedRegDefinitions.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestNestedRegDefinitions.py
@@ -2,10 +2,13 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestNestedRegDefinitions(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     def test(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestNoGPacketSupported.py b/lldb/test/API/functionalities/gdb_remote_client/TestNoGPacketSupported.py
index 6a17173cba4de..5efe110f4139e 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestNoGPacketSupported.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestNoGPacketSupported.py
@@ -2,7 +2,8 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 # This test case is testing three things:
@@ -22,6 +23,8 @@
 
 class TestNoGPacketSupported(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     def test(self):
         class MyResponder(MockGDBServerResponder):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py b/lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
index 3bf22d376b2bf..114e76d8fdd02 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
@@ -2,10 +2,13 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestNoWatchpointSupportInfo(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     def test(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestPartialGPacket.py b/lldb/test/API/functionalities/gdb_remote_client/TestPartialGPacket.py
index 14614875811d3..bfd7326f6ee4c 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestPartialGPacket.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestPartialGPacket.py
@@ -2,11 +2,14 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestPartialGPacket(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     def test(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformClient.py b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformClient.py
index ff32a6e0093a5..7dec787b07bd8 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformClient.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformClient.py
@@ -4,13 +4,16 @@
 import time
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 def hexlify(string):
     return binascii.hexlify(string.encode()).decode()
 
 class TestPlatformClient(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     def test_process_list_with_all_users(self):
         """Test connecting to a remote linux platform"""
 

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
index 2e15c8a272606..2a701b42ede88 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestPlatformKill.py
@@ -2,10 +2,13 @@
 import time
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestPlatformKill(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfRemote
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr52451")
     def test_kill_
diff erent_platform(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py b/lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
index a62d8aece790b..d6d5a964401a0 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
@@ -3,12 +3,15 @@
 import os
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 @skipIfRemote
 class TestProcessConnect(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     NO_DEBUG_INFO_TESTCASE = True
 
     def test_gdb_remote_sync(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestPty.py b/lldb/test/API/functionalities/gdb_remote_client/TestPty.py
index 50eae1e219559..6f266aa6558ef 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestPty.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestPty.py
@@ -1,7 +1,8 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 @skipIfWindows

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestQemuAArch64TargetXml.py b/lldb/test/API/functionalities/gdb_remote_client/TestQemuAArch64TargetXml.py
index 9368de7b055aa..2ad9a2cf7bba4 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestQemuAArch64TargetXml.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestQemuAArch64TargetXml.py
@@ -1,7 +1,8 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
 from textwrap import dedent
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class MyResponder(MockGDBServerResponder):
     def qXferRead(self, obj, annex, offset, length):
@@ -52,6 +53,8 @@ def qXferRead(self, obj, annex, offset, length):
 
 class TestQemuAarch64TargetXml(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     @skipIfLLVMTargetMissing("AArch64")

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py b/lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
index 44e2cfa891a4e..9d32514416c3f 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
@@ -1,10 +1,14 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestRecognizeBreakpoint(GDBRemoteTestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
     """ This tests the case where the gdb-remote server doesn't support any
         of the thread-info packets, and just tells which thread got the stop
         signal with:

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestRegDefinitionInParts.py b/lldb/test/API/functionalities/gdb_remote_client/TestRegDefinitionInParts.py
index c4ba19cc2b62c..6186ec3f9fdbe 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestRegDefinitionInParts.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestRegDefinitionInParts.py
@@ -3,10 +3,13 @@
 import time
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestRegDefinitionInParts(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @skipIfRemote
     def test(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestRemoteRegNums.py b/lldb/test/API/functionalities/gdb_remote_client/TestRemoteRegNums.py
index c3feb2aa9bdac..57219462873df 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestRemoteRegNums.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestRemoteRegNums.py
@@ -2,7 +2,8 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 # This test case checks for register number mismatch between lldb and gdb stub.
@@ -16,6 +17,8 @@
 
 class TestRemoteRegNums(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     def test(self):
         class MyResponder(MockGDBServerResponder):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestRestartBug.py b/lldb/test/API/functionalities/gdb_remote_client/TestRestartBug.py
index 142861a37dff2..e03c47809854b 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestRestartBug.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestRestartBug.py
@@ -2,11 +2,14 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestRestartBug(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @expectedFailureAll(bugnumber="llvm.org/pr24530")
     def test(self):
         """

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestStopPCs.py b/lldb/test/API/functionalities/gdb_remote_client/TestStopPCs.py
index c86d3e75fe8cd..1bbd447a230b2 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestStopPCs.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestStopPCs.py
@@ -1,11 +1,14 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestStopPCs(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     def test(self):
         class MyResponder(MockGDBServerResponder):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestTargetXMLArch.py b/lldb/test/API/functionalities/gdb_remote_client/TestTargetXMLArch.py
index 20e575ae978b0..73016e3bfc01a 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestTargetXMLArch.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestTargetXMLArch.py
@@ -2,7 +2,8 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class MyResponder(MockGDBServerResponder):
     def qXferRead(self, obj, annex, offset, length):
@@ -101,6 +102,8 @@ def readRegister(self, register):
 
 class TestTargetXMLArch(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfXmlSupportMissing
     @expectedFailureAll(archs=["i386"])
     @skipIfRemote

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py b/lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py
index 0035e1c06297f..08de888c21f84 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestThreadInfoTrailingComma.py
@@ -1,11 +1,13 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
-
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestThreadInfoTrailingComma(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     def test(self):
         class MyResponder(MockGDBServerResponder):
             def haltReason(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestThreadSelectionBug.py b/lldb/test/API/functionalities/gdb_remote_client/TestThreadSelectionBug.py
index 0902202852411..d05e6874f85bb 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestThreadSelectionBug.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestThreadSelectionBug.py
@@ -1,10 +1,14 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 
 class TestThreadSelectionBug(GDBRemoteTestBase):
+
+    mydir = TestBase.compute_mydir(__file__)
+
     def test(self):
         class MyResponder(MockGDBServerResponder):
             def cont(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestWasm.py b/lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
index 8d0f2c89b73ba..14e71642a4ac1 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestWasm.py
@@ -2,7 +2,8 @@
 import binascii
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 LLDB_INVALID_ADDRESS = lldb.LLDB_INVALID_ADDRESS
 load_address = 0x400000000
@@ -86,6 +87,8 @@ def readMemory(self, addr, length):
 
 class TestWasm(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     @skipIfAsan
     @skipIfXmlSupportMissing
     def test_load_module_with_embedded_symbols_from_remote(self):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestWriteMemory.py b/lldb/test/API/functionalities/gdb_remote_client/TestWriteMemory.py
index 73bd292463f0f..f5cd25a975309 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestWriteMemory.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestWriteMemory.py
@@ -1,11 +1,13 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
-
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestWriteMemory(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     def test(self):
 
         class MyResponder(MockGDBServerResponder):

diff  --git a/lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py b/lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py
index 6bfdd8c5ec237..9fdc25a7e307e 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py
@@ -1,11 +1,13 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
-from gdbclientutils import *
-
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase
 
 class TestqOffsets(GDBRemoteTestBase):
 
+    mydir = TestBase.compute_mydir(__file__)
+
     class Responder(MockGDBServerResponder):
         def qOffsets(self):
             return 'Text=470000;Data=470000'


        


More information about the lldb-commits mailing list