xref: /llvm-project/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py (revision 503075e4d4a9c1b3754b21ee9ec41f176e54fd83)
1"""
2Test trimming long progress report in tiny terminal windows
3"""
4
5import os
6import tempfile
7import re
8
9import lldb
10from lldbsuite.test.decorators import *
11from lldbsuite.test.lldbtest import *
12from lldbsuite.test.lldbpexpect import PExpectTest
13
14
15class TestTrimmedProgressReporting(PExpectTest):
16    def do_test(self, term_width, pattern_list):
17        self.build()
18        # Start with a small window
19        self.launch(use_colors=True)
20        self.expect("set set show-progress true")
21        self.expect(
22            "set show show-progress", substrs=["show-progress (boolean) = true"]
23        )
24        self.expect("set set term-width " + str(term_width))
25        self.expect(
26            "set show term-width",
27            substrs=["term-width (unsigned) = " + str(term_width)],
28        )
29
30        self.child.send("file " + self.getBuildArtifact("a.out") + "\n")
31        self.child.expect(pattern_list)
32
33    # PExpect uses many timeouts internally and doesn't play well
34    # under ASAN on a loaded machine..
35    @skipIfAsan
36    @skipIfEditlineSupportMissing
37    def test_trimmed_progress_message(self):
38        self.do_test(19, ["Locating e...", "Parsing sy..."])
39
40    # PExpect uses many timeouts internally and doesn't play well
41    # under ASAN on a loaded machine..
42    @skipIfAsan
43    @skipIfEditlineSupportMissing
44    def test_long_progress_message(self):
45        self.do_test(
46            80,
47            [
48                "Locating external symbol file",
49                "Parsing symbol table",
50            ],
51        )
52