diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:50:09 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:50:09 +0000 |
| commit | f3fbd1c0586ff6ec7895991e6c28f61a503c36a8 (patch) | |
| tree | 48d008fd3df8c0e73271a4b18474e0aac6dbfe33 /packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc | |
| parent | 2fc5d2d1dfaf623ce4e24cd8590565902f8c557c (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc')
3 files changed, 29 insertions, 133 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py index e12ddca2eea7..d7d4118d1d6a 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py @@ -7,11 +7,12 @@ from __future__ import print_function +import datetime import os, time import lldb +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * -import datetime -import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test import lldbutil class ObjCDataFormatterTestCase(TestBase): @@ -66,11 +67,6 @@ class ObjCDataFormatterTestCase(TestBase): """Test formatters for NSException.""" self.appkit_tester_impl(self.nsexception_data_formatter_commands) - @skipUnlessDarwin - def test_nsmisc_with_run_command(self): - """Test formatters for misc NS classes.""" - self.appkit_tester_impl(self.nsmisc_data_formatter_commands) - @skipUnlessDarwin def test_nsdate_with_run_command(self): @@ -191,7 +187,7 @@ class ObjCDataFormatterTestCase(TestBase): 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', + self.expect('frame variable num1 num2 num3 num4 num5 num6 num7 num9', substrs = ['(NSNumber *) num1 = ',' (int)5', '(NSNumber *) num2 = ',' (float)3.1', '(NSNumber *) num3 = ',' (double)3.14', @@ -199,13 +195,8 @@ class ObjCDataFormatterTestCase(TestBase): '(NSNumber *) num5 = ',' (char)65', '(NSNumber *) num6 = ',' (long)255', '(NSNumber *) num7 = ','2000000', - '(NSNumber *) num8_Y = ',' @"1"', - '(NSNumber *) num8_N = ',' @"0"', '(NSNumber *) num9 = ',' (short)-31616']) - self.expect('frame variable decimal_one', - substrs = ['(NSDecimalNumber *) decimal_one = 0x','1']) - self.expect('frame variable num_at1 num_at2 num_at3 num_at4', substrs = ['(NSNumber *) num_at1 = ',' (int)12', '(NSNumber *) num_at2 = ',' (int)-12', @@ -213,26 +204,19 @@ class ObjCDataFormatterTestCase(TestBase): '(NSNumber *) num_at4 = ',' (double)-12.5']) def nscontainers_data_formatter_commands(self): - self.expect('frame variable newArray newDictionary newMutableDictionary cfdict_ref mutable_dict_ref cfarray_ref mutable_array_ref', + self.expect('frame variable newArray newDictionary newMutableDictionary cfarray_ref mutable_array_ref', substrs = ['(NSArray *) newArray = ','@"50 elements"', '(NSDictionary *) newDictionary = ',' 12 key/value pairs', '(NSDictionary *) newMutableDictionary = ',' 21 key/value pairs', - '(CFDictionaryRef) cfdict_ref = ','3 key/value pairs', - '(CFMutableDictionaryRef) mutable_dict_ref = ','12 key/value pairs', '(CFArrayRef) cfarray_ref = ','@"3 elements"', '(CFMutableArrayRef) mutable_array_ref = ','@"11 elements"']) - self.expect('frame variable nscounted_set', - substrs = ['(NSCountedSet *) nscounted_set = ','5 elements']) - 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"']) - + self.expect('frame variable binheap_ref', + substrs = ['(CFBinaryHeapRef) binheap_ref = ','@"21 items"']) + self.expect('expression -d run -- [NSArray new]', substrs=['@"0 elements"']) def nsdata_data_formatter_commands(self): @@ -258,6 +242,9 @@ class ObjCDataFormatterTestCase(TestBase): self.expect('frame variable nserror', substrs = ['domain: @"Foobar" - code: 12']) + self.expect('frame variable nserrorptr', + substrs = ['domain: @"Foobar" - code: 12']) + self.expect('frame variable nserror->_userInfo', substrs = ['2 key/value pairs']) @@ -272,24 +259,10 @@ class ObjCDataFormatterTestCase(TestBase): 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"']) - - def nsmisc_data_formatter_commands(self): - self.expect('frame variable localhost', - substrs = ['<NSHost ','> localhost ((','"127.0.0.1"']) - - if self.getArchitecture() in ['i386', 'x86_64']: - self.expect('frame variable my_task', - substrs = ['<NS','Task: 0x']) - - self.expect('frame variable range_value', - substrs = ['NSRange: {4, 4}']) - - self.expect('frame variable port', - substrs = ['(NSMachPort *) port = ',' mach port: ']) + 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"']) def nsdate_data_formatter_commands(self): self.expect('frame variable date1 date2', @@ -298,16 +271,18 @@ class ObjCDataFormatterTestCase(TestBase): # 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 :-) - now_year = str(datetime.datetime.now().year) + now_year = '%s-' % str(datetime.datetime.now().year) - self.expect('frame variable date3 date4', - substrs = [now_year,'1970']) + self.expect('frame variable date3', substrs = [now_year]) + self.expect('frame variable date4', substrs = ['1970']) + self.expect('frame variable date5', substrs = [now_year]) self.expect('frame variable date1_abs date2_abs', substrs = ['1985-04','2011-01']) - self.expect('frame variable date3_abs date4_abs', - substrs = [now_year,'1970']) + self.expect('frame variable date3_abs', substrs = [now_year]) + self.expect('frame variable date4_abs', substrs = ['1970']) + self.expect('frame variable date5_abs', substrs = [now_year]) self.expect('frame variable cupertino home europe', substrs = ['@"America/Los_Angeles"', @@ -385,7 +360,6 @@ class ObjCDataFormatterTestCase(TestBase): self.runCmd('type format clear', check=False) self.runCmd('type summary clear', check=False) self.runCmd('type synth clear', check=False) - self.runCmd('log timers disable', check=False) # Execute the cleanup function during test case tear down. @@ -406,7 +380,6 @@ class ObjCDataFormatterTestCase(TestBase): '(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)', '(Point) point = (v=7, h=12)', '(Point *) point_ptr = (v=7, h=12)', - 'name:@"TheGuyWhoHasNoName" reason:@"cuz it\'s funny"', '1985', 'foo_selector_impl']; diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m index 6eb7e021f70b..020e2fc6227a 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m @@ -415,41 +415,6 @@ int main (int argc, const char * argv[]) CFStringRef cfstring_ref = CFSTR("HELLO WORLD"); - - CFSetRef set_ref = CFSetCreate(NULL, data_set, 3, NULL); - - CFMutableSetRef mutable_set_ref = CFSetCreateMutable(NULL, 5, NULL); - - CFSetAddValue(mutable_set_ref, str1); - CFSetAddValue(mutable_set_ref, str2); - CFSetAddValue(mutable_set_ref, str3); - CFSetAddValue(mutable_set_ref, str4); - CFSetAddValue(mutable_set_ref, str5); - CFSetAddValue(mutable_set_ref, str6); - CFSetAddValue(mutable_set_ref, str7); - CFSetAddValue(mutable_set_ref, str8); - CFSetAddValue(mutable_set_ref, str9); - CFSetAddValue(mutable_set_ref, str10); - CFSetAddValue(mutable_set_ref, str11); - CFSetAddValue(mutable_set_ref, str12); - - - CFDictionaryRef cfdict_ref = CFDictionaryCreate(NULL, data_set, data_set, 3, NULL, NULL); - CFMutableDictionaryRef mutable_dict_ref = CFDictionaryCreateMutable(NULL, 16, NULL, NULL); - - CFDictionarySetValue(mutable_dict_ref, str1, str1); - CFDictionarySetValue(mutable_dict_ref, str2, str2); - CFDictionarySetValue(mutable_dict_ref, str3, str3); - CFDictionarySetValue(mutable_dict_ref, str4, str1); - CFDictionarySetValue(mutable_dict_ref, str5, str2); - CFDictionarySetValue(mutable_dict_ref, str6, str3); - CFDictionarySetValue(mutable_dict_ref, str7, str1); - CFDictionarySetValue(mutable_dict_ref, str8, str2); - CFDictionarySetValue(mutable_dict_ref, str9, str3); - CFDictionarySetValue(mutable_dict_ref, str10, str1); - CFDictionarySetValue(mutable_dict_ref, str11, str2); - CFDictionarySetValue(mutable_dict_ref, str12, str3); - CFArrayRef cfarray_ref = CFArrayCreate(NULL, data_set, 3, NULL); CFMutableArrayRef mutable_array_ref = CFArrayCreateMutable(NULL, 16, NULL); @@ -466,31 +431,6 @@ int main (int argc, const char * argv[]) CFArraySetValueAtIndex(mutable_array_ref, 9, str11); CFArraySetValueAtIndex(mutable_array_ref, 10, str12); - CFMutableBagRef mutable_bag_ref = CFBagCreateMutable(NULL, 15, NULL); - - CFBagSetValue(mutable_bag_ref, strB10); - CFBagSetValue(mutable_bag_ref, str1); - CFBagSetValue(mutable_bag_ref, str2); - CFBagSetValue(mutable_bag_ref, str3); - CFBagSetValue(mutable_bag_ref, str4); - CFBagSetValue(mutable_bag_ref, str5); - CFBagSetValue(mutable_bag_ref, str6); - CFBagSetValue(mutable_bag_ref, str7); - CFBagSetValue(mutable_bag_ref, str8); - CFBagSetValue(mutable_bag_ref, str9); - CFBagSetValue(mutable_bag_ref, str10); - CFBagSetValue(mutable_bag_ref, str11); - CFBagSetValue(mutable_bag_ref, str12); - CFBagSetValue(mutable_bag_ref, strA1); - CFBagSetValue(mutable_bag_ref, strA2); - CFBagSetValue(mutable_bag_ref, strA3); - - CFBagRef cfbag_ref = CFBagCreateCopy(NULL, mutable_bag_ref); - - CFBagSetValue(mutable_bag_ref, strB8); - CFBagSetValue(mutable_bag_ref, strC4); - - CFBinaryHeapRef binheap_ref = CFBinaryHeapCreate(NULL, 15, &kCFStringBinaryHeapCallBacks, NULL); CFBinaryHeapAddValue(binheap_ref, str1); CFBinaryHeapAddValue(binheap_ref, str2); @@ -520,6 +460,7 @@ int main (int argc, const char * argv[]) NSDictionary *error_userInfo = @{@"a": @1, @"b" : @2}; NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar" code:12 userInfo:error_userInfo]; + NSError **nserrorptr = &nserror; NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"]; NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Cocoa.framework"]]; @@ -540,8 +481,6 @@ int main (int argc, const char * argv[]) NSException* except2 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName`2" reason:@"cuz it's funny" userInfo:nil]; NSException* except3 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName/3" reason:@"cuz it's funny" userInfo:nil]; - NSMachPort *port = [NSMachPort port]; - NSURL *nsurl = [[NSURL alloc] initWithString:@"http://www.foo.bar"]; NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl]; NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2]; @@ -550,22 +489,14 @@ int main (int argc, const char * argv[]) NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"]; NSDate *date3 = [NSDate date]; NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24*60*60]; + NSDate *date5 = [NSDate dateWithTimeIntervalSinceReferenceDate: floor([[NSDate date] timeIntervalSinceReferenceDate])]; CFAbsoluteTime date1_abs = CFDateGetAbsoluteTime(date1); CFAbsoluteTime date2_abs = CFDateGetAbsoluteTime(date2); CFAbsoluteTime date3_abs = CFDateGetAbsoluteTime(date3); CFAbsoluteTime date4_abs = CFDateGetAbsoluteTime(date4); + CFAbsoluteTime date5_abs = CFDateGetAbsoluteTime(date5); - NSCountedSet *nscounted_set = [[NSCountedSet alloc] initWithCapacity:5]; - - [nscounted_set addObject:str0]; - [nscounted_set addObject:str1]; - [nscounted_set addObject:str0]; - [nscounted_set addObject:str0]; - [nscounted_set addObject:@"foo1"]; - [nscounted_set addObject:@"foo2"]; - [nscounted_set addObject:@"foo3"]; - NSIndexSet *iset1 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 4)]; NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)]; @@ -598,21 +529,12 @@ int main (int argc, const char * argv[]) NSTimeZone *home_ns = [NSTimeZone timeZoneWithName:@"Europe/Rome"]; NSTimeZone *europe_ns = [NSTimeZone timeZoneWithAbbreviation:@"CET"]; - NSHost *localhost = [NSHost hostWithAddress:@"127.0.0.1"]; - -#ifndef IOS - NSTask *my_task = [[NSTask alloc] init]; -#endif - - CFGregorianUnits cf_greg_units = {1,3,5,12,5,7}; CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(date1), NULL); CFRange cf_range = {4,4}; NSPoint ns_point = {4,4}; NSRange ns_range = {4,4}; - - NSValue *range_value = [NSValue valueWithRange:ns_range]; - + NSRect ns_rect = {{1,1},{5,5}}; NSRect* ns_rect_ptr = &ns_rect; NSRectArray ns_rect_arr = &ns_rect; diff --git a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py index e11c45e9038e..f5c792593772 100644 --- a/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py +++ b/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/nsstring/TestDataFormatterNSString.py @@ -8,10 +8,11 @@ from __future__ import print_function import os, time +import datetime import lldb +from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * -import datetime -import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test import lldbutil class NSStringDataFormatterTestCase(TestBase): |
