[Lldb-commits] [lldb] 4e0e79d - [lldb] Simplify some lldb-server tests
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 6 06:40:10 PST 2021
Author: Pavel Labath
Date: 2021-01-06T15:39:51+01:00
New Revision: 4e0e79dd349a208384449fd8dcdc9bf1644ee0f3
URL: https://github.com/llvm/llvm-project/commit/4e0e79dd349a208384449fd8dcdc9bf1644ee0f3
DIFF: https://github.com/llvm/llvm-project/commit/4e0e79dd349a208384449fd8dcdc9bf1644ee0f3.diff
LOG: [lldb] Simplify some lldb-server tests
Remove manual test duplication.
Added:
Modified:
lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py
lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py
lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
Removed:
################################################################################
diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py
index 9d9c4d89e0b5..a16ba6dc3443 100644
--- a/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py
+++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteAuxvSupport.py
@@ -3,7 +3,6 @@
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-
class TestGdbRemoteAuxvSupport(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -11,25 +10,9 @@ class TestGdbRemoteAuxvSupport(gdbremote_testcase.GdbRemoteTestCaseBase):
AUXV_SUPPORT_FEATURE_NAME = "qXfer:auxv:read"
def has_auxv_support(self):
- inferior_args = ["message:main entered", "sleep:5"]
- procs = self.prep_debug_monitor_and_inferior(
- inferior_args=inferior_args)
-
- # Don't do anything until we match the launched inferior main entry output.
- # Then immediately interrupt the process.
- # This prevents auxv data being asked for before it's ready and leaves
- # us in a stopped state.
- self.test_sequence.add_log_lines([
- # Start the inferior...
- "read packet: $c#63",
- # ... match output....
- {"type": "output_match", "regex": self.maybe_strict_output_regex(
- r"message:main entered\r\n")},
- ], True)
- # ... then interrupt.
- self.add_interrupt_packets()
- self.add_qSupported_packets()
+ procs = self.prep_debug_monitor_and_inferior()
+ self.add_qSupported_packets()
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
@@ -87,27 +70,19 @@ def get_raw_auxv_data(self):
self.assertIsNotNone(content_raw)
return (word_size, self.decode_gdbremote_binary(content_raw))
- def supports_auxv(self):
- # When non-auxv platforms support llgs, skip the test on platforms
- # that don't support auxv.
+ @skipIfWindows # no auxv support.
+ @skipIfDarwin
+ def test_supports_auxv(self):
+ self.build()
+ self.set_inferior_startup_launch()
self.assertTrue(self.has_auxv_support())
- #
- # We skip the "supports_auxv" test on debugserver. The rest of the tests
- # appropriately skip the auxv tests if the support flag is not present
- # in the qSupported response, so the debugserver test bits are still there
- # in case debugserver code one day does have auxv support and thus those
- # tests don't get skipped.
- #
-
- @skipIfWindows # no auxv support.
- @llgs_test
- def test_supports_auxv_llgs(self):
+ @skipIfWindows
+ @expectedFailureNetBSD
+ def test_auxv_data_is_correct_size(self):
self.build()
self.set_inferior_startup_launch()
- self.supports_auxv()
- def auxv_data_is_correct_size(self):
(word_size, auxv_data) = self.get_raw_auxv_data()
self.assertIsNotNone(auxv_data)
@@ -116,21 +91,12 @@ def auxv_data_is_correct_size(self):
self.assertEqual(len(auxv_data) % (2 * word_size), 0)
self.trace("auxv contains {} entries".format(len(auxv_data) / (2*word_size)))
- @debugserver_test
- def test_auxv_data_is_correct_size_debugserver(self):
- self.build()
- self.set_inferior_startup_launch()
- self.auxv_data_is_correct_size()
-
@skipIfWindows
@expectedFailureNetBSD
- @llgs_test
- def test_auxv_data_is_correct_size_llgs(self):
+ def test_auxv_keys_look_valid(self):
self.build()
self.set_inferior_startup_launch()
- self.auxv_data_is_correct_size()
- def auxv_keys_look_valid(self):
(word_size, auxv_data) = self.get_raw_auxv_data()
self.assertIsNotNone(auxv_data)
@@ -154,21 +120,12 @@ def auxv_keys_look_valid(self):
self.assertTrue(auxv_key <= 1000)
self.trace("auxv dict: {}".format(auxv_dict))
- @debugserver_test
- def test_auxv_keys_look_valid_debugserver(self):
- self.build()
- self.set_inferior_startup_launch()
- self.auxv_keys_look_valid()
-
@skipIfWindows
@expectedFailureNetBSD
- @llgs_test
- def test_auxv_keys_look_valid_llgs(self):
+ def test_auxv_chunked_reads_work(self):
self.build()
self.set_inferior_startup_launch()
- self.auxv_keys_look_valid()
- def auxv_chunked_reads_work(self):
# Verify that multiple smaller offset,length reads of auxv data
# return the same data as a single larger read.
@@ -200,17 +157,3 @@ def auxv_chunked_reads_work(self):
# Verify both types of data collection returned same content.
self.assertEqual(auxv_dict_iterated, auxv_dict)
-
- @debugserver_test
- def test_auxv_chunked_reads_work_debugserver(self):
- self.build()
- self.set_inferior_startup_launch()
- self.auxv_chunked_reads_work()
-
- @skipIfWindows
- @expectedFailureNetBSD
- @llgs_test
- def test_auxv_chunked_reads_work_llgs(self):
- self.build()
- self.set_inferior_startup_launch()
- self.auxv_chunked_reads_work()
diff --git a/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py b/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
index aa2cf19bbf5a..943a06051a09 100644
--- a/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
+++ b/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
@@ -1,10 +1,8 @@
import xml.etree.ElementTree as ET
-
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
-
class TestGdbRemoteLibrariesSvr4Support(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -104,27 +102,23 @@ def libraries_svr4_libs_present(self):
for lib in self.get_expected_libs():
self.assertIn(os.path.realpath(self.getBuildDir() + "/" + lib), libraries_svr4_names)
- @llgs_test
@skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
def test_supports_libraries_svr4(self):
self.setup_test()
self.assertTrue(self.has_libraries_svr4_support())
- @llgs_test
@skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
@expectedFailureNetBSD
def test_libraries_svr4_well_formed(self):
self.setup_test()
self.libraries_svr4_well_formed()
- @llgs_test
@skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
@expectedFailureNetBSD
def test_libraries_svr4_load_addr(self):
self.setup_test()
self.libraries_svr4_has_correct_load_addr()
- @llgs_test
@skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
@expectedFailureNetBSD
def test_libraries_svr4_libs_present(self):
diff --git a/lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py b/lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py
index dc8f63687209..0644e6c2e1ec 100644
--- a/lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py
+++ b/lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py
@@ -1,12 +1,10 @@
-
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-
supported_linux_archs = ["x86_64", "i386"]
-supported_oses = ["linux", "windows"]
+supported_oses = ["linux", "windows"]+lldbplatformutil.getDarwinOSTriples()
class TestGdbRemoteMemoryAllocation(gdbremote_testcase.GdbRemoteTestCaseBase):
@@ -47,7 +45,6 @@ def allocate(self, size, permissions):
@skipIf(oslist=no_match(supported_oses))
@skipIf(oslist=["linux"], archs=no_match(supported_linux_archs))
@expectedFailureAll(oslist=["windows"]) # Memory allocated with incorrect permissions
- @llgs_test
def test_supported(self):
"""Make sure (de)allocation works on platforms where it's supposed to
work"""
@@ -62,7 +59,6 @@ def test_supported(self):
@skipIf(oslist=["linux"], archs=supported_linux_archs)
@skipIf(oslist=supported_oses)
- @llgs_test
def test_unsupported(self):
"""Make sure we get an "unsupported" error on platforms where the
feature is not implemented."""
@@ -77,7 +73,6 @@ def test_unsupported(self):
True)
self.expect_gdbremote_sequence()
- @llgs_test
def test_bad_packet(self):
"""Make sure we get a proper error for malformed packets."""
diff --git a/lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py b/lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
index fb4edc86f5b7..63f2e977a805 100644
--- a/lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
+++ b/lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
@@ -1,12 +1,9 @@
-
-
import gdbremote_testcase
import textwrap
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-
def _extract_register_value(reg_info, reg_bank, byte_order, bytes_per_entry=8):
reg_offset = int(reg_info["offset"])*2
reg_byte_size = int(2 * int(reg_info["bitsize"]) / 8)
@@ -29,7 +26,9 @@ class TestGdbRemoteGPacket(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- def run_test_g_packet(self):
+ @skipIfOutOfTreeDebugserver
+ @skipUnlessDarwin # G packet not supported
+ def test_g_packet(self):
self.build()
self.prep_debug_monitor_and_inferior()
self.test_sequence.add_log_lines(
@@ -49,11 +48,6 @@ def run_test_g_packet(self):
context = self.expect_gdbremote_sequence()
self.assertNotEqual(context.get("G_reply")[0], 'E')
- @skipIfOutOfTreeDebugserver
- @debugserver_test
- def test_g_packet_debugserver(self):
- self.run_test_g_packet()
-
@skipIf(archs=no_match(["x86_64"]))
def g_returns_correct_data(self, with_suffix):
procs = self.prep_debug_monitor_and_inferior()
@@ -136,16 +130,14 @@ def g_returns_correct_data(self, with_suffix):
@expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr48420")
@expectedFailureNetBSD
- @llgs_test
- def test_g_returns_correct_data_with_suffix_llgs(self):
+ def test_g_returns_correct_data_with_suffix(self):
self.build()
self.set_inferior_startup_launch()
self.g_returns_correct_data(True)
@expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr48420")
@expectedFailureNetBSD
- @llgs_test
- def test_g_returns_correct_data_no_suffix_llgs(self):
+ def test_g_returns_correct_data_no_suffix(self):
self.build()
self.set_inferior_startup_launch()
self.g_returns_correct_data(False)
diff --git a/lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py b/lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
index 16978b056044..469e5e5fedf2 100644
--- a/lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
+++ b/lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
@@ -1,10 +1,8 @@
-
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-
class TestGdbRemoteThreadName(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,7 +27,6 @@ def run_and_check_name(self, expected_name):
self.assertEqual(expected_name, kv_dict.get("name"))
@skipIfWindows # the test is not updated for Windows.
- @llgs_test
def test(self):
""" Make sure lldb-server can retrieve inferior thread name"""
self.build()
More information about the lldb-commits
mailing list