reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
"""
Test that variables of integer basic types are displayed correctly.
"""

from __future__ import print_function


import AbstractBase
import lldb
from lldbsuite.test.lldbtest import *

# rdar://problem/9649573
# Capture the lldb and gdb-remote log files for test failures when run
# with no "-w" option


class DebugIntegerTypesFailures(TestBase):

    mydir = TestBase.compute_mydir(__file__)

    def setUp(self):
        # Call super's setUp().
        TestBase.setUp(self)
        # If we're lucky, test_long_type_with_dsym fails.
        # Let's turn on logging just for that.
        try:
            if "test_long_type_with_dsym" in self.id():
                self.runCmd(
                    "log enable -n -f %s lldb commands event process state" %
                    os.environ["DEBUG_LLDB_LOG"])
                self.runCmd(
                    "log enable -n -f %s gdb-remote packets process" %
                    os.environ["DEBUG_GDB_REMOTE_LOG"])
        except:
            pass

    def tearDown(self):
        # If we're lucky, test_long_type_with_dsym fails.
        # Let's turn off logging just for that.
        if "test_long_type_with_dsym" in self.id():
            self.runCmd("log disable lldb")
            self.runCmd("log disable gdb-remote")
        # Call super's tearDown().
        TestBase.tearDown(self)

    def test_char_type(self):
        """Test that char-type variables are displayed correctly."""
        d = {'CXX_SOURCES': 'char.cpp'}
        self.build(dictionary=d)
        self.setTearDownCleanup(dictionary=d)
        self.generic_type_tester(set(['char']), quotedDisplay=True)

    def test_short_type(self):
        """Test that short-type variables are displayed correctly."""
        d = {'CXX_SOURCES': 'short.cpp'}
        self.build(dictionary=d)
        self.setTearDownCleanup(dictionary=d)
        self.generic_type_tester(set(['short']))

    def test_int_type(self):
        """Test that int-type variables are displayed correctly."""
        d = {'CXX_SOURCES': 'int.cpp'}
        self.build(dictionary=d)
        self.setTearDownCleanup(dictionary=d)
        self.generic_type_tester(set(['int']))

    def test_long_type(self):
        """Test that long-type variables are displayed correctly."""
        d = {'CXX_SOURCES': 'long.cpp'}
        self.build(dictionary=d)
        self.setTearDownCleanup(dictionary=d)
        self.generic_type_tester(set(['long']))

    def test_long_long_type(self):
        """Test that 'long long'-type variables are displayed correctly."""
        d = {'CXX_SOURCES': 'long_long.cpp'}
        self.build(dictionary=d)
        self.setTearDownCleanup(dictionary=d)
        self.generic_type_tester(set(['long long']))