[Lldb-commits] [lldb] r147828 - in /lldb/trunk/test/types: AbstractBase.py TestFloatTypes.py TestFloatTypesExpr.py TestIntegerTypes.py TestIntegerTypesExpr.py basic_type.cpp
Johnny Chen
johnny.chen at apple.com
Mon Jan 9 18:04:05 PST 2012
Author: johnny
Date: Mon Jan 9 20:04:04 2012
New Revision: 147828
URL: http://llvm.org/viewvc/llvm-project?rev=147828&view=rev
Log:
Refactor the test/types directory to reduce some stupid reduant code.
Also add test cases to the test suite to exercise displaying of variables captured inside a block (Darwin-only).
Modified:
lldb/trunk/test/types/AbstractBase.py
lldb/trunk/test/types/TestFloatTypes.py
lldb/trunk/test/types/TestFloatTypesExpr.py
lldb/trunk/test/types/TestIntegerTypes.py
lldb/trunk/test/types/TestIntegerTypesExpr.py
lldb/trunk/test/types/basic_type.cpp
Modified: lldb/trunk/test/types/AbstractBase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/AbstractBase.py?rev=147828&r1=147827&r2=147828&view=diff
==============================================================================
--- lldb/trunk/test/types/AbstractBase.py (original)
+++ lldb/trunk/test/types/AbstractBase.py Mon Jan 9 20:04:04 2012
@@ -29,7 +29,31 @@
# used for all the test cases.
self.exe_name = self.testMethodName
- def generic_type_tester(self, exe_name, atoms, quotedDisplay=False):
+ # bc -> blockCaptured
+ # qd -> quotedDisplay
+
+ def build_and_run(self, source, atoms, dsym=True, bc=False, qd=False):
+ self.build_and_run_with_source_atoms_expr(source, atoms, expr=False, dsym=dsym, bc=bc, qd=qd)
+
+ def build_and_run_expr(self, source, atoms, dsym=True, bc=False, qd=False):
+ self.build_and_run_with_source_atoms_expr(source, atoms, expr=True, dsym=dsym, bc=bc, qd=qd)
+
+ def build_and_run_with_source_atoms_expr(self, source, atoms, expr, dsym=True, bc=False, qd=False):
+ if bc:
+ d = {'CXX_SOURCES': source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DTEST_BLOCK_CAPTURED_VARS'}
+ else:
+ d = {'CXX_SOURCES': source, 'EXE': self.exe_name}
+ if dsym:
+ self.buildDsym(dictionary=d)
+ else:
+ self.buildDwarf(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ if expr:
+ self.generic_type_expr_tester(self.exe_name, atoms, blockCaptured=bc, quotedDisplay=qd)
+ else:
+ self.generic_type_tester(self.exe_name, atoms, blockCaptured=bc, quotedDisplay=qd)
+
+ def generic_type_tester(self, exe_name, atoms, quotedDisplay=False, blockCaptured=False):
"""Test that variables with basic types are displayed correctly."""
# First, capture the golden output emitted by the oracle, i.e., the
@@ -44,6 +68,9 @@
# variable = 'value'
#
for line in go.split(os.linesep):
+ # We'll ignore variables of array types from inside a block.
+ if blockCaptured and '[' in line:
+ continue
match = self.pattern.search(line)
if match:
var, val = match.group(1), match.group(2)
@@ -53,15 +80,18 @@
# Bring the program to the point where we can issue a series of
# 'frame variable -T' command.
self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
- puts_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables")
- self.expect("breakpoint set -f basic_type.cpp -l %d" % puts_line,
+ if blockCaptured:
+ break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
+ else:
+ break_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
+ self.expect("breakpoint set -f basic_type.cpp -l %d" % break_line,
BREAKPOINT_CREATED,
startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 1" %
- puts_line)
+ break_line)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
- substrs = [" at basic_type.cpp:%d" % puts_line,
+ substrs = [" at basic_type.cpp:%d" % break_line,
"stop reason = breakpoint"])
#self.runCmd("frame variable -T")
@@ -96,7 +126,7 @@
self.expect(output, Msg(var, val, True), exe=False,
substrs = [nv])
- def generic_type_expr_tester(self, exe_name, atoms, quotedDisplay=False):
+ def generic_type_expr_tester(self, exe_name, atoms, quotedDisplay=False, blockCaptured=False):
"""Test that variable expressions with basic types are evaluated correctly."""
# First, capture the golden output emitted by the oracle, i.e., the
@@ -111,6 +141,9 @@
# variable = 'value'
#
for line in go.split(os.linesep):
+ # We'll ignore variables of array types from inside a block.
+ if blockCaptured and '[' in line:
+ continue
match = self.pattern.search(line)
if match:
var, val = match.group(1), match.group(2)
@@ -120,14 +153,17 @@
# Bring the program to the point where we can issue a series of
# 'expr' command.
self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
- puts_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
- self.expect("breakpoint set -f basic_type.cpp -l %d" % puts_line,
+ if blockCaptured:
+ break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
+ else:
+ break_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
+ self.expect("breakpoint set -f basic_type.cpp -l %d" % break_line,
BREAKPOINT_CREATED,
startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 1" %
- puts_line)
+ break_line)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
- substrs = [" at basic_type.cpp:%d" % puts_line,
+ substrs = [" at basic_type.cpp:%d" % break_line,
"stop reason = breakpoint"])
#self.runCmd("frame variable -T")
Modified: lldb/trunk/test/types/TestFloatTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestFloatTypes.py?rev=147828&r1=147827&r2=147828&view=diff
==============================================================================
--- lldb/trunk/test/types/TestFloatTypes.py (original)
+++ lldb/trunk/test/types/TestFloatTypes.py Mon Jan 9 20:04:04 2012
@@ -14,40 +14,30 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_float_type_with_dsym(self):
"""Test that float-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'float.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.float_type(self.exe_name)
+ self.build_and_run('float.cpp', set(['float']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_float_type_from_block_with_dsym(self):
+ """Test that float-type variables are displayed correctly from a block."""
+ self.build_and_run('float.cpp', set(['float']), bc=True)
def test_float_type_with_dwarf(self):
"""Test that float-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'float.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.float_type(self.exe_name)
+ self.build_and_run('float.cpp', set(['float']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_double_type_with_dsym(self):
"""Test that double-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'double.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.double_type(self.exe_name)
-
- def test_double_type_with_dwarf(self):
- """Test that double-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'double.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.double_type(self.exe_name)
+ self.build_and_run('double.cpp', set(['double']))
- def float_type(self, exe_name):
- """Test that float-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['float']))
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_double_type_from_block_with_dsym(self):
+ """Test that double-type variables are displayed correctly from a block."""
+ self.build_and_run('double.cpp', set(['double']), bc=True)
- def double_type(self, exe_name):
+ def test_double_type_with_dwarf(self):
"""Test that double-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['double']))
+ self.build_and_run('double.cpp', set(['double']), dsym=False)
if __name__ == '__main__':
Modified: lldb/trunk/test/types/TestFloatTypesExpr.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestFloatTypesExpr.py?rev=147828&r1=147827&r2=147828&view=diff
==============================================================================
--- lldb/trunk/test/types/TestFloatTypesExpr.py (original)
+++ lldb/trunk/test/types/TestFloatTypesExpr.py Mon Jan 9 20:04:04 2012
@@ -17,40 +17,30 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_float_type_with_dsym(self):
"""Test that float-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'float.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.float_type_expr(self.exe_name)
+ self.build_and_run_expr('float.cpp', set(['float']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_float_type_from_block_with_dsym(self):
+ """Test that float-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('float.cpp', set(['float']), bc=True)
def test_float_type_with_dwarf(self):
"""Test that float-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'float.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.float_type_expr(self.exe_name)
+ self.build_and_run_expr('float.cpp', set(['float']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_double_type_with_dsym(self):
"""Test that double-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'double.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.double_type_expr(self.exe_name)
-
- def test_double_type_with_dwarf(self):
- """Test that double-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'double.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.double_type_expr(self.exe_name)
+ self.build_and_run_expr('double.cpp', set(['double']))
- def float_type_expr(self, exe_name):
- """Test that float-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['float']))
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_double_type_from_block_with_dsym(self):
+ """Test that double-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('double.cpp', set(['double']), bc=True)
- def double_type_expr(self, exe_name):
+ def test_double_type_with_dwarf(self):
"""Test that double-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['double']))
+ self.build_and_run_expr('double.cpp', set(['double']), dsym=False)
if __name__ == '__main__':
Modified: lldb/trunk/test/types/TestIntegerTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestIntegerTypes.py?rev=147828&r1=147827&r2=147828&view=diff
==============================================================================
--- lldb/trunk/test/types/TestIntegerTypes.py (original)
+++ lldb/trunk/test/types/TestIntegerTypes.py Mon Jan 9 20:04:04 2012
@@ -14,122 +14,114 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_char_type_with_dsym(self):
"""Test that char-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'char.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.char_type(self.exe_name)
+ self.build_and_run('char.cpp', set(['char']), qd=True)
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_char_type_from_block_with_dsym(self):
+ """Test that char-type variables are displayed correctly from a block."""
+ self.build_and_run('char.cpp', set(['char']), bc=True, qd=True)
def test_char_type_with_dwarf(self):
"""Test that char-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'char.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.char_type(self.exe_name)
+ self.build_and_run('char.cpp', set(['char']), dsym=False, qd=True)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_char_type_with_dsym(self):
"""Test that 'unsigned_char'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_char.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_char_type(self.exe_name)
+ self.build_and_run('unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_char_type_from_block_with_dsym(self):
+ """Test that 'unsigned char'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)
def test_unsigned_char_type_with_dwarf(self):
"""Test that 'unsigned char'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_char.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_char_type(self.exe_name)
+ self.build_and_run('unsigned_char.cpp', set(['unsigned', 'char']), dsym=False, qd=True)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_short_type_with_dsym(self):
"""Test that short-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'short.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.short_type(self.exe_name)
+ self.build_and_run('short.cpp', set(['short']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_short_type_from_block_with_dsym(self):
+ """Test that short-type variables are displayed correctly from a block."""
+ self.build_and_run('short.cpp', set(['short']), bc=True)
def test_short_type_with_dwarf(self):
"""Test that short-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'short.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.short_type(self.exe_name)
+ self.build_and_run('short.cpp', set(['short']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_short_type_with_dsym(self):
"""Test that 'unsigned_short'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_short.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_short_type(self.exe_name)
+ self.build_and_run('unsigned_short.cpp', set(['unsigned', 'short']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_short_type_from_block_with_dsym(self):
+ """Test that 'unsigned short'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_short.cpp', set(['unsigned', 'short']), bc=True)
def test_unsigned_short_type_with_dwarf(self):
"""Test that 'unsigned short'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_short.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_short_type(self.exe_name)
+ self.build_and_run('unsigned_short.cpp', set(['unsigned', 'short']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_int_type_with_dsym(self):
"""Test that int-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'int.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.int_type(self.exe_name)
+ self.build_and_run('int.cpp', set(['int']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_int_type_from_block_with_dsym(self):
+ """Test that int-type variables are displayed correctly from a block."""
+ self.build_and_run('int.cpp', set(['int']), dsym=False)
def test_int_type_with_dwarf(self):
"""Test that int-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'int.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.int_type(self.exe_name)
+ self.build_and_run('int.cpp', set(['int']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_int_type_with_dsym(self):
"""Test that 'unsigned_int'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_int.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_int_type(self.exe_name)
+ self.build_and_run('unsigned_int.cpp', set(['unsigned', 'int']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_int_type_from_block_with_dsym(self):
+ """Test that 'unsigned int'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_int.cpp', set(['unsigned', 'int']), bc=True)
def test_unsigned_int_type_with_dwarf(self):
"""Test that 'unsigned int'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_int.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_int_type(self.exe_name)
+ self.build_and_run('unsigned_int.cpp', set(['unsigned', 'int']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_long_type_with_dsym(self):
"""Test that long-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'long.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.long_type(self.exe_name)
+ self.build_and_run('long.cpp', set(['long']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_long_type_from_block_with_dsym(self):
+ """Test that long-type variables are displayed correctly from a block."""
+ self.build_and_run('long.cpp', set(['long']), bc=True)
def test_long_type_with_dwarf(self):
"""Test that long-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'long.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.long_type(self.exe_name)
+ self.build_and_run('long.cpp', set(['long']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_long_type_with_dsym(self):
"""Test that 'unsigned long'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_long.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_long_type(self.exe_name)
+ self.build_and_run('unsigned_long.cpp', set(['unsigned', 'long']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_long_type_from_block_with_dsym(self):
+ """Test that 'unsigned_long'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_long.cpp', set(['unsigned', 'long']), bc=True)
def test_unsigned_long_type_with_dwarf(self):
"""Test that 'unsigned long'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_long.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_long_type(self.exe_name)
+ self.build_and_run('unsigned_long.cpp', set(['unsigned', 'long']), dsym=False)
# rdar://problem/8482903
# test suite failure for types dir -- "long long" and "unsigned long long"
@@ -137,72 +129,30 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_long_long_type_with_dsym(self):
"""Test that 'long long'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'long_long.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.long_long_type(self.exe_name)
+ self.build_and_run('long_long.cpp', set(['long long']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_long_long_type_from_block_with_dsym(self):
+ """Test that 'long_long'-type variables are displayed correctly from a block."""
+ self.build_and_run('long_long.cpp', set(['long long']), bc=True)
def test_long_long_type_with_dwarf(self):
"""Test that 'long long'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'long_long.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.long_long_type(self.exe_name)
+ self.build_and_run('long_long.cpp', set(['long long']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_long_long_type_with_dsym(self):
"""Test that 'unsigned long long'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_long_long.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_long_long_type(self.exe_name)
+ self.build_and_run('unsigned_long_long.cpp', set(['unsigned', 'long long']))
- def test_unsigned_long_long_type_with_dwarf(self):
- """Test that 'unsigned long long'-type variables are displayed correctly."""
- d = {'CXX_SOURCES': 'unsigned_long_long.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_long_long_type(self.exe_name)
-
- def char_type(self, exe_name):
- """Test that char-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['char']), quotedDisplay=True)
-
- def unsigned_char_type(self, exe_name):
- """Test that 'unsigned char'-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['unsigned', 'char']), quotedDisplay=True)
-
- def short_type(self, exe_name):
- """Test that short-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['short']))
-
- def unsigned_short_type(self, exe_name):
- """Test that 'unsigned short'-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['unsigned', 'short']))
-
- def int_type(self, exe_name):
- """Test that int-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['int']))
-
- def unsigned_int_type(self, exe_name):
- """Test that 'unsigned int'-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['unsigned', 'int']))
-
- def long_type(self, exe_name):
- """Test that long-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['long']))
-
- def unsigned_long_type(self, exe_name):
- """Test that 'unsigned long'-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['unsigned', 'long']))
-
- def long_long_type(self, exe_name):
- """Test that long long-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['long long']))
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_long_long_type_from_block_with_dsym(self):
+ """Test that 'unsigned_long_long'-type variables are displayed correctly from a block."""
+ self.build_and_run('unsigned_long_long.cpp', set(['unsigned', 'long long']), bc=True)
- def unsigned_long_long_type(self, exe_name):
+ def test_unsigned_long_long_type_with_dwarf(self):
"""Test that 'unsigned long long'-type variables are displayed correctly."""
- self.generic_type_tester(exe_name, set(['unsigned', 'long long']))
+ self.build_and_run('unsigned_long_long.cpp', set(['unsigned', 'long long']), dsym=False)
if __name__ == '__main__':
Modified: lldb/trunk/test/types/TestIntegerTypesExpr.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestIntegerTypesExpr.py?rev=147828&r1=147827&r2=147828&view=diff
==============================================================================
--- lldb/trunk/test/types/TestIntegerTypesExpr.py (original)
+++ lldb/trunk/test/types/TestIntegerTypesExpr.py Mon Jan 9 20:04:04 2012
@@ -14,122 +14,114 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_char_type_with_dsym(self):
"""Test that char-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'char.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.char_type_expr(self.exe_name)
+ self.build_and_run_expr('char.cpp', set(['char']), qd=True)
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_char_type_from_block_with_dsym(self):
+ """Test that char-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('char.cpp', set(['char']), bc=True, qd=True)
def test_char_type_with_dwarf(self):
"""Test that char-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'char.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.char_type_expr(self.exe_name)
+ self.build_and_run_expr('char.cpp', set(['char']), dsym=False, qd=True)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_char_type_with_dsym(self):
"""Test that 'unsigned_char'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_char.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_char_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), qd=True)
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_char_type_from_block_with_dsym(self):
+ """Test that 'unsigned char'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), bc=True, qd=True)
def test_unsigned_char_type_with_dwarf(self):
"""Test that 'unsigned char'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_char.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_char_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_char.cpp', set(['unsigned', 'char']), dsym=False, qd=True)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_short_type_with_dsym(self):
"""Test that short-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'short.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.short_type_expr(self.exe_name)
+ self.build_and_run_expr('short.cpp', set(['short']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_short_type_from_block_with_dsym(self):
+ """Test that short-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('short.cpp', set(['short']), bc=True)
def test_short_type_with_dwarf(self):
"""Test that short-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'short.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.short_type_expr(self.exe_name)
+ self.build_and_run_expr('short.cpp', set(['short']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_short_type_with_dsym(self):
"""Test that 'unsigned_short'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_short.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_short_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_short_type_from_block_with_dsym(self):
+ """Test that 'unsigned short'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']), bc=True)
def test_unsigned_short_type_with_dwarf(self):
"""Test that 'unsigned short'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_short.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_short_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_short.cpp', set(['unsigned', 'short']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_int_type_with_dsym(self):
"""Test that int-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'int.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.int_type_expr(self.exe_name)
+ self.build_and_run_expr('int.cpp', set(['int']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_int_type_from_block_with_dsym(self):
+ """Test that int-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('int.cpp', set(['int']), dsym=False)
def test_int_type_with_dwarf(self):
"""Test that int-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'int.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.int_type_expr(self.exe_name)
+ self.build_and_run_expr('int.cpp', set(['int']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_int_type_with_dsym(self):
"""Test that 'unsigned_int'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_int.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_int_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_int_type_from_block_with_dsym(self):
+ """Test that 'unsigned int'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']), bc=True)
def test_unsigned_int_type_with_dwarf(self):
"""Test that 'unsigned int'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_int.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_int_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_int.cpp', set(['unsigned', 'int']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_long_type_with_dsym(self):
"""Test that long-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'long.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.long_type_expr(self.exe_name)
+ self.build_and_run_expr('long.cpp', set(['long']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_long_type_from_block_with_dsym(self):
+ """Test that long-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('long.cpp', set(['long']), bc=True)
def test_long_type_with_dwarf(self):
"""Test that long-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'long.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.long_type_expr(self.exe_name)
+ self.build_and_run_expr('long.cpp', set(['long']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_long_type_with_dsym(self):
"""Test that 'unsigned long'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_long.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_long_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_long_type_from_block_with_dsym(self):
+ """Test that 'unsigned_long'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']), bc=True)
def test_unsigned_long_type_with_dwarf(self):
"""Test that 'unsigned long'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_long.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_long_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_long.cpp', set(['unsigned', 'long']), dsym=False)
# rdar://problem/8482903
# test suite failure for types dir -- "long long" and "unsigned long long"
@@ -137,72 +129,30 @@
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_long_long_type_with_dsym(self):
"""Test that 'long long'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'long_long.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.long_long_type_expr(self.exe_name)
+ self.build_and_run_expr('long_long.cpp', set(['long long']))
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_long_long_type_from_block_with_dsym(self):
+ """Test that 'long_long'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('long_long.cpp', set(['long long']), bc=True)
def test_long_long_type_with_dwarf(self):
"""Test that 'long long'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'long_long.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.long_long_type_expr(self.exe_name)
+ self.build_and_run_expr('long_long.cpp', set(['long long']), dsym=False)
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
def test_unsigned_long_long_type_with_dsym(self):
"""Test that 'unsigned long long'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_long_long.cpp', 'EXE': self.exe_name}
- self.buildDsym(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_long_long_type_expr(self.exe_name)
+ self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']))
- def test_unsigned_long_long_type_with_dwarf(self):
- """Test that 'unsigned long long'-type variable expressions are evaluated correctly."""
- d = {'CXX_SOURCES': 'unsigned_long_long.cpp', 'EXE': self.exe_name}
- self.buildDwarf(dictionary=d)
- self.setTearDownCleanup(dictionary=d)
- self.unsigned_long_long_type_expr(self.exe_name)
-
- def char_type_expr(self, exe_name):
- """Test that char-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['char']), quotedDisplay=True)
-
- def unsigned_char_type_expr(self, exe_name):
- """Test that 'unsigned char'-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['unsigned', 'char']), quotedDisplay=True)
-
- def short_type_expr(self, exe_name):
- """Test that short-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['short']))
-
- def unsigned_short_type_expr(self, exe_name):
- """Test that 'unsigned short'-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['unsigned', 'short']))
-
- def int_type_expr(self, exe_name):
- """Test that int-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['int']))
-
- def unsigned_int_type_expr(self, exe_name):
- """Test that 'unsigned int'-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['unsigned', 'int']))
-
- def long_type_expr(self, exe_name):
- """Test that long-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['long']))
-
- def unsigned_long_type_expr(self, exe_name):
- """Test that 'unsigned long'-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['unsigned', 'long']))
-
- def long_long_type_expr(self, exe_name):
- """Test that long long-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['long long']))
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_unsigned_long_long_type_from_block_with_dsym(self):
+ """Test that 'unsigned_long_long'-type variables are displayed correctly from a block."""
+ self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']), bc=True)
- def unsigned_long_long_type_expr(self, exe_name):
+ def test_unsigned_long_long_type_with_dwarf(self):
"""Test that 'unsigned long long'-type variable expressions are evaluated correctly."""
- self.generic_type_expr_tester(exe_name, set(['unsigned', 'long long']))
+ self.build_and_run_expr('unsigned_long_long.cpp', set(['unsigned', 'long long']), dsym=False)
if __name__ == '__main__':
Modified: lldb/trunk/test/types/basic_type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/basic_type.cpp?rev=147828&r1=147827&r2=147828&view=diff
==============================================================================
--- lldb/trunk/test/types/basic_type.cpp (original)
+++ lldb/trunk/test/types/basic_type.cpp Mon Jan 9 20:04:04 2012
@@ -20,6 +20,10 @@
#endif
+#ifdef TEST_BLOCK_CAPTURED_VARS
+#include <dispatch/dispatch.h>
+#endif
+
class a_class
{
public:
@@ -34,7 +38,7 @@
}
const T&
- get_a()
+ get_a() const
{
return m_a;
}
@@ -46,7 +50,7 @@
}
const T&
- get_b()
+ get_b() const
{
return m_b;
}
@@ -169,5 +173,41 @@
#endif
puts("About to exit, break here to check values..."); // Here is the line we will break on to check variables.
+
+#ifdef TEST_BLOCK_CAPTURED_VARS
+#include <dispatch/dispatch.h>
+
+ void (^myBlock)() = ^() {
+ printf ("%s: a = '" T_PRINTF_FORMAT "'\n", T_CSTR, a);
+ printf ("%s*: %p => *a_ptr = '" T_PRINTF_FORMAT "'\n", T_CSTR, a_ptr, *a_ptr);
+ printf ("%s&: @%p => a_ref = '" T_PRINTF_FORMAT "'\n", T_CSTR, &a_ref, a_ref);
+
+ printf ("(a_class) a_class_instance.m_a = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_a());
+ printf ("(a_class) a_class_instance.m_b = '" T_PRINTF_FORMAT "'\n", a_class_instance.get_b());
+ printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_a = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_a());
+ printf ("(a_class*) a_class_ptr = %p, a_class_ptr->m_b = '" T_PRINTF_FORMAT "'\n", a_class_ptr, a_class_ptr->get_b());
+ printf ("(a_class&) a_class_ref = %p, a_class_ref.m_a = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_a());
+ printf ("(a_class&) a_class_ref = %p, a_class_ref.m_b = '" T_PRINTF_FORMAT "'\n", &a_class_ref, a_class_ref.get_b());
+
+ printf ("(a_struct_t) a_struct.a = '" T_PRINTF_FORMAT "'\n", a_struct.a);
+ printf ("(a_struct_t) a_struct.b = '" T_PRINTF_FORMAT "'\n", a_struct.b);
+ printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->a = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->a);
+ printf ("(a_struct_t*) a_struct_ptr = %p, a_struct_ptr->b = '" T_PRINTF_FORMAT "'\n", a_struct_ptr, a_struct_ptr->b);
+ printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.a = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.a);
+ printf ("(a_struct_t&) a_struct_ref = %p, a_struct_ref.b = '" T_PRINTF_FORMAT "'\n", &a_struct_ref, a_struct_ref.b);
+
+ printf ("(a_union_zero_t) a_union_zero.a = '" T_PRINTF_FORMAT "'\n", a_union_zero.a);
+ printf ("(a_union_zero_t*) a_union_zero_ptr = %p, a_union_zero_ptr->a = '" T_PRINTF_FORMAT "'\n", a_union_zero_ptr, a_union_zero_ptr->a);
+ printf ("(a_union_zero_t&) a_union_zero_ref = %p, a_union_zero_ref.a = '" T_PRINTF_FORMAT "'\n", &a_union_zero_ref, a_union_zero_ref.a);
+
+ printf ("(a_union_nonzero_t) a_union_nonzero.u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero.u.a);
+ printf ("(a_union_nonzero_t*) a_union_nonzero_ptr = %p, a_union_nonzero_ptr->u.a = '" T_PRINTF_FORMAT "'\n", a_union_nonzero_ptr, a_union_nonzero_ptr->u.a);
+ printf ("(a_union_nonzero_t&) a_union_nonzero_ref = %p, a_union_nonzero_ref.u.a = '" T_PRINTF_FORMAT "'\n", &a_union_nonzero_ref, a_union_nonzero_ref.u.a);
+
+ printf ("That's All Folks!\n"); // Break here to test block captured variables.
+ };
+
+ myBlock();
+#endif
return 0;
}
More information about the lldb-commits
mailing list