Skip to content

Commit

Permalink
Merge branch 'next' into runtime-versions-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench authored Apr 29, 2019
2 parents 49e87c5 + b1530ad commit 615bdd2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
9 changes: 4 additions & 5 deletions Source/BugsnagKSCrashSysInfoParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@
BSGDictSetSafeObject(deviceState, report[@"system_name"], @"osName");
BSGDictSetSafeObject(deviceState, report[@"system_version"], @"osVersion");

NSString *osVersion = report[@"os_version"];

if (osVersion != nil) {
BSGDictSetSafeObject(deviceState, @{@"osBuild": osVersion}, @"runtimeVersions");
}
NSMutableDictionary *runtimeVersions = [NSMutableDictionary new];
BSGDictSetSafeObject(runtimeVersions, report[@"os_version"], @"osBuild");
BSGDictSetSafeObject(runtimeVersions, report[@"clang_version"], @"clangVersion");
BSGDictSetSafeObject(deviceState, runtimeVersions, @"runtimeVersions");

BSGDictSetSafeObject(deviceState, @(PLATFORM_WORD_SIZE), @"wordSize");
BSGDictSetSafeObject(deviceState, @"Apple", @"manufacturer");
Expand Down
1 change: 1 addition & 0 deletions Source/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#define BSG_KSSystemField_Size "size"
#define BSG_KSSystemField_SystemName "system_name"
#define BSG_KSSystemField_SystemVersion "system_version"
#define BSG_KSSystemField_ClangVersion "clang_version"
#define BSG_KSSystemField_TimeZone "time_zone"
#define BSG_KSSystemField_BuildType "build_type"

Expand Down
5 changes: 4 additions & 1 deletion Source/KSCrash/Source/KSCrash/Recording/BSG_KSSystemInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ + (NSDictionary *)systemInfo {
NSBundle *mainBundle = [NSBundle mainBundle];
NSDictionary *infoDict = [mainBundle infoDictionary];
const struct mach_header *header = _dyld_get_image_header(0);

#ifdef __clang_version__
[sysInfo bsg_ksc_safeSetObject:@__clang_version__
forKey:@BSG_KSSystemField_ClangVersion];
#endif
#if BSG_KSCRASH_HAS_UIDEVICE
[sysInfo bsg_ksc_safeSetObject:[UIDevice currentDevice].systemName
forKey:@BSG_KSSystemField_SystemName];
Expand Down
1 change: 1 addition & 0 deletions Tests/BugsnagSinkTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ - (void)testEventDevice {
XCTAssertEqualObjects(device[@"osName"], @"iPhone OS");
XCTAssertEqualObjects(device[@"osVersion"], @"8.1");
XCTAssertEqualObjects(device[@"runtimeVersions"][@"osBuild"], @"14B25");
XCTAssertEqualObjects(device[@"runtimeVersions"][@"clangVersion"], @"10.0.0 (clang-1000.11.45.5)");
XCTAssertEqualObjects(device[@"totalMemory"], @15065522176);
XCTAssertNotNil(device[@"freeDisk"]);
XCTAssertEqualObjects(device[@"timezone"], @"PST");
Expand Down
1 change: 1 addition & 0 deletions Tests/report.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"jailbroken": true,
"model": "MacBookPro11,3",
"os_version": "14B25",
"clang_version": "10.0.0 (clang-1000.11.45.5)",
"parent_process_name": "launchd_sim",
"CFBundleExecutablePath": "/Users/snmaynard/Library/Developer/CoreSimulator/Devices/709A3B98-034E-4ED5-A248-C5D22A73381E/data/Containers/Bundle/Application/496719A8-30A8-4625-979A-C9A7AB577E9B/CrashProbeiOS.app/CrashProbeiOS",
"time_zone": "PST",
Expand Down
2 changes: 2 additions & 0 deletions features/runtime_versions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ Scenario: Runtime versions included in Cocoa error
Then I should receive a request
And the request is valid for the error reporting API
And the payload field "events.0.device.runtimeVersions.osBuild" is not null
And the payload field "events.0.device.runtimeVersions.clangVersion" is not null

Scenario: Runtime versions included in Cocoa session
When I run "ManualSessionScenario"
And I wait for 10 seconds
Then I should receive a request
And the request is a valid for the session tracking API
And the payload field "device.runtimeVersions.osBuild" is not null
And the payload field "device.runtimeVersions.clangVersion" is not null

0 comments on commit 615bdd2

Please sign in to comment.