[Lldb-commits] [lldb] r180128 - Splitting the appkit data formatters test in smaller test cases - this should enable us to get a more detailed perspective on which individual data formatters are broken

Enrico Granata egranata at apple.com
Tue Apr 23 11:07:31 PDT 2013


Author: enrico
Date: Tue Apr 23 13:07:30 2013
New Revision: 180128

URL: http://llvm.org/viewvc/llvm-project?rev=180128&view=rev
Log:
Splitting the appkit data formatters test in smaller test cases - this should enable us to get a more detailed perspective on which individual data formatters are broken

Modified:
    lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=180128&r1=180127&r2=180128&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Tue Apr 23 13:07:30 2013
@@ -28,19 +28,140 @@ class ObjCDataFormatterTestCase(TestBase
         self.buildDwarf()
         self.plain_data_formatter_commands()
 
+    def appkit_tester_impl(self,builder,commands):
+        builder()
+        self.appkit_common_data_formatters_command()
+        commands()
+
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
-    def test_appkit_with_dsym_and_run_command(self):
-        """Test formatters for AppKit classes."""
-        self.buildDsym()
-        self.appkit_data_formatter_commands()
+    def test_nsnumber_with_dsym_and_run_command(self):
+        """Test formatters for NSNumber."""
+        self.appkit_tester_impl(self.buildDsym,self.nsnumber_data_formatter_commands)
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dwarf_test
-    def test_appkit_with_dwarf_and_run_command(self):
-        """Test formatters for AppKit classes."""
-        self.buildDwarf()
-        self.appkit_data_formatter_commands()
+    def test_nsnumber_with_dwarf_and_run_command(self):
+        """Test formatters for NSNumber."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsnumber_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsstring_with_dsym_and_run_command(self):
+        """Test formatters for NSString."""
+        self.appkit_tester_impl(self.buildDsym,self.nsstring_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsstring_with_dwarf_and_run_command(self):
+        """Test formatters for NSString."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsstring_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nscontainers_with_dsym_and_run_command(self):
+        """Test formatters for NS container classes."""
+        self.appkit_tester_impl(self.buildDsym,self.nscontainers_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nscontainers_with_dwarf_and_run_command(self):
+        """Test formatters for  NS container classes."""
+        self.appkit_tester_impl(self.buildDwarf,self.nscontainers_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsdata_with_dsym_and_run_command(self):
+        """Test formatters for NSData."""
+        self.appkit_tester_impl(self.buildDsym,self.nsdata_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsdata_with_dwarf_and_run_command(self):
+        """Test formatters for  NSData."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsdata_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsurl_with_dsym_and_run_command(self):
+        """Test formatters for NSURL."""
+        self.appkit_tester_impl(self.buildDsym,self.nsurl_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsurl_with_dwarf_and_run_command(self):
+        """Test formatters for NSURL."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsurl_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nserror_with_dsym_and_run_command(self):
+        """Test formatters for NSError."""
+        self.appkit_tester_impl(self.buildDsym,self.nserror_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nserror_with_dwarf_and_run_command(self):
+        """Test formatters for NSError."""
+        self.appkit_tester_impl(self.buildDwarf,self.nserror_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsbundle_with_dsym_and_run_command(self):
+        """Test formatters for NSBundle."""
+        self.appkit_tester_impl(self.buildDsym,self.nsbundle_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsbundle_with_dwarf_and_run_command(self):
+        """Test formatters for NSBundle."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsbundle_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsexception_with_dsym_and_run_command(self):
+        """Test formatters for NSException."""
+        self.appkit_tester_impl(self.buildDsym,self.nsexception_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsexception_with_dwarf_and_run_command(self):
+        """Test formatters for NSException."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsexception_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsmisc_with_dsym_and_run_command(self):
+        """Test formatters for misc NS classes."""
+        self.appkit_tester_impl(self.buildDsym,self.nsmisc_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsmisc_with_dwarf_and_run_command(self):
+        """Test formatters for misc NS classes."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsmisc_data_formatter_commands)
+
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dsym_test
+    def test_nsdate_with_dsym_and_run_command(self):
+        """Test formatters for NSDate."""
+        self.appkit_tester_impl(self.buildDsym,self.nsdate_data_formatter_commands)
+
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    @dwarf_test
+    def test_nsdate_with_dwarf_and_run_command(self):
+        """Test formatters for NSDate."""
+        self.appkit_tester_impl(self.buildDwarf,self.nsdate_data_formatter_commands)
+
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
@@ -189,7 +310,18 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect("frame variable *object",
                     substrs = ['a test']);
 
-    def appkit_data_formatter_commands(self):
+        self.expect('frame variable myclass',
+                    substrs = ['(Class) myclass = NSValue'])
+        self.expect('frame variable myclass2',
+                    substrs = ['(Class) myclass2 = __NSCFConstantString'])
+        self.expect('frame variable myclass3',
+                    substrs = ['(Class) myclass3 = Molecule'])
+        self.expect('frame variable myclass4',
+                    substrs = ['(Class) myclass4 = NSMutableArray'])
+        self.expect('frame variable myclass5',
+                    substrs = ['(Class) myclass5 = nil'])
+
+    def appkit_common_data_formatters_command(self):
         """Test formatters for AppKit classes."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
@@ -211,7 +343,8 @@ class ObjCDataFormatterTestCase(TestBase
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
-
+    
+    def nsnumber_data_formatter_commands(self):
         # Now enable AppKit and check we are displaying Cocoa classes correctly
         self.expect('frame variable num1 num2 num3 num4 num5 num6 num7 num8_Y num8_N num9',
                     substrs = ['(NSNumber *) num1 = ',' (int)5',
@@ -234,7 +367,7 @@ class ObjCDataFormatterTestCase(TestBase
                     '(NSNumber *) num_at3 = ',' (double)12.5',
                     '(NSNumber *) num_at4 = ',' (double)-12.5'])
 
-        
+    def nsstring_data_formatter_commands(self):
         self.expect('frame variable str0 str1 str2 str3 str4 str5 str6 str8 str9 str10 str11 label1 label2 processName str12',
                     substrs = ['(NSString *) str1 = ',' @"A rather short ASCII NSString object is here"',
                     '(NSString *) str0 = ',' @"255"',
@@ -251,7 +384,16 @@ class ObjCDataFormatterTestCase(TestBase
                     '(NSString *) label1 = ',' @"Process Name: "',
                     '(NSString *) label2 = ',' @"Process Id: "',
                     '(NSString *) str12 = ',' @"Process Name:  a.out Process Id:'])
+        self.expect('frame variable attrString mutableAttrString mutableGetConst',
+                    substrs = ['(NSAttributedString *) attrString = ',' @"hello world from foo"',
+                    '(NSAttributedString *) mutableAttrString = ',' @"hello world from foo"',
+                    '(NSString *) mutableGetConst = ',' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now  long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
 
+        self.expect('expr -d run-target -- path',substrs = ['usr/blah/stuff'])
+        self.expect('frame variable path',substrs = ['usr/blah/stuff'])
+
+
+    def nscontainers_data_formatter_commands(self):
         self.expect('frame variable newArray newDictionary newMutableDictionary cfdict_ref mutable_dict_ref cfarray_ref mutable_array_ref',
                     substrs = ['(NSArray *) newArray = ','@"50 objects"',
                     '(NSDictionary *) newDictionary = ',' 12 key/value pairs',
@@ -261,14 +403,18 @@ class ObjCDataFormatterTestCase(TestBase
                     '(CFArrayRef) cfarray_ref = ','@"3 objects"',
                     '(CFMutableArrayRef) mutable_array_ref = ','@"11 objects"'])
 
-        self.expect('frame variable attrString mutableAttrString mutableGetConst',
-                    substrs = ['(NSAttributedString *) attrString = ',' @"hello world from foo"',
-                    '(NSAttributedString *) mutableAttrString = ',' @"hello world from foo"',
-                    '(NSString *) mutableGetConst = ',' @"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now  long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear foo"'])
+        self.expect('frame variable nscounted_set',
+                    substrs = ['(NSCountedSet *) nscounted_set = ','5 objects'])
 
-        self.expect('expr -d run-target -- path',substrs = ['usr/blah/stuff'])
-        self.expect('frame variable path',substrs = ['usr/blah/stuff'])
+        self.expect('frame variable iset1 iset2 imset',
+                    substrs = ['4 indexes','512 indexes','10 indexes'])
+
+        self.expect('frame variable mutable_bag_ref cfbag_ref binheap_ref',
+                    substrs = ['(CFMutableBagRef) mutable_bag_ref = ','@"17 values"',
+                    '(CFBagRef) cfbag_ref = ','@"15 values"',
+                    '(CFBinaryHeapRef) binheap_ref = ','@"21 items"'])
 
+    def nsdata_data_formatter_commands(self):
         self.expect('frame variable immutableData mutableData data_ref mutable_data_ref mutable_string_ref',
                     substrs = ['(NSData *) immutableData = ',' 4 bytes',
                     '(NSData *) mutableData = ',' 14 bytes',
@@ -276,11 +422,7 @@ class ObjCDataFormatterTestCase(TestBase
                     '(CFMutableDataRef) mutable_data_ref = ','@"5 bytes"',
                     '(CFMutableStringRef) mutable_string_ref = ',' @"Wish ya knew"'])
 
-        self.expect('frame variable mutable_bag_ref cfbag_ref binheap_ref',
-                    substrs = ['(CFMutableBagRef) mutable_bag_ref = ','@"17 values"',
-                    '(CFBagRef) cfbag_ref = ','@"15 values"',
-                    '(CFBinaryHeapRef) binheap_ref = ','@"21 items"'])
-
+    def nsurl_data_formatter_commands(self):
         self.expect('frame variable cfurl_ref cfchildurl_ref cfgchildurl_ref',
                     substrs = ['(CFURLRef) cfurl_ref = ','@"http://www.foo.bar',
                     'cfchildurl_ref = ','@"page.html -- http://www.foo.bar',
@@ -291,6 +433,7 @@ class ObjCDataFormatterTestCase(TestBase
                     '(NSURL *) nsurl2 =','@"page.html -- http://www.foo.bar',
                     '(NSURL *) nsurl3 = ','@"?whatever -- http://www.foo.bar/page.html"'])
 
+    def nserror_data_formatter_commands(self):
         self.expect('frame variable nserror',
                     substrs = ['domain: @"Foobar" - code: 12'])
 
@@ -300,23 +443,20 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect('frame variable nserror->_userInfo --ptr-depth 1 -d run-target',
                     substrs = ['@"a"','@"b"',"1","2"])
 
+    def nsbundle_data_formatter_commands(self):
         self.expect('frame variable bundle_string bundle_url main_bundle',
                     substrs = ['(NSBundle *) bundle_string = ',' @"/System/Library/Frameworks/Accelerate.framework"',
                     '(NSBundle *) bundle_url = ',' @"/System/Library/Frameworks/Cocoa.framework"',
                     '(NSBundle *) main_bundle = ','test/functionalities/data-formatter/data-formatter-objc'])
 
+    def nsexception_data_formatter_commands(self):
         self.expect('frame variable except0 except1 except2 except3',
                     substrs = ['(NSException *) except0 = ','name:@"TheGuyWhoHasNoName" reason:@"cuz it\'s funny"',
                     '(NSException *) except1 = ','name:@"TheGuyWhoHasNoName~1" reason:@"cuz it\'s funny"',
                     '(NSException *) except2 = ','name:@"TheGuyWhoHasNoName`2" reason:@"cuz it\'s funny"',
                     '(NSException *) except3 = ','name:@"TheGuyWhoHasNoName/3" reason:@"cuz it\'s funny"'])
 
-        self.expect('frame variable port',
-                    substrs = ['(NSMachPort *) port = ',' mach port: '])
-
-        self.expect('frame variable date1 date2',
-                    substrs = ['1985-04','2011-01'])
-
+    def nsmisc_data_formatter_commands(self):
         self.expect('frame variable localhost',
                     substrs = ['<NSHost ','> localhost ((','"127.0.0.1"'])
 
@@ -326,6 +466,13 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect('frame variable range_value',
                     substrs = ['NSRange: {4, 4}'])
 
+        self.expect('frame variable port',
+                    substrs = ['(NSMachPort *) port = ',' mach port: '])
+
+    def nsdate_data_formatter_commands(self):
+        self.expect('frame variable date1 date2',
+                    substrs = ['1985-04','2011-01'])
+
         # this test might fail if we hit the breakpoint late on December 31st of some given year
         # and midnight comes between hitting the breakpoint and running this line of code
         # hopefully the output will be revealing enough in that case :-)
@@ -340,43 +487,18 @@ class ObjCDataFormatterTestCase(TestBase
         self.expect('frame variable date3_abs date4_abs',
                     substrs = [now_year,'1970'])
 
-        #self.runCmd('mem read `&date4_abs`')
-
-        #self.runCmd('mem read `nscounted_set`')
-
-        self.expect('frame variable nscounted_set',
-                    substrs = ['(NSCountedSet *) nscounted_set = ','5 objects'])
-
-        #self.runCmd('mem read `imset`')
-        #self.runCmd("p (int)[imset count]")
-
-        self.expect('frame variable iset1 iset2 imset',
-                    substrs = ['4 indexes','512 indexes','10 indexes'])
-
         self.expect('frame variable cupertino home europe',
                     substrs = ['@"America/Los_Angeles"',
                     '@"Europe/Rome"',
                     '@"Europe/Paris"'])
 
-        self.expect('frame variable mut_bv',
-                    substrs = ['(CFMutableBitVectorRef) mut_bv = ', '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])
-
         self.expect('frame variable cupertino_ns home_ns europe_ns',
                     substrs = ['@"America/Los_Angeles"',
                     '@"Europe/Rome"',
                     '@"Europe/Paris"'])
 
-        self.runCmd('type summary list')
-        self.expect('frame variable myclass',
-                    substrs = ['(Class) myclass = NSValue'])
-        self.expect('frame variable myclass2',
-                    substrs = ['(Class) myclass2 = __NSCFConstantString'])
-        self.expect('frame variable myclass3',
-                    substrs = ['(Class) myclass3 = Molecule'])
-        self.expect('frame variable myclass4',
-                    substrs = ['(Class) myclass4 = NSMutableArray'])
-        self.expect('frame variable myclass5',
-                    substrs = ['(Class) myclass5 = nil'])
+        self.expect('frame variable mut_bv',
+                    substrs = ['(CFMutableBitVectorRef) mut_bv = ', '1110 0110 1011 0000 1101 1010 1000 1111 0011 0101 1101 0001 00'])
 
 
     def expr_objc_data_formatter_commands(self):





More information about the lldb-commits mailing list