1"""
2Test that variables of integer basic types are displayed correctly.
3"""
4
5
6
7import AbstractBase
8import lldb
9from lldbsuite.test.lldbtest import *
10
11# rdar://problem/9649573
12# Capture the lldb and gdb-remote log files for test failures when run
13# with no "-w" option
14
15
16class DebugIntegerTypesFailures(TestBase):
17
18    def setUp(self):
19        # Call super's setUp().
20        TestBase.setUp(self)
21        # If we're lucky, test_long_type_with_dsym fails.
22        # Let's turn on logging just for that.
23        try:
24            if "test_long_type_with_dsym" in self.id():
25                self.runCmd(
26                    "log enable -n -f %s lldb commands event process state" %
27                    os.environ["DEBUG_LLDB_LOG"])
28                self.runCmd(
29                    "log enable -n -f %s gdb-remote packets process" %
30                    os.environ["DEBUG_GDB_REMOTE_LOG"])
31        except:
32            pass
33
34    def tearDown(self):
35        # If we're lucky, test_long_type_with_dsym fails.
36        # Let's turn off logging just for that.
37        if "test_long_type_with_dsym" in self.id():
38            self.runCmd("log disable lldb")
39            self.runCmd("log disable gdb-remote")
40        # Call super's tearDown().
41        TestBase.tearDown(self)
42
43    def test_char_type(self):
44        """Test that char-type variables are displayed correctly."""
45        d = {'CXX_SOURCES': 'char.cpp'}
46        self.build(dictionary=d)
47        self.setTearDownCleanup(dictionary=d)
48        self.generic_type_tester(set(['char']), quotedDisplay=True)
49
50    def test_short_type(self):
51        """Test that short-type variables are displayed correctly."""
52        d = {'CXX_SOURCES': 'short.cpp'}
53        self.build(dictionary=d)
54        self.setTearDownCleanup(dictionary=d)
55        self.generic_type_tester(set(['short']))
56
57    def test_int_type(self):
58        """Test that int-type variables are displayed correctly."""
59        d = {'CXX_SOURCES': 'int.cpp'}
60        self.build(dictionary=d)
61        self.setTearDownCleanup(dictionary=d)
62        self.generic_type_tester(set(['int']))
63
64    def test_long_type(self):
65        """Test that long-type variables are displayed correctly."""
66        d = {'CXX_SOURCES': 'long.cpp'}
67        self.build(dictionary=d)
68        self.setTearDownCleanup(dictionary=d)
69        self.generic_type_tester(set(['long']))
70
71    def test_long_long_type(self):
72        """Test that 'long long'-type variables are displayed correctly."""
73        d = {'CXX_SOURCES': 'long_long.cpp'}
74        self.build(dictionary=d)
75        self.setTearDownCleanup(dictionary=d)
76        self.generic_type_tester(set(['long long']))
77