Skip to content

Commit bf19a22

Browse files
committed
Add a unit test around warning msg
1 parent e2c7786 commit bf19a22

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lldb/test/API/commands/statistics/basic/TestStats.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,30 @@ def test_transcript_happy_path(self):
849849
# The second "statistics dump" in the transcript should have no output
850850
self.assertNotIn("output", transcript[2])
851851

852+
def test_transcript_warning_when_disabled(self):
853+
"""
854+
Test that "statistics dump --transcript=true" shows a warning when
855+
transcript saving is disabled.
856+
"""
857+
self.build()
858+
exe = self.getBuildArtifact("a.out")
859+
target = self.createTestTarget(file_path=exe)
860+
861+
# Ensure transcript saving is disabled (this is the default)
862+
self.runCmd("settings set interpreter.save-transcript false")
863+
864+
# Request transcript in statistics dump and check for warning
865+
interpreter = self.dbg.GetCommandInterpreter()
866+
res = lldb.SBCommandReturnObject()
867+
interpreter.HandleCommand("statistics dump --transcript=true", res)
868+
self.assertTrue(res.Succeeded())
869+
# We should warn about transcript being requested but not saved
870+
self.assertIn(
871+
"transcript requested but none was saved. Enable with "
872+
"'settings set interpreter.save-transcript true'",
873+
res.GetError()
874+
)
875+
852876
def verify_stats(self, stats, expectation, options):
853877
for field_name in expectation:
854878
idx = field_name.find(".")

0 commit comments

Comments
 (0)