@@ -102,48 +102,6 @@ protected function loadEnvironment() {
102
102
}
103
103
}
104
104
105
- private function xcodeMajorVersion () {
106
- $ future = new ExecFuture ('%C -version ' , $ this ->xcodebuildBinary );
107
-
108
- list ($ errcode , $ stdout , $ stderr ) = $ future ->resolve ();
109
-
110
- if (!$ errcode && preg_match ("/Xcode (.+)/ " , $ stdout , $ matches )) {
111
- return intval ($ matches [1 ]);
112
- }
113
-
114
- return null ;
115
- }
116
-
117
- public function execFutureEndOnLine ($ future , $ stdoutline , $ stderrline ) {
118
- $ wait = $ future ->getDefaultWait ();
119
- $ hasSeenLine = false ;
120
- do {
121
- if ($ future ->isReady ()) {
122
- break ;
123
- }
124
-
125
- $ read = $ future ->getReadSockets ();
126
- $ write = $ future ->getWriteSockets ();
127
-
128
- if ($ read || $ write ) {
129
- Future::waitForSockets ($ read , $ write , $ wait );
130
- }
131
-
132
- $ pipes = $ future ->read ();
133
- if (!$ hasSeenLine && (strpos ($ pipes [0 ], $ stdoutline ) !== false
134
- || strpos ($ pipes [1 ], $ stderrline ) !== false )) {
135
- $ hasSeenLine = true ;
136
-
137
- } else if ($ hasSeenLine && empty ($ pipes [0 ])) {
138
- $ results = $ future ->resolveKill ();
139
- $ results [0 ] = 0 ; # Overwrite the 'kill' error code.
140
- return $ results ;
141
- }
142
- } while (true );
143
-
144
- return $ future ->getResult ();
145
- }
146
-
147
105
public function run () {
148
106
$ this ->loadEnvironment ();
149
107
@@ -165,29 +123,11 @@ public function run() {
165
123
$ future ->resolvex ();
166
124
}
167
125
168
- $ xcodeMajorVersion = $ this ->xcodeMajorVersion ();
169
- if ($ xcodeMajorVersion && $ xcodeMajorVersion >= 8 ) {
170
- // Build and run unit tests
171
- $ future = new ExecFuture ('%C build-for-testing %C ' ,
172
- $ this ->xcodebuildBinary , implode (' ' , $ xcodeargs ));
173
- list ($ builderror , $ xcbuild_stdout , $ xcbuild_stderr ) = $ future ->resolve ();
174
- if (!$ builderror ) {
175
- $ future = new ExecFuture ('%C test-without-building %C ' ,
176
- $ this ->xcodebuildBinary , implode (' ' , $ xcodeargs ));
177
-
178
- list ($ builderror , $ xcbuild_stdout , $ xcbuild_stderr ) =
179
- $ this ->execFutureEndOnLine ($ future ,
180
- "** TEST EXECUTE SUCCEEDED ** " ,
181
- "** TEST EXECUTE FAILED ** "
182
- );
183
- }
126
+ // Build and run unit tests
127
+ $ future = new ExecFuture ('%C %C test ' ,
128
+ $ this ->xcodebuildBinary , implode (' ' , $ xcodeargs ));
184
129
185
- } else {
186
- // Build and run unit tests
187
- $ future = new ExecFuture ('%C %C test ' ,
188
- $ this ->xcodebuildBinary , implode (' ' , $ xcodeargs ));
189
- list ($ builderror , $ xcbuild_stdout , $ xcbuild_stderr ) = $ future ->resolve ();
190
- }
130
+ list ($ builderror , $ xcbuild_stdout , $ xcbuild_stderr ) = $ future ->resolve ();
191
131
192
132
// Error-code 65 is thrown for build/unit test failures.
193
133
if ($ builderror !== 0 && $ builderror !== 65 ) {
@@ -230,7 +170,7 @@ public function run() {
230
170
}
231
171
}
232
172
}
233
-
173
+
234
174
// TODO(featherless): If we publicized the parseCoverageResults method on
235
175
// XcodeTestResultParser we could parseTestResults, then call parseCoverageResults,
236
176
// and the logic here would map the coverage results to the test results. This
0 commit comments