xcknife 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +1 -5
- data/Gemfile +1 -4
- data/Gemfile.lock +2 -8
- data/README.md +9 -1
- data/Rakefile +0 -1
- data/TestDumper/README.md +2 -1
- data/TestDumper/TestDumper.xcodeproj/project.pbxproj +27 -5
- data/TestDumper/TestDumper.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- data/TestDumper/TestDumper.xcodeproj/xcshareddata/xcschemes/TestDumper.xcscheme +1 -1
- data/TestDumper/TestDumper/Initialize.m +32 -36
- data/lib/xcknife.rb +1 -1
- data/lib/xcknife/test_dumper.rb +29 -9
- metadata +4 -6
- data/.hubkins +0 -5
- data/.sqiosbuild.json +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5e951e4ae5d93f82ed7773becf567d9ce8dc3a10295b3c9b7774617e1a10d48
|
4
|
+
data.tar.gz: 5f9cfc34b089ec42bf675280fd3fbf0da524220c79a55e0297ada05d0e3403d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a57b87ee14efa242124ad9e14c2d7bc86937315a8dc9e9206c80480285c4744495ad4376f02ad835f7c23e52e79ebbbc7f7cbcab9ba95a3b12d894aaed0daca9
|
7
|
+
data.tar.gz: 07afb2bc56b4792c355a89001cce7d45261358375457cff69f717b73ce3dbfb0c69ac91fee0b01714d1a8761869bbf1475c0044064aa74ae8e20023ef0fc8481
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.1
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
source 'https://
|
2
|
-
source 'https://gems.vip.global.square/private'
|
1
|
+
source 'https://rubygems.org'
|
3
2
|
|
4
3
|
group :development, :test do
|
5
4
|
gem 'rake', '~> 11.1.1'
|
6
5
|
gem 'rspec', '~> 3.4.0'
|
7
6
|
end
|
8
7
|
|
9
|
-
gem 'sq-gem_tasks', '~> 1.0'
|
10
|
-
|
11
8
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
xcknife (0.
|
4
|
+
xcknife (0.11.0)
|
5
5
|
|
6
6
|
GEM
|
7
|
-
remote: https://
|
8
|
-
remote: https://gems.vip.global.square/private/
|
7
|
+
remote: https://rubygems.org/
|
9
8
|
specs:
|
10
9
|
diff-lcs (1.3)
|
11
10
|
rake (11.1.2)
|
12
|
-
rangeclient (0.0.17)
|
13
11
|
rspec (3.4.0)
|
14
12
|
rspec-core (~> 3.4.0)
|
15
13
|
rspec-expectations (~> 3.4.0)
|
@@ -23,9 +21,6 @@ GEM
|
|
23
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
24
22
|
rspec-support (~> 3.4.0)
|
25
23
|
rspec-support (3.4.1)
|
26
|
-
sq-gem_tasks (1.7.1)
|
27
|
-
bundler (~> 1.6)
|
28
|
-
rangeclient (>= 0.0.12)
|
29
24
|
|
30
25
|
PLATFORMS
|
31
26
|
ruby
|
@@ -34,7 +29,6 @@ DEPENDENCIES
|
|
34
29
|
bundler (~> 1.12)
|
35
30
|
rake (~> 11.1.1)
|
36
31
|
rspec (~> 3.4.0)
|
37
|
-
sq-gem_tasks (~> 1.0)
|
38
32
|
xcknife!
|
39
33
|
|
40
34
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ It works by leveraging [xctool's](https://github.com/facebook/xctool) [json-stre
|
|
9
9
|
|
10
10
|
XCKnife generates a list of only arguments meant to be pass to Xctool's [*-only* test arguments](https://github.com/facebook/xctool#testing), but alternatively could used to generate multiple xcschemes with the proper test partitions.
|
11
11
|
|
12
|
-
More information on XCKnife, go [here](https://
|
12
|
+
More information on XCKnife, go [here](https://developer.squareup.com/blog/xcknife-faster-distributed-tests-for-ios).
|
13
13
|
|
14
14
|
## Install
|
15
15
|
|
@@ -194,6 +194,14 @@ XCKnife uses only a few attributes of a json-stream file. If you are storing the
|
|
194
194
|
|
195
195
|
`$ xcknife-min example/xcknife-exemplar-historical-data.json-stream minified.json-stream`
|
196
196
|
|
197
|
+
## Dependencies
|
198
|
+
|
199
|
+
XCKnife requires the use of the `gtimeout` command, which is provided in the GNU coreutils brew package. If you don't already have them, they can be installed with the command:
|
200
|
+
|
201
|
+
```
|
202
|
+
brew install coreutils
|
203
|
+
```
|
204
|
+
|
197
205
|
## Contributing
|
198
206
|
|
199
207
|
Any contributors to the master *xcknife* repository must sign the
|
data/Rakefile
CHANGED
data/TestDumper/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# TestDumper - EXPERIMENTAL
|
2
2
|
|
3
|
-
Utility that replaces xctool for enumerating tests. It requires the `build-for-testing` feature
|
3
|
+
Utility that replaces xctool for enumerating tests. It requires the `build-for-testing` feature Xcode 8 introduced on xcodebuild. In particular, it leverages the xctestrun file (see `man xcodebuild.xctestrun`).
|
4
4
|
|
5
5
|
## Building.
|
6
6
|
|
@@ -17,6 +17,7 @@ $ xcknife-test-dumper --help
|
|
17
17
|
Usage: xcknife-test-dumper [options] derived_data_folder output_file [device_id]
|
18
18
|
-d, --debug Debug mode enabled
|
19
19
|
-r, --retry-count COUNT Max retry count for simulator output
|
20
|
+
-x, --simctl-timeout SECONDS Max allowed time in seconds for simctl commands
|
20
21
|
-t OUTPUT_FOLDER, Sets temporary Output folder
|
21
22
|
--temporary-output
|
22
23
|
-s, --scheme XCSCHEME_FILE Reads environments variables from the xcscheme file
|
@@ -181,7 +181,7 @@
|
|
181
181
|
isa = PBXProject;
|
182
182
|
attributes = {
|
183
183
|
LastSwiftUpdateCheck = 0700;
|
184
|
-
LastUpgradeCheck =
|
184
|
+
LastUpgradeCheck = 1010;
|
185
185
|
ORGANIZATIONNAME = "Square, Inc";
|
186
186
|
TargetAttributes = {
|
187
187
|
F60C68B91B8D038300CC8521 = {
|
@@ -198,7 +198,7 @@
|
|
198
198
|
};
|
199
199
|
};
|
200
200
|
};
|
201
|
-
buildConfigurationList = F60C68B41B8D038300CC8521 /* Build configuration list for PBXProject "
|
201
|
+
buildConfigurationList = F60C68B41B8D038300CC8521 /* Build configuration list for PBXProject "TestDumper" */;
|
202
202
|
compatibilityVersion = "Xcode 3.2";
|
203
203
|
developmentRegion = English;
|
204
204
|
hasScannedForEncodings = 0;
|
@@ -288,13 +288,23 @@
|
|
288
288
|
CLANG_CXX_LIBRARY = "libc++";
|
289
289
|
CLANG_ENABLE_MODULES = YES;
|
290
290
|
CLANG_ENABLE_OBJC_ARC = YES;
|
291
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
291
292
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
293
|
+
CLANG_WARN_COMMA = YES;
|
292
294
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
295
|
+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
293
296
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
294
297
|
CLANG_WARN_EMPTY_BODY = YES;
|
295
298
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
299
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
296
300
|
CLANG_WARN_INT_CONVERSION = YES;
|
301
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
302
|
+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
303
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
297
304
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
305
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
306
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
307
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
298
308
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
299
309
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
300
310
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
@@ -337,13 +347,23 @@
|
|
337
347
|
CLANG_CXX_LIBRARY = "libc++";
|
338
348
|
CLANG_ENABLE_MODULES = YES;
|
339
349
|
CLANG_ENABLE_OBJC_ARC = YES;
|
350
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
340
351
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
352
|
+
CLANG_WARN_COMMA = YES;
|
341
353
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
354
|
+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
342
355
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
343
356
|
CLANG_WARN_EMPTY_BODY = YES;
|
344
357
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
358
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
345
359
|
CLANG_WARN_INT_CONVERSION = YES;
|
360
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
361
|
+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
362
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
346
363
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
364
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
365
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
366
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
347
367
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
348
368
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
349
369
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
@@ -373,12 +393,13 @@
|
|
373
393
|
F60C68D11B8D038300CC8521 /* Debug */ = {
|
374
394
|
isa = XCBuildConfiguration;
|
375
395
|
buildSettings = {
|
396
|
+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
376
397
|
CLANG_ENABLE_MODULES = YES;
|
398
|
+
CODE_SIGN_IDENTITY = "";
|
377
399
|
DEFINES_MODULE = YES;
|
378
400
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
379
401
|
DYLIB_CURRENT_VERSION = 1;
|
380
402
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
381
|
-
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
382
403
|
FRAMEWORK_SEARCH_PATHS = (
|
383
404
|
"$(inherited)",
|
384
405
|
"$(SDKROOT)/../../Library/Frameworks/",
|
@@ -399,12 +420,13 @@
|
|
399
420
|
F60C68D21B8D038300CC8521 /* Release */ = {
|
400
421
|
isa = XCBuildConfiguration;
|
401
422
|
buildSettings = {
|
423
|
+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
402
424
|
CLANG_ENABLE_MODULES = YES;
|
425
|
+
CODE_SIGN_IDENTITY = "";
|
403
426
|
DEFINES_MODULE = YES;
|
404
427
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
405
428
|
DYLIB_CURRENT_VERSION = 1;
|
406
429
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
407
|
-
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
408
430
|
FRAMEWORK_SEARCH_PATHS = (
|
409
431
|
"$(inherited)",
|
410
432
|
"$(SDKROOT)/../../Library/Frameworks/",
|
@@ -483,7 +505,7 @@
|
|
483
505
|
/* End XCBuildConfiguration section */
|
484
506
|
|
485
507
|
/* Begin XCConfigurationList section */
|
486
|
-
F60C68B41B8D038300CC8521 /* Build configuration list for PBXProject "
|
508
|
+
F60C68B41B8D038300CC8521 /* Build configuration list for PBXProject "TestDumper" */ = {
|
487
509
|
isa = XCConfigurationList;
|
488
510
|
buildConfigurations = (
|
489
511
|
F60C68CE1B8D038300CC8521 /* Debug */,
|
@@ -7,13 +7,9 @@
|
|
7
7
|
//
|
8
8
|
|
9
9
|
@import Dispatch;
|
10
|
+
@import Foundation;
|
10
11
|
@import XCTest;
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@class NSSet, NSString, NSURL, NSUUID;
|
16
|
-
|
17
13
|
@interface XCTestConfiguration : NSObject <NSSecureCoding>
|
18
14
|
{
|
19
15
|
NSURL *_testBundleURL;
|
@@ -74,16 +70,20 @@
|
|
74
70
|
// Logging
|
75
71
|
FILE *logFile;
|
76
72
|
|
77
|
-
void initializeLogFile(char *logFilePath)
|
73
|
+
void initializeLogFile(const char *logFilePath)
|
78
74
|
{
|
79
75
|
logFile = fopen(logFilePath, "w");
|
80
76
|
}
|
81
77
|
|
82
|
-
void logDebug(NSString
|
78
|
+
void logDebug(NSString *, ...) NS_FORMAT_FUNCTION(1, 2);
|
79
|
+
void logDebug(NSString *msg, ...)
|
83
80
|
{
|
84
81
|
assert(logFile);
|
85
|
-
|
86
|
-
|
82
|
+
va_list varargs;
|
83
|
+
va_start(varargs, msg);
|
84
|
+
msg = [[NSString alloc] initWithFormat:msg arguments:varargs];
|
85
|
+
va_end(varargs);
|
86
|
+
fprintf(logFile, "%s\n", msg.UTF8String);
|
87
87
|
|
88
88
|
NSLog(@"%@", msg);
|
89
89
|
}
|
@@ -92,16 +92,20 @@ void logInit()
|
|
92
92
|
{
|
93
93
|
logDebug(@"Starting TestDumper...");
|
94
94
|
logDebug(@"Environment Variables:");
|
95
|
-
logDebug(NSProcessInfo.processInfo.environment.description);
|
95
|
+
logDebug(@"%@", NSProcessInfo.processInfo.environment.description);
|
96
96
|
logDebug(@"Command Line Arguments:");
|
97
|
-
logDebug(NSProcessInfo.processInfo.arguments.description);
|
97
|
+
logDebug(@"%@", NSProcessInfo.processInfo.arguments.description);
|
98
98
|
|
99
99
|
logDebug(@"--------------------------------");
|
100
100
|
}
|
101
101
|
|
102
|
-
|
102
|
+
OS_NORETURN
|
103
|
+
void logEnd(Boolean success)
|
103
104
|
{
|
104
|
-
|
105
|
+
int exitCode = success ? EXIT_SUCCESS : EXIT_FAILURE;
|
106
|
+
logDebug(@"EndingTestDumper...\nExiting with status %d", exitCode);
|
107
|
+
fclose(logFile);
|
108
|
+
exit(exitCode);
|
105
109
|
}
|
106
110
|
|
107
111
|
// Used for a structured log, just like Xctool's.
|
@@ -113,10 +117,10 @@ static void PrintJSON(FILE *outFile, id JSONObject)
|
|
113
117
|
|
114
118
|
if (error) {
|
115
119
|
fprintf(outFile, "{ \"message\" : \"Error while serializing to JSON. Check out simulator logs for details\" }");
|
116
|
-
|
120
|
+
logDebug(@"ERROR: Error generating JSON for object: %s: %s\n",
|
117
121
|
[[JSONObject description] UTF8String],
|
118
122
|
[[error localizedFailureReason] UTF8String]);
|
119
|
-
|
123
|
+
logEnd(false);
|
120
124
|
}
|
121
125
|
|
122
126
|
fwrite([data bytes], 1, [data length], outFile);
|
@@ -146,7 +150,7 @@ static void PrintTestClass(FILE *outFile, NSString *testClass) {
|
|
146
150
|
@"totalDuration" : @"0"});
|
147
151
|
}
|
148
152
|
|
149
|
-
void enumerateTests();
|
153
|
+
void enumerateTests(NSString *);
|
150
154
|
|
151
155
|
const int TEST_TARGET_LEVEL = 0;
|
152
156
|
const int TEST_CLASS_LEVEL = 1;
|
@@ -156,7 +160,7 @@ FILE *noteFile;
|
|
156
160
|
__attribute__((constructor))
|
157
161
|
void initialize() {
|
158
162
|
NSLog(@"Starting TestDumper");
|
159
|
-
char *logFilePath = [[[NSProcessInfo processInfo] arguments][3] UTF8String];
|
163
|
+
const char *logFilePath = [[[NSProcessInfo processInfo] arguments][3] UTF8String];
|
160
164
|
initializeLogFile(logFilePath);
|
161
165
|
logInit();
|
162
166
|
NSString *testBundlePath = [[NSProcessInfo processInfo] arguments][4];
|
@@ -164,11 +168,11 @@ void initialize() {
|
|
164
168
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
165
169
|
|
166
170
|
if ([fileManager fileExistsAtPath:testDumperOutputPath]) {
|
167
|
-
|
168
|
-
|
171
|
+
logDebug(@"File already exists %@. Stopping", testDumperOutputPath);
|
172
|
+
logEnd(true);
|
169
173
|
}
|
170
|
-
NSString *testType = [NSString stringWithUTF8String: getenv("XCTEST_TYPE")];
|
171
174
|
|
175
|
+
NSString *testType = [NSString stringWithUTF8String: getenv("XCTEST_TYPE")];
|
172
176
|
if ([testType isEqualToString: @"APPTEST"]) {
|
173
177
|
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidFinishLaunchingNotification object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
174
178
|
enumerateTests(testBundlePath);
|
@@ -181,8 +185,7 @@ void initialize() {
|
|
181
185
|
void enumerateTests(NSString *testBundlePath) {
|
182
186
|
logDebug(@"Listing all test bundles");
|
183
187
|
for (NSBundle *bundle in NSBundle.allBundles) {
|
184
|
-
|
185
|
-
logDebug(string);
|
188
|
+
logDebug(@"Found a test bundle named: %@", bundle.bundlePath);
|
186
189
|
}
|
187
190
|
logDebug(@"Finished listing all test bundles");
|
188
191
|
|
@@ -192,19 +195,14 @@ void enumerateTests(NSString *testBundlePath) {
|
|
192
195
|
|
193
196
|
logDebug(@"Listing all test bundles");
|
194
197
|
for (NSBundle *bundle in NSBundle.allBundles) {
|
195
|
-
|
196
|
-
logDebug(string);
|
198
|
+
logDebug(@"Found a test bundle named: %@", bundle.bundlePath);
|
197
199
|
}
|
198
200
|
logDebug(@"Finished listing all test bundles");
|
199
201
|
|
200
202
|
NSString *testType = [NSString stringWithUTF8String: getenv("XCTEST_TYPE")];
|
201
203
|
NSString *testTarget = [[[testBundlePath componentsSeparatedByString:@"/"] lastObject] componentsSeparatedByString:@"."][0];
|
202
204
|
|
203
|
-
logDebug(@"The test target is:");
|
204
|
-
logDebug(testTarget);
|
205
|
-
if ([testType isEqualToString: @"APPTEST"]) {
|
206
|
-
logDebug(@"IS APPTEST");
|
207
|
-
}
|
205
|
+
logDebug(@"The test target is: %@ of type %@", testTarget, testType);
|
208
206
|
|
209
207
|
FILE *outFile;
|
210
208
|
NSString *testDumperOutputPath = NSProcessInfo.processInfo.environment[@"TestDumperOutputPath"];
|
@@ -215,11 +213,10 @@ void enumerateTests(NSString *testBundlePath) {
|
|
215
213
|
outFile = fopen(testDumperOutputPath.UTF8String, "w+");
|
216
214
|
}
|
217
215
|
|
218
|
-
|
216
|
+
logDebug(@"Opened %@ with fd %p", testDumperOutputPath, outFile);
|
219
217
|
if (outFile == NULL) {
|
220
|
-
logDebug(@"File already exists
|
221
|
-
|
222
|
-
exit(0);
|
218
|
+
logDebug(@"File already exists at %@. Stopping", testDumperOutputPath);
|
219
|
+
logEnd(true);
|
223
220
|
}
|
224
221
|
|
225
222
|
PrintDumpStart(outFile, testType);
|
@@ -227,8 +224,7 @@ void enumerateTests(NSString *testBundlePath) {
|
|
227
224
|
[testSuite printTestsWithLevel:0 withTarget: testTarget withParent: nil outputFile:outFile];
|
228
225
|
PrintDumpEnd(outFile, testType);
|
229
226
|
fclose(outFile);
|
230
|
-
logEnd();
|
231
|
-
exit(0);
|
227
|
+
logEnd(true);
|
232
228
|
}
|
233
229
|
|
234
230
|
|
@@ -251,7 +247,7 @@ void enumerateTests(NSString *testBundlePath) {
|
|
251
247
|
// nothing to do here
|
252
248
|
break;
|
253
249
|
default:
|
254
|
-
|
250
|
+
logDebug(@"Unknown test level %ld for test %@", level, t.debugDescription);
|
255
251
|
|
256
252
|
}
|
257
253
|
if (level == TEST_METHOD_LEVEL) {
|
data/lib/xcknife.rb
CHANGED
data/lib/xcknife/test_dumper.rb
CHANGED
@@ -30,11 +30,12 @@ module XCKnife
|
|
30
30
|
@logger = logger
|
31
31
|
@logger.level = @debug ? Logger::DEBUG : Logger::FATAL
|
32
32
|
@parser = nil
|
33
|
+
@simctl_timeout = 0
|
33
34
|
end
|
34
35
|
|
35
36
|
def run
|
36
37
|
helper = TestDumperHelper.new(@device_id, @max_retry_count, @debug, @logger, @dylib_logfile_path,
|
37
|
-
naive_dump_bundle_names: @naive_dump_bundle_names, skip_dump_bundle_names: @skip_dump_bundle_names)
|
38
|
+
naive_dump_bundle_names: @naive_dump_bundle_names, skip_dump_bundle_names: @skip_dump_bundle_names, simctl_timeout: @simctl_timeout)
|
38
39
|
extra_environment_variables = parse_scheme_file
|
39
40
|
logger.info { "Environment variables from xcscheme: #{extra_environment_variables.pretty_inspect}" }
|
40
41
|
output_fd = File.open(@output_file, "w")
|
@@ -93,6 +94,7 @@ module XCKnife
|
|
93
94
|
opts.banner += " #{arguments_banner}"
|
94
95
|
opts.on("-d", "--debug", "Debug mode enabled") { |v| @debug = v }
|
95
96
|
opts.on("-r", "--retry-count COUNT", "Max retry count for simulator output", Integer) { |v| @max_retry_count = v }
|
97
|
+
opts.on("-x", '--simctl-timeout SECONDS', "Max allowed time in seconds for simctl commands", Integer) { |v| @simctl_timeout = v }
|
96
98
|
opts.on("-t", "--temporary-output OUTPUT_FOLDER", "Sets temporary Output folder") { |v| @temporary_output_folder = v }
|
97
99
|
opts.on("-s", "--scheme XCSCHEME_FILE", "Reads environments variables from the xcscheme file") { |v| @xcscheme_file = v }
|
98
100
|
opts.on("-l", "--dylib_logfile DYLIB_LOG_FILE", "Path for dylib log file") { |v| @dylib_logfile_path = v }
|
@@ -111,7 +113,7 @@ module XCKnife
|
|
111
113
|
end
|
112
114
|
|
113
115
|
def optional_arguments
|
114
|
-
%w[device_id]
|
116
|
+
%w[device_id simctl_timeout]
|
115
117
|
end
|
116
118
|
|
117
119
|
def arguments_banner
|
@@ -150,7 +152,7 @@ module XCKnife
|
|
150
152
|
attr_reader :logger
|
151
153
|
|
152
154
|
def initialize(device_id, max_retry_count, debug, logger, dylib_logfile_path,
|
153
|
-
naive_dump_bundle_names: [], skip_dump_bundle_names: [])
|
155
|
+
naive_dump_bundle_names: [], skip_dump_bundle_names: [], simctl_timeout: 0)
|
154
156
|
@xcode_path = `xcode-select -p`.strip
|
155
157
|
@simctl_path = `xcrun -f simctl`.strip
|
156
158
|
@nm_path = `xcrun -f nm`.strip
|
@@ -161,6 +163,7 @@ module XCKnife
|
|
161
163
|
@testroot = nil
|
162
164
|
@device_id = device_id
|
163
165
|
@max_retry_count = max_retry_count
|
166
|
+
@simctl_timeout = simctl_timeout
|
164
167
|
@logger = logger
|
165
168
|
@debug = debug
|
166
169
|
@dylib_logfile_path = dylib_logfile_path if dylib_logfile_path
|
@@ -294,6 +297,27 @@ module XCKnife
|
|
294
297
|
@simctl_path
|
295
298
|
end
|
296
299
|
|
300
|
+
def wrapped_simctl(args)
|
301
|
+
args = [*gtimeout, simctl] + args
|
302
|
+
args
|
303
|
+
end
|
304
|
+
|
305
|
+
def gtimeout
|
306
|
+
return [] unless @simctl_timeout > 0
|
307
|
+
|
308
|
+
path = gtimeout_path
|
309
|
+
if path.empty?
|
310
|
+
puts "warning: simctl_timeout specified but 'gtimeout' is not installed. The specified timeout will be ignored."
|
311
|
+
return []
|
312
|
+
end
|
313
|
+
|
314
|
+
[path, "-k", "5", "#{@simctl_timeout}"]
|
315
|
+
end
|
316
|
+
|
317
|
+
def gtimeout_path
|
318
|
+
`which gtimeout`.strip
|
319
|
+
end
|
320
|
+
|
297
321
|
def replace_vars(str, testhost = "<UNKNOWN>")
|
298
322
|
str.gsub("__PLATFORMS__", @platforms_path).
|
299
323
|
gsub("__TESTHOST__", testhost).
|
@@ -359,7 +383,7 @@ module XCKnife
|
|
359
383
|
end
|
360
384
|
|
361
385
|
def call_simctl(args, env: {}, **spawn_opts)
|
362
|
-
args =
|
386
|
+
args = wrapped_simctl(args)
|
363
387
|
cmd = Shellwords.shelljoin(args)
|
364
388
|
puts "Running:\n$ #{cmd}"
|
365
389
|
logger.info { "Environment variables:\n #{env.pretty_print_inspect}" }
|
@@ -370,11 +394,7 @@ module XCKnife
|
|
370
394
|
end
|
371
395
|
|
372
396
|
def dylib_logfile_path
|
373
|
-
|
374
|
-
@dylib_logfile_path
|
375
|
-
else
|
376
|
-
'/tmp/xcknife_testdumper_dylib.log'
|
377
|
-
end
|
397
|
+
@dylib_logfile_path ||= '/tmp/xcknife_testdumper_dylib.log'
|
378
398
|
end
|
379
399
|
|
380
400
|
def xctest_type(test_bundle)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcknife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,10 +38,8 @@ extensions: []
|
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
40
|
- ".gitignore"
|
41
|
-
- ".hubkins"
|
42
41
|
- ".rspec"
|
43
42
|
- ".ruby-version"
|
44
|
-
- ".sqiosbuild.json"
|
45
43
|
- ".travis.yml"
|
46
44
|
- CONTRIBUTING.md
|
47
45
|
- Gemfile
|
@@ -53,6 +51,7 @@ files:
|
|
53
51
|
- TestDumper/README.md
|
54
52
|
- TestDumper/TestDumper.dylib
|
55
53
|
- TestDumper/TestDumper.xcodeproj/project.pbxproj
|
54
|
+
- TestDumper/TestDumper.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
|
56
55
|
- TestDumper/TestDumper.xcodeproj/xcshareddata/xcschemes/TestDumper.xcscheme
|
57
56
|
- TestDumper/TestDumper/Info.plist
|
58
57
|
- TestDumper/TestDumper/Initialize.m
|
@@ -94,8 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
93
|
- !ruby/object:Gem::Version
|
95
94
|
version: '0'
|
96
95
|
requirements: []
|
97
|
-
|
98
|
-
rubygems_version: 2.7.4
|
96
|
+
rubygems_version: 3.0.8
|
99
97
|
signing_key:
|
100
98
|
specification_version: 4
|
101
99
|
summary: Simple tool for optimizing XCTest runs across machines
|
data/.hubkins
DELETED