[Lldb-commits] [lldb] f40ed1f - [lldb] Fix TestObjectFileJSON and TestSymbolFileJSON
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 17 12:01:31 PDT 2023
Author: Jonas Devlieghere
Date: 2023-04-17T12:01:24-07:00
New Revision: f40ed1f619046e98d08b092b1afb835ed5156f52
URL: https://github.com/llvm/llvm-project/commit/f40ed1f619046e98d08b092b1afb835ed5156f52
DIFF: https://github.com/llvm/llvm-project/commit/f40ed1f619046e98d08b092b1afb835ed5156f52.diff
LOG: [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.
Added:
lldb/test/API/functionalities/json/object-file/Makefile
lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py
lldb/test/API/functionalities/json/object-file/main.c
lldb/test/API/functionalities/json/symbol-file/Makefile
lldb/test/API/functionalities/json/symbol-file/TestSymbolFileJSON.py
lldb/test/API/functionalities/json/symbol-file/main.c
Modified:
Removed:
lldb/test/API/macosx/symbols/Makefile
lldb/test/API/macosx/symbols/TestObjectFileJSON.py
lldb/test/API/macosx/symbols/TestSymbolFileJSON.py
lldb/test/API/macosx/symbols/main.c
################################################################################
diff --git a/lldb/test/API/functionalities/json/object-file/Makefile b/lldb/test/API/functionalities/json/object-file/Makefile
new file mode 100644
index 0000000000000..d78e8056f823e
--- /dev/null
+++ b/lldb/test/API/functionalities/json/object-file/Makefile
@@ -0,0 +1,5 @@
+C_SOURCES := main.c
+
+all: a.out
+
+include Makefile.rules
diff --git a/lldb/test/API/macosx/symbols/TestObjectFileJSON.py b/lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py
similarity index 88%
rename from lldb/test/API/macosx/symbols/TestObjectFileJSON.py
rename to lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py
index 67d9f8e3c5d02..efb1aa2c3ad8a 100644
--- a/lldb/test/API/macosx/symbols/TestObjectFileJSON.py
+++ b/lldb/test/API/functionalities/json/object-file/TestObjectFileJSON.py
@@ -19,8 +19,7 @@ def setUp(self):
def emitJSON(self, data, path):
json_object = json.dumps(data, indent=4)
- json_object_file = self.getBuildArtifact("a.json")
- with open(json_object_file, "w") as outfile:
+ with open(path, "w") as outfile:
outfile.write(json_object)
def toModuleSpec(self, path):
@@ -55,10 +54,10 @@ def test_module(self):
"uuid": str(uuid.uuid4()),
}
- json_object_file = self.getBuildArtifact("a.json")
- self.emitJSON(data, json_object_file)
+ json_object_file_b = self.getBuildArtifact("b.json")
+ self.emitJSON(data, json_object_file_b)
- module = target.AddModule(self.toModuleSpec(json_object_file))
+ module = target.AddModule(self.toModuleSpec(json_object_file_b))
self.assertFalse(module.IsValid())
data = {
@@ -82,11 +81,10 @@ def test_module(self):
],
}
- # Sleep to ensure the new file has a
diff erent timestamp
- time.sleep(2)
- self.emitJSON(data, json_object_file)
+ json_object_file_c = self.getBuildArtifact("c.json")
+ self.emitJSON(data, json_object_file_c)
- module = target.AddModule(self.toModuleSpec(json_object_file))
+ module = target.AddModule(self.toModuleSpec(json_object_file_c))
self.assertTrue(module.IsValid())
section = module.GetSectionAtIndex(0)
diff --git a/lldb/test/API/macosx/symbols/main.c b/lldb/test/API/functionalities/json/object-file/main.c
similarity index 100%
rename from lldb/test/API/macosx/symbols/main.c
rename to lldb/test/API/functionalities/json/object-file/main.c
diff --git a/lldb/test/API/macosx/symbols/Makefile b/lldb/test/API/functionalities/json/symbol-file/Makefile
similarity index 100%
rename from lldb/test/API/macosx/symbols/Makefile
rename to lldb/test/API/functionalities/json/symbol-file/Makefile
diff --git a/lldb/test/API/macosx/symbols/TestSymbolFileJSON.py b/lldb/test/API/functionalities/json/symbol-file/TestSymbolFileJSON.py
similarity index 100%
rename from lldb/test/API/macosx/symbols/TestSymbolFileJSON.py
rename to lldb/test/API/functionalities/json/symbol-file/TestSymbolFileJSON.py
diff --git a/lldb/test/API/functionalities/json/symbol-file/main.c b/lldb/test/API/functionalities/json/symbol-file/main.c
new file mode 100644
index 0000000000000..88653f66d7153
--- /dev/null
+++ b/lldb/test/API/functionalities/json/symbol-file/main.c
@@ -0,0 +1,2 @@
+int foo() { return 1; }
+int main() { return foo(); }
More information about the lldb-commits
mailing list