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    def do_test(self, term_width, pattern_list):
18        self.build()
19        # Start with a small window
20        self.launch(use_colors=True)
21        self.expect("set set show-progress true")
22        self.expect("set show show-progress", substrs=["show-progress (boolean) = true"])
23        self.expect("set set term-width " + str(term_width))
24        self.expect("set show term-width", substrs=["term-width (int) = " + str(term_width)])
25
26        self.child.send("file " + self.getBuildArtifact("a.out") + "\n")
27        self.child.expect(pattern_list)
28
29
30    # PExpect uses many timeouts internally and doesn't play well
31    # under ASAN on a loaded machine..
32    @skipIfAsan
33    @skipUnlessDarwin
34    @skipIfEditlineSupportMissing
35    def test_trimmed_progress_message(self):
36        self.do_test(19, ['Locating externa...',
37                          'Loading Apple DW...',
38                          'Parsing symbol t...'])
39
40    # PExpect uses many timeouts internally and doesn't play well
41    # under ASAN on a loaded machine..
42    @skipIfAsan
43    @skipUnlessDarwin
44    @skipIfEditlineSupportMissing
45    def test_long_progress_message(self):
46        self.do_test(80, ['Locating external symbol file for a.out...',
47                          'Loading Apple DWARF index for a.out...',
48                          'Parsing symbol table for dyld...'])
49