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