[Lldb-commits] [lldb] Fix a couple of tests that were incorrectly using configuration.dwarf_version (PR #114161)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 29 17:50:40 PDT 2024
https://github.com/jimingham updated https://github.com/llvm/llvm-project/pull/114161
>From 7fe3b6ac2e32dcb3660affa422ae8909b11670e2 Mon Sep 17 00:00:00 2001
From: Jim Ingham <jingham at apple.com>
Date: Tue, 29 Oct 2024 17:39:36 -0700
Subject: [PATCH 1/2] Fix a couple of tests that were incorrectly using
configuration.dwarf_version
directly to get the dwarf version used for the test. That's
only the overridden value, and won't be set if we're using the
compiler default. I also put a comment by the variable to make
sure people don't make the same mistake in the future.
---
lldb/packages/Python/lldbsuite/test/configuration.py | 4 ++++
lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py | 4 ++--
lldb/test/API/python_api/type/TestTypeList.py | 4 ++--
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index 1bacd74a968c31..bcc179346836d1 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -46,6 +46,10 @@
make_path = None
# The overriden dwarf verison.
+# Don't use this to test the current compiler's
+# DWARF version, as this won't be set if the
+# version isn't overridden.
+# Use lldbplatformutils.getDwarfVersion() instead.
dwarf_version = 0
# Any overridden settings.
diff --git a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
index b5e8115160d209..fbc8884a927fee 100644
--- a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
+++ b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
@@ -8,7 +8,7 @@
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-
+from lldbsuite.test import lldbplatformutil
class NamespaceLookupTestCase(TestBase):
def setUp(self):
@@ -167,7 +167,7 @@ def test_scope_lookup_with_run_command(self):
self.runToBkpt("continue")
# FIXME: In DWARF 5 with dsyms, the ordering of functions is slightly
# different, which also hits the same issues mentioned previously.
- if configuration.dwarf_version <= 4 or self.getDebugInfo() == "dwarf":
+ if int(lldbplatformutil.getDwarfVersion()) <= 4 or self.getDebugInfo() == "dwarf":
self.expect_expr("func()", result_type="int", result_value="2")
# Continue to BP_ns_scope at ns scope
diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py
index bc4d00c17c5551..09879276b44aa3 100644
--- a/lldb/test/API/python_api/type/TestTypeList.py
+++ b/lldb/test/API/python_api/type/TestTypeList.py
@@ -6,7 +6,7 @@
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-
+from lldbsuite.test import lldbplatformutil
class TypeAndTypeListTestCase(TestBase):
def setUp(self):
@@ -248,7 +248,7 @@ def test(self):
self.assertEqual(myint_arr_element_type, myint_type)
# Test enum methods. Requires DW_AT_enum_class which was added in Dwarf 4.
- if configuration.dwarf_version >= 4:
+ if int(lldbplatformutil.getDwarfVersion()) >= 4:
enum_type = target.FindFirstType("EnumType")
self.assertTrue(enum_type)
self.DebugSBType(enum_type)
>From 2350fbcf70ac1fece3babf7ef1578f7cdc79c151 Mon Sep 17 00:00:00 2001
From: Jim Ingham <jingham at apple.com>
Date: Tue, 29 Oct 2024 17:50:23 -0700
Subject: [PATCH 2/2] uglification
---
lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
index fbc8884a927fee..41141164769ec2 100644
--- a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
+++ b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
@@ -167,7 +167,10 @@ def test_scope_lookup_with_run_command(self):
self.runToBkpt("continue")
# FIXME: In DWARF 5 with dsyms, the ordering of functions is slightly
# different, which also hits the same issues mentioned previously.
- if int(lldbplatformutil.getDwarfVersion()) <= 4 or self.getDebugInfo() == "dwarf":
+ if (
+ int(lldbplatformutil.getDwarfVersion()) <= 4
+ or self.getDebugInfo() == "dwarf"
+ ):
self.expect_expr("func()", result_type="int", result_value="2")
# Continue to BP_ns_scope at ns scope
More information about the lldb-commits
mailing list