[Lldb-commits] [PATCH] D124785: [lldb/Core] Fix "sticky" long progress messages

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 18 12:21:17 PDT 2022

JDevlieghere added inline comments.

Comment at: lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py:29-30
+        self.launch(use_colors=True)
+        # Set the terminal to a random width
+        term_width = random.randint(10, 42)
+        self.expect("set set show-progress true")
I understand the motivation, but I think it's a bad idea to intentionally introduce non-determinism in a test. Let's just make this a constant or repeat the test for two (fixed) widths.

Comment at: lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py:36-59
+        lines = []
+        with tempfile.NamedTemporaryFile() as tmpfile:
+            if self.TraceOn():
+                print("logfile: " + tmpfile.name)
+            with open(tmpfile.name, 'wb') as logfile:
+                self.child.logfile = logfile
+                self.expect("file " + self.getBuildArtifact("a.out"),
Why not use `self.child.expect_exact` with the exact sequence (including escape characters) that you're trying to match? This seems to reimplementing part of the pexpect functionality and I'm not sure we actually need it.



More information about the lldb-commits mailing list