Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release-candidate' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Aug 23, 2016
2 parents 6f60d28 + 98e0e9e commit 334e158
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 65 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 3.1.0

* Removed Xcode 8 betas 1-5 workaround. Beta 6 resolved the bug; please upgrade to Xcode 8 beta 6 before upgrading to 3.1.0 of this library.

# 3.0.7

* Resolved bug in which a failed unit test on Xcode 8 betas would cause arc unit to hang.
Expand Down
70 changes: 5 additions & 65 deletions engine/XcodeUnitTestEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,48 +102,6 @@ protected function loadEnvironment() {
}
}

private function xcodeMajorVersion() {
$future = new ExecFuture('%C -version', $this->xcodebuildBinary);

list($errcode, $stdout, $stderr) = $future->resolve();

if (!$errcode && preg_match("/Xcode (.+)/", $stdout, $matches)) {
return intval($matches[1]);
}

return null;
}

public function execFutureEndOnLine($future, $stdoutline, $stderrline) {
$wait = $future->getDefaultWait();
$hasSeenLine = false;
do {
if ($future->isReady()) {
break;
}

$read = $future->getReadSockets();
$write = $future->getWriteSockets();

if ($read || $write) {
Future::waitForSockets($read, $write, $wait);
}

$pipes = $future->read();
if (!$hasSeenLine && (strpos($pipes[0], $stdoutline) !== false
|| strpos($pipes[1], $stderrline) !== false)) {
$hasSeenLine = true;

} else if ($hasSeenLine && empty($pipes[0])) {
$results = $future->resolveKill();
$results[0] = 0; # Overwrite the 'kill' error code.
return $results;
}
} while (true);

return $future->getResult();
}

public function run() {
$this->loadEnvironment();

Expand All @@ -165,29 +123,11 @@ public function run() {
$future->resolvex();
}

$xcodeMajorVersion = $this->xcodeMajorVersion();
if ($xcodeMajorVersion && $xcodeMajorVersion >= 8) {
// Build and run unit tests
$future = new ExecFuture('%C build-for-testing %C',
$this->xcodebuildBinary, implode(' ', $xcodeargs));
list($builderror, $xcbuild_stdout, $xcbuild_stderr) = $future->resolve();
if (!$builderror) {
$future = new ExecFuture('%C test-without-building %C',
$this->xcodebuildBinary, implode(' ', $xcodeargs));

list($builderror, $xcbuild_stdout, $xcbuild_stderr) =
$this->execFutureEndOnLine($future,
"** TEST EXECUTE SUCCEEDED **",
"** TEST EXECUTE FAILED **"
);
}
// Build and run unit tests
$future = new ExecFuture('%C %C test',
$this->xcodebuildBinary, implode(' ', $xcodeargs));

} else {
// Build and run unit tests
$future = new ExecFuture('%C %C test',
$this->xcodebuildBinary, implode(' ', $xcodeargs));
list($builderror, $xcbuild_stdout, $xcbuild_stderr) = $future->resolve();
}
list($builderror, $xcbuild_stdout, $xcbuild_stderr) = $future->resolve();

// Error-code 65 is thrown for build/unit test failures.
if ($builderror !== 0 && $builderror !== 65) {
Expand Down Expand Up @@ -230,7 +170,7 @@ public function run() {
}
}
}

// TODO(featherless): If we publicized the parseCoverageResults method on
// XcodeTestResultParser we could parseTestResults, then call parseCoverageResults,
// and the logic here would map the coverage results to the test results. This
Expand Down

0 comments on commit 334e158

Please sign in to comment.