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).
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147828 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/types/TestIntegerTypesExpr.py b/test/types/TestIntegerTypesExpr.py
index c40f6b1..028d631 100644
--- a/test/types/TestIntegerTypesExpr.py
+++ b/test/types/TestIntegerTypesExpr.py
@@ -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']))
+
+ @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 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']))
-
- def unsigned_long_long_type_expr(self, exe_name):
- """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__':