Skip to content

Commit 11d1f52

Browse files
committed
[lldb] rename fooSynthProvider module
Currently SyntheticCappingTestCase fails with ``` AttributeError: type object 'fooSynthProvider' has no attribute 'reset_max_num_children_max' ``` The source of the issue is that lldb during PythonSynthDataFormatterTestCase imports fooSynthProvider.py module and after that during SyntheticCappingTestCase tries to import another module with the same name, finds out that it already has the module with this name and uses it instead. As a result, SyntheticCappingTestCase uses a wrong module. I've just renamed a module that SyntheticCappingTestCase is supposed to use to avoid collision.
1 parent fedb9fd commit 11d1f52

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lldb/test/API/functionalities/data-formatter/synthcapping/fooSynthProvider.py renamed to lldb/test/API/functionalities/data-formatter/synthcapping/SynthcappingSynthProvider.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import lldb
22

33

4-
class fooSynthProvider:
4+
class SynthcappingSynthProvider:
55
# For testing purposes, we'll keep track of the maximum value of
66
# max_num_children we've been called with.
77
MAX_NUM_CHILDREN_MAX = 0
88

99
@classmethod
1010
def reset_max_num_children_max(cls):
11-
old_value = fooSynthProvider.MAX_NUM_CHILDREN_MAX
12-
fooSynthProvider.MAX_NUM_CHILDREN_MAX = 0
11+
old_value = SynthcappingSynthProvider.MAX_NUM_CHILDREN_MAX
12+
SynthcappingSynthProvider.MAX_NUM_CHILDREN_MAX = 0
1313
return old_value
1414

1515
def __init__(self, valobj, dict):
1616
self.valobj = valobj
1717
self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
1818

1919
def num_children(self, max_num_children):
20-
fooSynthProvider.MAX_NUM_CHILDREN_MAX = max(
21-
fooSynthProvider.MAX_NUM_CHILDREN_MAX, max_num_children
20+
SynthcappingSynthProvider.MAX_NUM_CHILDREN_MAX = max(
21+
SynthcappingSynthProvider.MAX_NUM_CHILDREN_MAX, max_num_children
2222
)
2323
return 3
2424

lldb/test/API/functionalities/data-formatter/synthcapping/TestSyntheticCapping.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def cleanup():
4949
self.addTearDownHook(cleanup)
5050

5151
# set up the synthetic children provider
52-
self.runCmd("script from fooSynthProvider import *")
53-
self.runCmd("type synth add -l fooSynthProvider foo")
52+
self.runCmd("script from SynthcappingSynthProvider import *")
53+
self.runCmd("type synth add -l SynthcappingSynthProvider foo")
5454

5555
# note that the value of fake_a depends on target byte order
5656
if process.GetByteOrder() == lldb.eByteOrderLittle:
@@ -71,7 +71,7 @@ def cleanup():
7171
# num_children() should be called with at most max_num_children=257
7272
# (target.max-children-count + 1)
7373
self.expect(
74-
"script fooSynthProvider.reset_max_num_children_max()", substrs=["257"]
74+
"script SynthcappingSynthProvider.reset_max_num_children_max()", substrs=["257"]
7575
)
7676

7777
# check that capping works
@@ -86,7 +86,7 @@ def cleanup():
8686
],
8787
)
8888
self.expect(
89-
"script fooSynthProvider.reset_max_num_children_max()", substrs=["3"]
89+
"script SynthcappingSynthProvider.reset_max_num_children_max()", substrs=["3"]
9090
)
9191

9292
self.expect("frame variable f00_1", matching=False, substrs=["r = 34"])
@@ -95,5 +95,5 @@ def cleanup():
9595

9696
self.expect("frame variable f00_1", matching=True, substrs=["r = 34"])
9797
self.expect(
98-
"script fooSynthProvider.reset_max_num_children_max()", substrs=["257"]
98+
"script SynthcappingSynthProvider.reset_max_num_children_max()", substrs=["257"]
9999
)

0 commit comments

Comments
 (0)