[Lldb-commits] [lldb] r149891 - in /lldb/trunk/test/lang/cpp/dynamic-value: TestCppValueCast.py sbvalue-cast.cpp

Johnny Chen johnny.chen at apple.com
Mon Feb 6 11:14:44 PST 2012


Author: johnny
Date: Mon Feb  6 13:14:44 2012
New Revision: 149891

URL: http://llvm.org/viewvc/llvm-project?rev=149891&view=rev
Log:
Add regular C++ inheritance in addition to the virtual inheritance to TestCppValueCast.py.
Plus mark the virtual inheritance test cases as expected failures.

Modified:
    lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py
    lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp

Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py?rev=149891&r1=149890&r2=149891&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py (original)
+++ lldb/trunk/test/lang/cpp/dynamic-value/TestCppValueCast.py Mon Feb  6 13:14:44 2012
@@ -12,17 +12,34 @@
 
     mydir = os.path.join("lang", "cpp", "dynamic-value")
 
+    # rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance)
+    @unittest2.expectedFailure
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @python_api_test
-    def test_value_cast_with_dsym(self):
-        """Test SBValue::Cast(SBType) API for C++ types."""
-        self.buildDsym(dictionary=self.d)
+    def test_value_cast_with_dsym_and_virtual_inheritance(self):
+        """Test SBValue::Cast(SBType) API for C++ types with virtual inheritance."""
+        self.buildDsym(dictionary=self.d_virtual)
         self.do_sbvalue_cast(self.exe_name)
 
+    # rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance)
+    @unittest2.expectedFailure
     @python_api_test
-    def test_get_dynamic_vals_with_dwarf(self):
-        """Test SBValue::Cast(SBType) API for C++ types."""
-        self.buildDwarf(dictionary=self.d)
+    def test_value_cast_with_dwarf_and_virtual_inheritance(self):
+        """Test SBValue::Cast(SBType) API for C++ types with virtual inheritance."""
+        self.buildDwarf(dictionary=self.d_virtual)
+        self.do_sbvalue_cast(self.exe_name)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @python_api_test
+    def test_value_cast_with_dsym_and_regular_inheritance(self):
+        """Test SBValue::Cast(SBType) API for C++ types with regular inheritance."""
+        self.buildDsym(dictionary=self.d_regular)
+        self.do_sbvalue_cast(self.exe_name)
+
+    @python_api_test
+    def test_value_cast_with_dwarf_and_regular_inheritance(self):
+        """Test SBValue::Cast(SBType) API for C++ types with regular inheritance."""
+        self.buildDwarf(dictionary=self.d_regular)
         self.do_sbvalue_cast(self.exe_name)
 
     def setUp(self):
@@ -33,7 +50,8 @@
         self.source = 'sbvalue-cast.cpp';
         self.line = line_number(self.source, '// Set breakpoint here.')
         self.exe_name = self.testMethodName
-        self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
+        self.d_virtual = {'CXX_SOURCES': self.source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DVIRTUAL=YES'}
+        self.d_regular = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
 
     def do_sbvalue_cast (self, exe_name):
         """Test SBValue::Cast(SBType) API for C++ types."""
@@ -83,13 +101,14 @@
         instanceA = tellerA.Cast(typeA.GetPointerType())
         self.DebugSBValue(instanceA)
 
-        # These outputs don't look correct?
+        # Iterate through all the children and print their values.
         if self.TraceOn():
             for child in instanceA:
                 print "child name:", child.GetName()
                 print child
         a_member_val = instanceA.GetChildMemberWithName('m_a_val')
         self.DebugSBValue(a_member_val)
+        self.assertTrue(a_member_val.GetValueAsUnsigned(error, 0) == 10)
 
         # Second stop is for DerivedB instance.
         threads = lldbutil.continue_to_breakpoint (process, breakpoint)
@@ -110,13 +129,14 @@
         instanceB = tellerB.Cast(typeB.GetPointerType())
         self.DebugSBValue(instanceB)
 
-        # These outputs don't look correct?
+        # Iterate through all the children and print their values.
         if self.TraceOn():
             for child in instanceB:
                 print "child name:", child.GetName()
                 print child
         b_member_val = instanceB.GetChildMemberWithName('m_b_val')
         self.DebugSBValue(b_member_val)
+        self.assertTrue(b_member_val.GetValueAsUnsigned(error, 0) == 36)
 
 
 if __name__ == '__main__':

Modified: lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp?rev=149891&r1=149890&r2=149891&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp (original)
+++ lldb/trunk/test/lang/cpp/dynamic-value/sbvalue-cast.cpp Mon Feb  6 13:14:44 2012
@@ -6,6 +6,12 @@
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
+#ifdef VIRTUAL
+#define VIRTUAL virtual
+#else
+#define VIRTUAL 
+#endif
+
 #include <stdio.h>
 
 class Base
@@ -24,7 +30,7 @@
     int m_base_val;
 };
 
-class DerivedA : public virtual Base
+class DerivedA : public VIRTUAL Base
 {
 public:
     DerivedA(int val) : Base(val*2), m_a_val(val) {
@@ -38,7 +44,7 @@
     int m_a_val;
 };
 
-class DerivedB : public virtual Base
+class DerivedB : public VIRTUAL Base
 {
 public:
     DerivedB(int val) : Base(val), m_b_val(val*3) {





More information about the lldb-commits mailing list