[Lldb-commits] [lldb] r151929 - in /lldb/trunk/test/lang/objc/rdar-10967107: ./ Makefile TestRdar10967107.py main.m

Enrico Granata egranata at apple.com
Fri Mar 2 10:47:26 PST 2012


Author: enrico
Date: Fri Mar  2 12:47:26 2012
New Revision: 151929

URL: http://llvm.org/viewvc/llvm-project?rev=151929&view=rev
Log:
Adding a test case for a bug where types CFGregorianDate and CFRange were improperly uniqued by LLDB such that both where shown as having the same structure contents - The bug itself is fixed in TOT but we want to catch regressions ASAP

Added:
    lldb/trunk/test/lang/objc/rdar-10967107/
    lldb/trunk/test/lang/objc/rdar-10967107/Makefile
    lldb/trunk/test/lang/objc/rdar-10967107/TestRdar10967107.py
    lldb/trunk/test/lang/objc/rdar-10967107/main.m

Added: lldb/trunk/test/lang/objc/rdar-10967107/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/rdar-10967107/Makefile?rev=151929&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/rdar-10967107/Makefile (added)
+++ lldb/trunk/test/lang/objc/rdar-10967107/Makefile Fri Mar  2 12:47:26 2012
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+OBJC_SOURCES := main.m
+
+include $(LEVEL)/Makefile.rules
+
+LDFLAGS += -framework Foundation

Added: lldb/trunk/test/lang/objc/rdar-10967107/TestRdar10967107.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/rdar-10967107/TestRdar10967107.py?rev=151929&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/rdar-10967107/TestRdar10967107.py (added)
+++ lldb/trunk/test/lang/objc/rdar-10967107/TestRdar10967107.py Fri Mar  2 12:47:26 2012
@@ -0,0 +1,59 @@
+"""
+Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly uniqued
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+
+ at unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+class Rdar10967107TestCase(TestBase):
+
+    mydir = os.path.join("lang", "objc", "rdar-10967107")
+
+    def test_cfrange_diff_cfgregoriandate_with_dsym(self):
+        """Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly uniqued."""
+        d = {'EXE': self.exe_name}
+        self.buildDsym(dictionary=d)
+        self.setTearDownCleanup(dictionary=d)
+        self.cfrange_diff_cfgregoriandate(self.exe_name)
+
+    def test_cfrange_diff_cfgregoriandate_with_dwarf(self):
+        """Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly uniqued."""
+        d = {'EXE': self.exe_name}
+        self.buildDwarf(dictionary=d)
+        self.setTearDownCleanup(dictionary=d)
+        self.cfrange_diff_cfgregoriandate(self.exe_name)
+
+    def setUp(self):
+        # Call super's setUp().
+        TestBase.setUp(self)
+        # We'll use the test method name as the exe_name.
+        self.exe_name = self.testMethodName
+        # Find the line number to break inside main().
+        self.main_source = "main.m"
+        self.line = line_number(self.main_source, '// Set breakpoint here.')
+
+    def cfrange_diff_cfgregoriandate(self, exe_name):
+        """Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly uniqued."""
+        exe = os.path.join(os.getcwd(), exe_name)
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
+                    BREAKPOINT_CREATED,
+            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+                        (self.main_source, self.line))
+
+        self.runCmd("run", RUN_SUCCEEDED)
+        # check that each type is correctly bound to its list of children
+        self.expect("frame variable cf_greg_date", substrs = ['year','month','day','hour','minute','second'])
+        self.expect("frame variable cf_range", substrs = ['location','length'])
+        # check that printing both does not somehow confuse LLDB
+        self.expect("frame variable", substrs = ['year','month','day','hour','minute','second','location','length'])
+
+if __name__ == '__main__':
+    import atexit
+    lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
+    unittest2.main()

Added: lldb/trunk/test/lang/objc/rdar-10967107/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/rdar-10967107/main.m?rev=151929&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/rdar-10967107/main.m (added)
+++ lldb/trunk/test/lang/objc/rdar-10967107/main.m Fri Mar  2 12:47:26 2012
@@ -0,0 +1,13 @@
+#import <Foundation/Foundation.h>
+
+int main (int argc, char const *argv[])
+{
+    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+
+	NSDate *date1 = [NSDate date];
+	CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime((CFDateRef)date1), NULL);
+	CFRange cf_range = {4,4};
+// Set breakpoint here.
+    [pool release];
+    return 0;
+}





More information about the lldb-commits mailing list