summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile3
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py28
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/stats_api/main.c3
3 files changed, 34 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile
new file mode 100644
index 00000000000..f5a47fcc46c
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py b/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py
new file mode 100644
index 00000000000..e3e1cba3aec
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py
@@ -0,0 +1,28 @@
+# Test the SBAPI for GetStatistics()
+
+import json
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestStatsAPI(TestBase):
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+
+ def test_stats_api(self):
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+ target = self.dbg.CreateTarget(exe)
+ stats = target.GetStatistics()
+ stream = lldb.SBStream()
+ res = stats.GetAsJSON(stream)
+ stats_json = sorted(json.loads(stream.GetData()))
+ self.assertEqual(len(stats_json), 4)
+ self.assertEqual(stats_json[0], "Number of expr evaluation failures")
+ self.assertEqual(stats_json[1], "Number of expr evaluation successes")
+ self.assertEqual(stats_json[2], "Number of frame var failures")
+ self.assertEqual(stats_json[3], "Number of frame var successes")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/main.c b/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/main.c
new file mode 100644
index 00000000000..03b2213bb9a
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/stats_api/main.c
@@ -0,0 +1,3 @@
+int main(void) {
+ return 0;
+}
OpenPOWER on IntegriCloud