Skip to content

Commit 2f98ebd

Browse files
committed
[lldb] Fix TestObjectFileJSON and TestSymbolFileJSON
- Separate the two test and only have TestSymbolFileJSON rely on strip. - Use different file names to make sure LLDB reloads the module. This should address all the post commit review from D148062. (cherry picked from commit f40ed1f)
1 parent ae8b7ac commit 2f98ebd

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
C_SOURCES := main.c
2+
3+
all: a.out
4+
5+
include Makefile.rules

lldb/test/API/macosx/symbols/TestObjectFileJSON.py renamed to lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ def setUp(self):
1919

2020
def emitJSON(self, data, path):
2121
json_object = json.dumps(data, indent=4)
22-
json_object_file = self.getBuildArtifact("a.json")
23-
with open(json_object_file, "w") as outfile:
22+
with open(path, "w") as outfile:
2423
outfile.write(json_object)
2524

2625
def toModuleSpec(self, path):
@@ -55,10 +54,10 @@ def test_module(self):
5554
"uuid": str(uuid.uuid4()),
5655
}
5756

58-
json_object_file = self.getBuildArtifact("a.json")
59-
self.emitJSON(data, json_object_file)
57+
json_object_file_b = self.getBuildArtifact("b.json")
58+
self.emitJSON(data, json_object_file_b)
6059

61-
module = target.AddModule(self.toModuleSpec(json_object_file))
60+
module = target.AddModule(self.toModuleSpec(json_object_file_b))
6261
self.assertFalse(module.IsValid())
6362

6463
data = {
@@ -82,11 +81,10 @@ def test_module(self):
8281
],
8382
}
8483

85-
# Sleep to ensure the new file has a different timestamp
86-
time.sleep(2)
87-
self.emitJSON(data, json_object_file)
84+
json_object_file_c = self.getBuildArtifact("c.json")
85+
self.emitJSON(data, json_object_file_c)
8886

89-
module = target.AddModule(self.toModuleSpec(json_object_file))
87+
module = target.AddModule(self.toModuleSpec(json_object_file_c))
9088
self.assertTrue(module.IsValid())
9189

9290
section = module.GetSectionAtIndex(0)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
int foo() { return 1; }
2+
int main() { return foo(); }

0 commit comments

Comments
 (0)