FIRCLSdSYMTests.m 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2019 Google
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "Crashlytics/UnitTests/FIRCLSMachO/FIRCLSdSYMTests.h"
  15. #import "Crashlytics/Shared/FIRCLSMachO/FIRCLSdSYM.h"
  16. @implementation FIRCLSdSYMTests
  17. - (NSString*)resourcePath {
  18. #if SWIFT_PACKAGE
  19. NSBundle* bundle = SWIFTPM_MODULE_BUNDLE;
  20. return [bundle.resourcePath stringByAppendingPathComponent:@"machO_data"];
  21. #else
  22. NSBundle* bundle = [NSBundle bundleForClass:[self class]];
  23. return bundle.resourcePath;
  24. #endif
  25. }
  26. - (void)testBundleIdAndExecutablePath {
  27. FIRCLSdSYM* dSYM;
  28. NSString* path;
  29. path = [[self resourcePath] stringByAppendingPathComponent:@"i386-simulator.dSYM"];
  30. dSYM = [FIRCLSdSYM dSYMWithURL:[NSURL fileURLWithPath:path]];
  31. XCTAssertEqualObjects(@"com.crashlytics.ios.CrashTest", [dSYM bundleIdentifier], @"");
  32. XCTAssertTrue([[dSYM executablePath] hasSuffix:@"CrashTest"], @"");
  33. }
  34. - (void)testUUIDsInFatFile {
  35. FIRCLSdSYM* dSYM;
  36. NSString* path;
  37. NSMutableDictionary* uuids;
  38. path = [[self resourcePath] stringByAppendingPathComponent:@"armv7-armv7s.dSYM"];
  39. dSYM = [FIRCLSdSYM dSYMWithURL:[NSURL fileURLWithPath:path]];
  40. uuids = [NSMutableDictionary dictionary];
  41. [dSYM enumerateUUIDs:^(NSString* uuid, NSString* architecture) {
  42. [uuids setObject:uuid forKey:architecture];
  43. }];
  44. XCTAssertEqual((NSUInteger)2, [uuids count], @"");
  45. XCTAssertEqualObjects([uuids objectForKey:@"armv7"], @"794523cb14ef3e6bb32a4ea39a7ac677", @"");
  46. XCTAssertEqualObjects([uuids objectForKey:@"armv7s"], @"0d1450b08b5e35b8bf1e442b7be4666b", @"");
  47. }
  48. @end