@@ -102,48 +102,6 @@ protected function loadEnvironment() {
102102 }
103103 }
104104
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-
147105 public function run () {
148106 $ this ->loadEnvironment ();
149107
@@ -165,29 +123,11 @@ public function run() {
165123 $ future ->resolvex ();
166124 }
167125
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 ));
184129
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 ();
191131
192132 // Error-code 65 is thrown for build/unit test failures.
193133 if ($ builderror !== 0 && $ builderror !== 65 ) {
@@ -230,7 +170,7 @@ public function run() {
230170 }
231171 }
232172 }
233-
173+
234174 // TODO(featherless): If we publicized the parseCoverageResults method on
235175 // XcodeTestResultParser we could parseTestResults, then call parseCoverageResults,
236176 // and the logic here would map the coverage results to the test results. This
0 commit comments