Skip to content

Commit 7fe3b6a

Browse files
committed
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.
1 parent 39303e2 commit 7fe3b6a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

lldb/packages/Python/lldbsuite/test/configuration.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
make_path = None
4747

4848
# The overriden dwarf verison.
49+
# Don't use this to test the current compiler's
50+
# DWARF version, as this won't be set if the
51+
# version isn't overridden.
52+
# Use lldbplatformutils.getDwarfVersion() instead.
4953
dwarf_version = 0
5054

5155
# Any overridden settings.

lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from lldbsuite.test.decorators import *
99
from lldbsuite.test.lldbtest import *
1010
from lldbsuite.test import lldbutil
11-
11+
from lldbsuite.test import lldbplatformutil
1212

1313
class NamespaceLookupTestCase(TestBase):
1414
def setUp(self):
@@ -167,7 +167,7 @@ def test_scope_lookup_with_run_command(self):
167167
self.runToBkpt("continue")
168168
# FIXME: In DWARF 5 with dsyms, the ordering of functions is slightly
169169
# different, which also hits the same issues mentioned previously.
170-
if configuration.dwarf_version <= 4 or self.getDebugInfo() == "dwarf":
170+
if int(lldbplatformutil.getDwarfVersion()) <= 4 or self.getDebugInfo() == "dwarf":
171171
self.expect_expr("func()", result_type="int", result_value="2")
172172

173173
# Continue to BP_ns_scope at ns scope

lldb/test/API/python_api/type/TestTypeList.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from lldbsuite.test.decorators import *
77
from lldbsuite.test.lldbtest import *
88
from lldbsuite.test import lldbutil
9-
9+
from lldbsuite.test import lldbplatformutil
1010

1111
class TypeAndTypeListTestCase(TestBase):
1212
def setUp(self):
@@ -248,7 +248,7 @@ def test(self):
248248
self.assertEqual(myint_arr_element_type, myint_type)
249249

250250
# Test enum methods. Requires DW_AT_enum_class which was added in Dwarf 4.
251-
if configuration.dwarf_version >= 4:
251+
if int(lldbplatformutil.getDwarfVersion()) >= 4:
252252
enum_type = target.FindFirstType("EnumType")
253253
self.assertTrue(enum_type)
254254
self.DebugSBType(enum_type)

0 commit comments

Comments
 (0)