[Lldb-commits] [lldb] r114871 - in /lldb/trunk/test: make/Makefile.rules types/Makefile types/TestBasicTypes.py types/long_long.cpp types/unsigned_long.cpp types/unsigned_long_long.cpp
Johnny Chen
johnny.chen at apple.com
Mon Sep 27 13:44:47 PDT 2010
Author: johnny
Date: Mon Sep 27 15:44:46 2010
New Revision: 114871
URL: http://llvm.org/viewvc/llvm-project?rev=114871&view=rev
Log:
Added "long long" and "unsigned long long" to the TestBasicTypes.py.
Added a special "clean" target to the types/Makefile to clean up all the *.o/.d
files.
The generic_type_tester() method is modified to take a set of atoms, instead of
type string as a required parameter, for example:
o unsigned int => set(['unsigned', 'int'])
o unsigned long long => set(['unsigned', 'long long'])
o long long => set(['long long'])
Added:
lldb/trunk/test/types/long_long.cpp
lldb/trunk/test/types/unsigned_long_long.cpp
Modified:
lldb/trunk/test/make/Makefile.rules
lldb/trunk/test/types/Makefile
lldb/trunk/test/types/TestBasicTypes.py
lldb/trunk/test/types/unsigned_long.cpp
Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=114871&r1=114870&r2=114871&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Mon Sep 27 15:44:46 2010
@@ -152,7 +152,7 @@
.PHONY: clean
dsym: $(DSYM)
all: $(EXE) $(DSYM)
-clean:
+clean::
ifeq "$(DYLIB_NAME)" ""
rm -rf "$(EXE)" "$(DSYM)" $(OBJECTS) $(PREREQS)
else
Modified: lldb/trunk/test/types/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/Makefile?rev=114871&r1=114870&r2=114871&view=diff
==============================================================================
--- lldb/trunk/test/types/Makefile (original)
+++ lldb/trunk/test/types/Makefile Mon Sep 27 15:44:46 2010
@@ -3,3 +3,7 @@
CXX_SOURCES := int.cpp
include $(LEVEL)/Makefile.rules
+
+clean::
+ rm -rf *.o *.d
+
Modified: lldb/trunk/test/types/TestBasicTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/TestBasicTypes.py?rev=114871&r1=114870&r2=114871&view=diff
==============================================================================
--- lldb/trunk/test/types/TestBasicTypes.py (original)
+++ lldb/trunk/test/types/TestBasicTypes.py Mon Sep 27 15:44:46 2010
@@ -131,39 +131,75 @@
self.setTearDownCleanup(dictionary=d)
self.unsigned_long_type()
+ def test_long_long_type_with_dsym(self):
+ """Test that 'long long'-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'long_long.cpp'}
+ self.buildDsym(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.long_long_type()
+
+ def test_long_long_type_with_dwarf(self):
+ """Test that 'long long'-type variables are displayed correctly."""
+ d = {'CXX_SOURCES': 'long_long.cpp'}
+ self.buildDwarf(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.long_long_type()
+
+ 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'}
+ self.buildDsym(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.unsigned_long_long_type()
+
+ 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'}
+ self.buildDwarf(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.unsigned_long_long_type()
+
def char_type(self):
"""Test that char-type variables are displayed correctly."""
- self.generic_type_tester("char", quotedDisplay=True)
+ self.generic_type_tester(set(['char']), quotedDisplay=True)
def unsigned_char_type(self):
"""Test that 'unsigned char'-type variables are displayed correctly."""
- self.generic_type_tester("unsigned char", quotedDisplay=True)
+ self.generic_type_tester(set(['unsigned', 'char']), quotedDisplay=True)
def short_type(self):
"""Test that short-type variables are displayed correctly."""
- self.generic_type_tester("short")
+ self.generic_type_tester(set(['short']))
def unsigned_short_type(self):
"""Test that 'unsigned short'-type variables are displayed correctly."""
- self.generic_type_tester("unsigned short")
+ self.generic_type_tester(set(['unsigned', 'short']))
def int_type(self):
"""Test that int-type variables are displayed correctly."""
- self.generic_type_tester("int")
+ self.generic_type_tester(set(['int']))
def unsigned_int_type(self):
"""Test that 'unsigned int'-type variables are displayed correctly."""
- self.generic_type_tester("unsigned int")
+ self.generic_type_tester(set(['unsigned', 'int']))
def long_type(self):
"""Test that long-type variables are displayed correctly."""
- self.generic_type_tester("long")
+ self.generic_type_tester(set(['long']))
def unsigned_long_type(self):
"""Test that 'unsigned long'-type variables are displayed correctly."""
- self.generic_type_tester("unsigned long")
+ self.generic_type_tester(set(['unsigned', 'long']))
+
+ def long_long_type(self):
+ """Test that long long-type variables are displayed correctly."""
+ self.generic_type_tester(set(['long long']))
+
+ def unsigned_long_long_type(self):
+ """Test that 'unsigned long long'-type variables are displayed correctly."""
+ self.generic_type_tester(set(['unsigned', 'long long']))
- def generic_type_tester(self, type, quotedDisplay=False):
+ def generic_type_tester(self, atoms, quotedDisplay=False):
"""Test that variables with basic types are displayed correctly."""
# First, capture the golden output emitted by the oracle, i.e., the
@@ -217,16 +253,16 @@
self.runCmd("frame variable %s" % var)
output = self.res.GetOutput()
- # Extract the display type and canonicalize its atoms into a set.
- # Same for the input type string.
+ # The input type is in a canonical form as a set named atoms.
+ # The display type string must conatin each and every element.
dt = re.match("^\((.*)\)", output).group(1)
- ds = set(dt.split())
- ts = set(type.split())
- # The display type set must be a superset of the input type set.
- if not ds.issuperset(ts):
- self.fail("The display type: %s must match the input type: %s" %
- (dt, type))
+ # Expect the display type string to contain each and every atoms.
+ self.expect(dt,
+ "Display type: '%s' must contain the type atoms: '%s'" %
+ (dt, atoms),
+ exe=False,
+ substrs = list(atoms))
# The (var, val) pair must match, too.
nv = (" %s = '%s'" if quotedDisplay else " %s = %s") % (var, val)
Added: lldb/trunk/test/types/long_long.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/long_long.cpp?rev=114871&view=auto
==============================================================================
--- lldb/trunk/test/types/long_long.cpp (added)
+++ lldb/trunk/test/types/long_long.cpp Mon Sep 27 15:44:46 2010
@@ -0,0 +1,18 @@
+#define T long long
+#define T_CSTR "long long"
+
+#ifdef __LP64__
+#define T_VALUE_1 110011101111
+#define T_VALUE_2 220022202222
+#define T_VALUE_3 330033303333
+#define T_VALUE_4 440044404444
+#else
+#define T_VALUE_1 110011101
+#define T_VALUE_2 220022202
+#define T_VALUE_3 330033303
+#define T_VALUE_4 440044404
+#endif
+
+#define T_PRINTF_FORMAT "%lld"
+
+#include "basic_type.cpp"
Modified: lldb/trunk/test/types/unsigned_long.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/unsigned_long.cpp?rev=114871&r1=114870&r2=114871&view=diff
==============================================================================
--- lldb/trunk/test/types/unsigned_long.cpp (original)
+++ lldb/trunk/test/types/unsigned_long.cpp Mon Sep 27 15:44:46 2010
@@ -13,6 +13,6 @@
#define T_VALUE_4 440044404
#endif
-#define T_PRINTF_FORMAT "%ld"
+#define T_PRINTF_FORMAT "%lu"
#include "basic_type.cpp"
Added: lldb/trunk/test/types/unsigned_long_long.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/unsigned_long_long.cpp?rev=114871&view=auto
==============================================================================
--- lldb/trunk/test/types/unsigned_long_long.cpp (added)
+++ lldb/trunk/test/types/unsigned_long_long.cpp Mon Sep 27 15:44:46 2010
@@ -0,0 +1,18 @@
+#define T unsigned long long
+#define T_CSTR "unsigned long long"
+
+#ifdef __LP64__
+#define T_VALUE_1 110011101111
+#define T_VALUE_2 220022202222
+#define T_VALUE_3 330033303333
+#define T_VALUE_4 440044404444
+#else
+#define T_VALUE_1 110011101
+#define T_VALUE_2 220022202
+#define T_VALUE_3 330033303
+#define T_VALUE_4 440044404
+#endif
+
+#define T_PRINTF_FORMAT "%llu"
+
+#include "basic_type.cpp"
More information about the lldb-commits
mailing list