[Lldb-commits] [lldb] Add options to "statistics dump" to control what sections are dumped (PR #95075)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Jun 10 21:53:26 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 1fe4f2d1a4b9d16ae41076608783df4427a4d985...f6c7737d056526714e65c35f0204b9b4a04776c3 lldb/test/API/commands/statistics/basic/TestStats.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- TestStats.py 2024-06-11 04:33:57.000000 +0000
+++ TestStats.py 2024-06-11 04:53:02.666221 +0000
@@ -666,66 +666,66 @@
exe = self.getBuildArtifact("a.out")
target = self.createTestTarget(file_path=exe)
self.runCmd("settings set interpreter.save-transcript true")
test_cases = [
- { # statistics dump
+ { # statistics dump
"options": "",
"expect": {
"commands": True,
"targets": True,
"targets.moduleIdentifiers": True,
"targets.breakpoints": True,
"modules": True,
"transcript": True,
},
},
- { # statistics dump --summary
+ { # statistics dump --summary
"options": " --summary",
"expect": {
"commands": False,
"targets": False,
"targets.moduleIdentifiers": False,
"targets.breakpoints": False,
"modules": False,
"transcript": False,
},
},
- { # statistics dump --targets
+ { # statistics dump --targets
"options": " --targets",
"expect": {
"commands": True,
"targets": True,
"targets.moduleIdentifiers": False,
"targets.breakpoints": True,
"modules": False,
"transcript": False,
},
},
- { # statistics dump --modules
+ { # statistics dump --modules
"options": " --modules",
"expect": {
"commands": True,
"targets": False,
"targets.moduleIdentifiers": False,
"targets.breakpoints": False,
"modules": True,
"transcript": False,
},
},
- { # statistics dump --targets --modules
+ { # statistics dump --targets --modules
"options": " --targets --modules",
"expect": {
"commands": True,
"targets": True,
"targets.moduleIdentifiers": True,
"targets.breakpoints": True,
"modules": True,
"transcript": False,
},
},
- { # statistics dump --transcript
+ { # statistics dump --transcript
"options": " --transcript",
"expect": {
"commands": True,
"targets": False,
"targets.moduleIdentifiers": False,
@@ -738,25 +738,39 @@
for test_case in test_cases:
options = test_case["options"]
debug_stats = self.get_stats(options)
# The following fields should always exist
- self.assertIn("totalDebugInfoEnabled", debug_stats, "Global stats should always exist")
+ self.assertIn(
+ "totalDebugInfoEnabled", debug_stats, "Global stats should always exist"
+ )
self.assertIn("memory", debug_stats, "'memory' should always exist")
# The following fields should exist/not exist depending on the test case
for field_name in test_case["expect"]:
idx = field_name.find(".")
if idx == -1:
# `field` is a top-level field
exists = field_name in debug_stats
should_exist = test_case["expect"][field_name]
should_exist_string = "" if should_exist else "not "
- self.assertEqual(exists, should_exist, f"'{field_name}' should {should_exist_string}exist for 'statistics dump{options}'")
+ self.assertEqual(
+ exists,
+ should_exist,
+ f"'{field_name}' should {should_exist_string}exist for 'statistics dump{options}'",
+ )
else:
# `field` is a string of "<top-level field>.<second-level field>"
top_level_field_name = field_name[0:idx]
- second_level_field_name = field_name[idx+1:]
- for top_level_field in debug_stats[top_level_field_name] if top_level_field_name in debug_stats else []:
+ second_level_field_name = field_name[idx + 1 :]
+ for top_level_field in (
+ debug_stats[top_level_field_name]
+ if top_level_field_name in debug_stats
+ else []
+ ):
exists = second_level_field_name in top_level_field
should_exist = test_case["expect"][field_name]
should_exist_string = "" if should_exist else "not "
- self.assertEqual(exists, should_exist, f"'{field_name}' should {should_exist_string}exist for 'statistics dump{options}'")
+ self.assertEqual(
+ exists,
+ should_exist,
+ f"'{field_name}' should {should_exist_string}exist for 'statistics dump{options}'",
+ )
``````````
</details>
https://github.com/llvm/llvm-project/pull/95075
More information about the lldb-commits
mailing list