Fix test to compile and run on iOS.

llvm-svn: 196313
This commit is contained in:
Greg Clayton 2013-12-03 20:55:25 +00:00
parent 0a2baf8eaf
commit fd9acf6a48
2 changed files with 53 additions and 31 deletions

View File

@ -460,8 +460,9 @@ class ObjCDataFormatterTestCase(TestBase):
self.expect('frame variable localhost',
substrs = ['<NSHost ','> localhost ((','"127.0.0.1"'])
self.expect('frame variable my_task',
substrs = ['<NS','Task: 0x'])
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}'])
@ -571,30 +572,34 @@ class ObjCDataFormatterTestCase(TestBase):
# check formatters for common Objective-C types
self.runCmd("log timers enable")
expect_strings = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
'(CFRange) cf_range = location=4 length=4',
'(NSPoint) ns_point = (x=4, y=4)',
'(NSRange) ns_range = location=4, length=4',
'(NSRect *) ns_rect_ptr = (x=1, y=1), (width=5, height=5)',
'(NSRect) ns_rect = (x=1, y=1), (width=5, height=5)',
'(NSRectArray) ns_rect_arr = ((x=1, y=1), (width=5, height=5)), ...',
'(NSSize) ns_size = (width=5, height=7)',
'(NSSize *) ns_size_ptr = (width=5, height=7)',
'(CGSize) cg_size = (width=1, height=6)',
'(CGPoint) cg_point = (x=2, y=7)',
'(CGRect) cg_rect = origin=(x=1, y=2) size=(width=7, height=7)',
'(Rect) rect = (t=4, l=8, b=4, r=7)',
'(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'];
if self.getArchitecture() in ['i386', 'x86_64']:
expect_strings.append('(HIPoint) hi_point = (x=7, y=12)')
expect_strings.append('(HIRect) hi_rect = origin=(x=3, y=5) size=(width=4, height=6)')
expect_strings.append('(RGBColor) rgb_color = red=3 green=56 blue=35')
expect_strings.append('(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35')
self.expect("frame variable",
substrs = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
'(CFRange) cf_range = location=4 length=4',
'(NSPoint) ns_point = (x=4, y=4)',
'(NSRange) ns_range = location=4, length=4',
'(NSRect *) ns_rect_ptr = (x=1, y=1), (width=5, height=5)',
'(NSRect) ns_rect = (x=1, y=1), (width=5, height=5)',
'(NSRectArray) ns_rect_arr = ((x=1, y=1), (width=5, height=5)), ...',
'(NSSize) ns_size = (width=5, height=7)',
'(NSSize *) ns_size_ptr = (width=5, height=7)',
'(CGSize) cg_size = (width=1, height=6)',
'(CGPoint) cg_point = (x=2, y=7)',
'(CGRect) cg_rect = origin=(x=1, y=2) size=(width=7, height=7)',
'(RGBColor) rgb_color = red=3 green=56 blue=35',
'(RGBColor *) rgb_color_ptr = red=3 green=56 blue=35',
'(Rect) rect = (t=4, l=8, b=4, r=7)',
'(Rect *) rect_ptr = (t=4, l=8, b=4, r=7)',
'(Point) point = (v=7, h=12)',
'(Point *) point_ptr = (v=7, h=12)',
'(HIPoint) hi_point = (x=7, y=12)',
'(HIRect) hi_rect = origin=(x=3, y=5) size=(width=4, height=6)',
'name:@"TheGuyWhoHasNoName" reason:@"cuz it\'s funny"',
'1985',
'foo_selector_impl'])
substrs = expect_strings)
self.runCmd('log timers dump')

View File

@ -8,7 +8,18 @@
//===----------------------------------------------------------------------===//
#import <Foundation/Foundation.h>
#include <Carbon/Carbon.h>
#if defined(__APPLE__)
#if defined(__arm__)
#define IOS
#endif
#endif
#if defined(IOS)
#import <Foundation/NSGeometry.h>
#else
#import <Carbon/Carbon.h>
#endif
@interface MyClass : NSObject
{
@ -193,7 +204,7 @@ int main (int argc, const char * argv[])
NSString *str10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
NSString *str11 = [str10 className];
NSString *str11 = NSStringFromClass([str10 class]);
NSString *label1 = @"Process Name: ";
NSString *label2 = @"Process Id: ";
@ -223,7 +234,7 @@ int main (int argc, const char * argv[])
NSString *strA10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
NSString *strA11 = [str10 className];
NSString *strA11 = NSStringFromClass([str10 class]);
NSString *strA12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
@ -249,11 +260,11 @@ int main (int argc, const char * argv[])
NSString *strB10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
NSString *strB11 = [str10 className];
NSString *strB11 = NSStringFromClass([str10 class]);
NSString *strB12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
NSString *strC11 = [str10 className];
NSString *strC11 = NSStringFromClass([str10 class]);
NSString *strC12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
@ -279,7 +290,7 @@ int main (int argc, const char * argv[])
NSString *strC10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
NSString *strD11 = [str10 className];
NSString *strD11 = NSStringFromClass([str10 class]);
NSString *strD12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
@ -589,7 +600,9 @@ int main (int argc, const char * argv[])
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};
@ -610,8 +623,10 @@ int main (int argc, const char * argv[])
CGPoint cg_point = {2,7};
CGRect cg_rect = {{1,2}, {7,7}};
#ifndef IOS
RGBColor rgb_color = {3,56,35};
RGBColor* rgb_color_ptr = &rgb_color;
#endif
Rect rect = {4,8,4,7};
Rect* rect_ptr = &rect;
@ -619,8 +634,10 @@ int main (int argc, const char * argv[])
Point point = {7,12};
Point* point_ptr = &point;
#ifndef IOS
HIPoint hi_point = {7,12};
HIRect hi_rect = {{3,5},{4,6}};
#endif
SEL foo_selector = @selector(foo_selector_impl);