Skip to content

Commit c0c4188

Browse files
committed
Merge pull request #555 from libgit2/piet/update-nimble-quick
Fix super slow iOS Tests
2 parents ca46c73 + a387dbd commit c0c4188

File tree

10 files changed

+75
-56
lines changed

10 files changed

+75
-56
lines changed

Cartfile.private

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
github "jspahrsummers/xcconfigs" >= 0.7.1
2-
github "Quick/Quick" ~> 0.6
3-
github "Quick/Nimble" ~> 2.0
4-
github "ZipArchive/ZipArchive" ~> 0.3
2+
github "Quick/Quick" ~> 0.9.1
3+
github "Quick/Nimble" ~> 3.1
4+
github "ZipArchive/ZipArchive" == 1.0.1

Cartfile.resolved

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
github "Quick/Nimble" "v2.0.0"
2-
github "Quick/Quick" "v0.6.0"
3-
github "ZipArchive/ZipArchive" "v0.3.3"
4-
github "jspahrsummers/xcconfigs" "0.8.1"
1+
github "Quick/Nimble" "v3.1.0"
2+
github "Quick/Quick" "v0.9.1"
3+
github "ZipArchive/ZipArchive" "v1.0.1"
4+
github "jspahrsummers/xcconfigs" "0.9"

Carthage/Checkouts/Quick

Submodule Quick updated 109 files

Carthage/Checkouts/ZipArchive

Submodule ZipArchive updated 72 files

Carthage/Checkouts/xcconfigs

ObjectiveGitFramework.xcodeproj/project.pbxproj

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@
6060
2089E43C17D9A58000F451DA /* GTTagSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 2089E43B17D9A58000F451DA /* GTTagSpec.m */; };
6161
20F43DE318A2F668007D3621 /* GTRepository+Blame.h in Headers */ = {isa = PBXBuildFile; fileRef = 20F43DE118A2F667007D3621 /* GTRepository+Blame.h */; settings = {ATTRIBUTES = (Public, ); }; };
6262
20F43DE618A2F668007D3621 /* GTRepository+Blame.m in Sources */ = {isa = PBXBuildFile; fileRef = 20F43DE218A2F667007D3621 /* GTRepository+Blame.m */; };
63+
23BB67B91C7DF3B600A37A66 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D007801B4F9758009A8DAF /* SSZipArchive.m */; };
64+
23BB67BA1C7DF3BC00A37A66 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007841B4F97F9009A8DAF /* unzip.c */; };
65+
23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BB67BB1C7DF45300A37A66 /* libz.tbd */; };
66+
23BB67BD1C7DF49500A37A66 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007851B4F97F9009A8DAF /* zip.c */; };
67+
23BB67BE1C7DF4B100A37A66 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007831B4F97F9009A8DAF /* mztools.c */; };
68+
23BB67BF1C7DF4CD00A37A66 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = F8D007821B4F97F9009A8DAF /* ioapi.c */; };
69+
23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; };
70+
23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; };
6371
3011D86B1668E48500CE3409 /* GTDiffFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D8691668E48500CE3409 /* GTDiffFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
6472
3011D86D1668E48500CE3409 /* GTDiffFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 3011D86A1668E48500CE3409 /* GTDiffFile.m */; };
6573
3011D8711668E78500CE3409 /* GTDiffHunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 3011D86F1668E78500CE3409 /* GTDiffHunk.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -363,7 +371,6 @@
363371
F8D1BDF01B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; };
364372
F8D1BDF11B31FE7C00CDEC90 /* GTRepository+Pull.m in Sources */ = {isa = PBXBuildFile; fileRef = F8D1BDED1B31FE7C00CDEC90 /* GTRepository+Pull.m */; };
365373
F8E4A2911A170CA6006485A8 /* GTRemotePushSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8E4A2901A170CA6006485A8 /* GTRemotePushSpec.m */; };
366-
F8EFA0371B405020000FF7D0 /* GTRepository+PullSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0361B405020000FF7D0 /* GTRepository+PullSpec.m */; };
367374
F8EFA03A1B4059ED000FF7D0 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; };
368375
/* End PBXBuildFile section */
369376

@@ -444,6 +451,7 @@
444451
2089E43B17D9A58000F451DA /* GTTagSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTagSpec.m; sourceTree = "<group>"; };
445452
20F43DE118A2F667007D3621 /* GTRepository+Blame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTRepository+Blame.h"; sourceTree = "<group>"; };
446453
20F43DE218A2F667007D3621 /* GTRepository+Blame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "GTRepository+Blame.m"; sourceTree = "<group>"; };
454+
23BB67BB1C7DF45300A37A66 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
447455
3011D8691668E48500CE3409 /* GTDiffFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffFile.h; sourceTree = "<group>"; };
448456
3011D86A1668E48500CE3409 /* GTDiffFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTDiffFile.m; sourceTree = "<group>"; };
449457
3011D86F1668E78500CE3409 /* GTDiffHunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTDiffHunk.h; sourceTree = "<group>"; };
@@ -648,6 +656,7 @@
648656
isa = PBXFrameworksBuildPhase;
649657
buildActionMask = 2147483647;
650658
files = (
659+
23BB67BC1C7DF45300A37A66 /* libz.tbd in Frameworks */,
651660
D0A0128A19F98475007F1914 /* Quick.framework in Frameworks */,
652661
88F05A9E16011F6E00B7AD1D /* ObjectiveGit.framework in Frameworks */,
653662
D0A0128C19F9853D007F1914 /* Nimble.framework in Frameworks */,
@@ -704,6 +713,7 @@
704713
0867D691FE84028FC02AAC07 /* ObjectiveGitFramework */ = {
705714
isa = PBXGroup;
706715
children = (
716+
23BB67BB1C7DF45300A37A66 /* libz.tbd */,
707717
BDD8AB01130F01AB00CB5D40 /* README.md */,
708718
887B948D1A3A38130070D41D /* ObjectiveGit.modulemap */,
709719
BDE4C05E130EFE2C00851650 /* ObjectiveGit */,
@@ -1387,6 +1397,12 @@
13871397
isa = PBXSourcesBuildPhase;
13881398
buildActionMask = 2147483647;
13891399
files = (
1400+
23BB67BF1C7DF4CD00A37A66 /* ioapi.c in Sources */,
1401+
23BB67BE1C7DF4B100A37A66 /* mztools.c in Sources */,
1402+
23BB67BD1C7DF49500A37A66 /* zip.c in Sources */,
1403+
23BB67BA1C7DF3BC00A37A66 /* unzip.c in Sources */,
1404+
23BB67B91C7DF3B600A37A66 /* SSZipArchive.m in Sources */,
1405+
23BB67C11C7DF60300A37A66 /* GTRepository+PullSpec.m in Sources */,
13901406
D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */,
13911407
200578C518932A82001C06C3 /* GTBlameSpec.m in Sources */,
13921408
4D1C40D8182C006D00BE2960 /* GTBlobSpec.m in Sources */,
@@ -1408,7 +1424,6 @@
14081424
D0AC906C172F941F00347DC4 /* GTRepositorySpec.m in Sources */,
14091425
D01EFDA0195DEF2200838D24 /* NSDataGitSpec.m in Sources */,
14101426
30A269AD17B4878C000FE64E /* GTRepository+StatusSpec.m in Sources */,
1411-
F8EFA0371B405020000FF7D0 /* GTRepository+PullSpec.m in Sources */,
14121427
307623AB17C6C8BD00E2CDF1 /* NSArray+StringArraySpec.m in Sources */,
14131428
8832811F173D8816006D7DCF /* GTIndexSpec.m in Sources */,
14141429
D0F4E28A17C7F24200BBDE30 /* NSErrorGitSpec.m in Sources */,
@@ -1555,6 +1570,7 @@
15551570
F8D007761B4F7D10009A8DAF /* GTTimeAdditionsSpec.m in Sources */,
15561571
F8D007921B4FA03B009A8DAF /* GTIndexSpec.m in Sources */,
15571572
F8D007711B4F7CB0009A8DAF /* NSDataGitSpec.m in Sources */,
1573+
23BB67C21C7DF60400A37A66 /* GTRepository+PullSpec.m in Sources */,
15581574
F8D007A11B4FA03B009A8DAF /* GTRepositoryStashingSpec.m in Sources */,
15591575
F8D007A31B4FA03B009A8DAF /* GTFilterListSpec.m in Sources */,
15601576
F8D0079D1B4FA03B009A8DAF /* GTTreeBuilderSpec.m in Sources */,
@@ -1808,6 +1824,16 @@
18081824
"$(inherited)",
18091825
"$(DEVELOPER_FRAMEWORKS_DIR)",
18101826
);
1827+
GCC_PREPROCESSOR_DEFINITIONS = (
1828+
"DEBUG=1",
1829+
"NOUNCRYPT=1",
1830+
"NOCRYPT=1",
1831+
);
1832+
HEADER_SEARCH_PATHS = (
1833+
External/libgit2/include,
1834+
/usr/local/include,
1835+
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
1836+
);
18111837
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
18121838
MACOSX_DEPLOYMENT_TARGET = 10.9;
18131839
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
@@ -1823,6 +1849,11 @@
18231849
"$(inherited)",
18241850
"$(DEVELOPER_FRAMEWORKS_DIR)",
18251851
);
1852+
HEADER_SEARCH_PATHS = (
1853+
External/libgit2/include,
1854+
/usr/local/include,
1855+
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
1856+
);
18261857
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
18271858
MACOSX_DEPLOYMENT_TARGET = 10.9;
18281859
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
@@ -1892,6 +1923,11 @@
18921923
"$(inherited)",
18931924
"$(DEVELOPER_FRAMEWORKS_DIR)",
18941925
);
1926+
HEADER_SEARCH_PATHS = (
1927+
External/libgit2/include,
1928+
/usr/local/include,
1929+
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
1930+
);
18951931
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
18961932
MACOSX_DEPLOYMENT_TARGET = 10.9;
18971933
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
@@ -2125,6 +2161,11 @@
21252161
"$(inherited)",
21262162
"$(DEVELOPER_FRAMEWORKS_DIR)",
21272163
);
2164+
HEADER_SEARCH_PATHS = (
2165+
External/libgit2/include,
2166+
/usr/local/include,
2167+
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
2168+
);
21282169
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
21292170
MACOSX_DEPLOYMENT_TARGET = 10.9;
21302171
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
@@ -2227,7 +2268,7 @@
22272268
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
22282269
);
22292270
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
2230-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
2271+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
22312272
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
22322273
LIBRARY_SEARCH_PATHS = (
22332274
.,
@@ -2279,7 +2320,7 @@
22792320
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
22802321
);
22812322
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
2282-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
2323+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
22832324
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
22842325
LIBRARY_SEARCH_PATHS = (
22852326
.,
@@ -2332,7 +2373,7 @@
23322373
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
23332374
);
23342375
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
2335-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
2376+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
23362377
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
23372378
LIBRARY_SEARCH_PATHS = (
23382379
.,
@@ -2385,7 +2426,7 @@
23852426
"Carthage/Checkouts/ZipArchive/SSZipArchive/**",
23862427
);
23872428
INFOPLIST_FILE = "ObjectiveGitTests/ObjectiveGitTests-Info.plist";
2388-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
2429+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
23892430
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
23902431
LIBRARY_SEARCH_PATHS = (
23912432
.,

ObjectiveGitFramework.xcworkspace/contents.xcworkspacedata

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ObjectiveGitTests/GTRepository+PullSpec.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
[NSFileManager.defaultManager removeItemAtURL:remoteRepoURL error:NULL];
6969
[NSFileManager.defaultManager removeItemAtURL:localRepoURL error:NULL];
7070
error = NULL;
71-
[self tearDown];
7271
});
7372

7473
context(@"when the local and remote branches are in sync", ^{

ObjectiveGitTests/QuickSpec+GTFixtures.m

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
#import <ObjectiveGit/ObjectiveGit.h>
1010
#import "QuickSpec+GTFixtures.h"
1111
#import <objc/runtime.h>
12-
13-
#if TARGET_OS_IPHONE
1412
#import "SSZipArchive.h"
15-
#endif
1613

1714
static const NSInteger FixturesErrorUnzipFailed = 666;
1815

@@ -67,8 +64,12 @@ - (void)cleanUp {
6764

6865
#pragma mark Fixtures
6966

67+
- (NSString *)rootTempDirectory {
68+
return [NSTemporaryDirectory() stringByAppendingPathComponent:@"com.libgit2.objectivegit"];
69+
}
70+
7071
- (void)setUpTempDirectoryPath {
71-
self.tempDirectoryPath = [[NSTemporaryDirectory() stringByAppendingPathComponent:@"com.libgit2.objectivegit"] stringByAppendingPathComponent:NSProcessInfo.processInfo.globallyUniqueString];
72+
self.tempDirectoryPath = [self.rootTempDirectory stringByAppendingPathComponent:NSProcessInfo.processInfo.globallyUniqueString];
7273

7374
NSError *error = nil;
7475
BOOL success = [NSFileManager.defaultManager createDirectoryAtPath:self.tempDirectoryPath withIntermediateDirectories:YES attributes:nil error:&error];
@@ -87,9 +88,15 @@ - (void)setUpRepositoryFixtureIfNeeded:(NSString *)repositoryName {
8788

8889
NSString *zippedRepositoriesPath = [[NSBundle bundleForClass:self.class] pathForResource:@"fixtures" ofType:@"zip"];
8990

90-
error = nil;
91-
success = [self unzipFile:repositoryName fromArchiveAtPath:zippedRepositoriesPath intoDirectory:self.repositoryFixturesPath error:&error];
92-
XCTAssertTrue(success, @"Couldn't unzip fixture \"%@\" from %@ to %@: %@", repositoryName, zippedRepositoriesPath, self.repositoryFixturesPath, error);
91+
NSString *cleanRepositoryPath = [self.rootTempDirectory stringByAppendingPathComponent:@"clean_repository"];
92+
if (![NSFileManager.defaultManager fileExistsAtPath:cleanRepositoryPath isDirectory:nil]) {
93+
error = nil;
94+
success = [self unzipFromArchiveAtPath:zippedRepositoriesPath intoDirectory:cleanRepositoryPath error:&error];
95+
XCTAssertTrue(success, @"Couldn't unzip fixture \"%@\" from %@ to %@: %@", repositoryName, zippedRepositoriesPath, cleanRepositoryPath, error);
96+
}
97+
98+
success = [[NSFileManager defaultManager] copyItemAtPath:[cleanRepositoryPath stringByAppendingPathComponent:repositoryName] toPath:path error:&error];
99+
XCTAssertTrue(success, @"Couldn't copy directory %@", error);
93100
}
94101

95102
- (NSString *)pathForFixtureRepositoryNamed:(NSString *)repositoryName {
@@ -98,13 +105,7 @@ - (NSString *)pathForFixtureRepositoryNamed:(NSString *)repositoryName {
98105
return [self.repositoryFixturesPath stringByAppendingPathComponent:repositoryName];
99106
}
100107

101-
- (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoDirectory:(NSString *)destinationPath error:(NSError **)error {
102-
103-
#if TARGET_OS_IPHONE
104-
// iOS: unzip in-process using SSZipArchive
105-
//
106-
// system() and NSTask() are not available when running tests in the iOS simulator
107-
108+
- (BOOL)unzipFromArchiveAtPath:(NSString *)zipPath intoDirectory:(NSString *)destinationPath error:(NSError **)error {
108109
BOOL success = [SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath overwrite:YES password:nil error:error];
109110

110111
if (!success) {
@@ -113,32 +114,13 @@ - (BOOL)unzipFile:(NSString *)member fromArchiveAtPath:(NSString *)zipPath intoD
113114
}
114115

115116
return YES;
116-
117-
#else
118-
// OS X: shell out to unzip using NSTask
119-
120-
NSTask *task = [[NSTask alloc] init];
121-
task.launchPath = @"/usr/bin/unzip";
122-
task.arguments = @[ @"-qq", @"-d", destinationPath, zipPath, [member stringByAppendingString:@"*"] ];
123-
124-
[task launch];
125-
[task waitUntilExit];
126-
127-
BOOL success = (task.terminationStatus == 0);
128-
if (!success) {
129-
if (error != NULL) *error = [NSError errorWithDomain:FixturesErrorDomain code:FixturesErrorUnzipFailed userInfo:@{ NSLocalizedDescriptionKey: NSLocalizedString(@"Unzip failed", @"") }];
130-
}
131-
132-
return success;
133-
134-
#endif
135-
136117
}
137118

138119
#pragma mark API
139120

140121
- (GTRepository *)fixtureRepositoryNamed:(NSString *)name {
141-
GTRepository *repository = [[GTRepository alloc] initWithURL:[NSURL fileURLWithPath:[self pathForFixtureRepositoryNamed:name]] error:NULL];
122+
NSURL *url = [NSURL fileURLWithPath:[self pathForFixtureRepositoryNamed:name]];
123+
GTRepository *repository = [[GTRepository alloc] initWithURL:url error:NULL];
142124
XCTAssertNotNil(repository, @"Couldn't create a repository for %@", name);
143125
return repository;
144126
}

0 commit comments

Comments
 (0)