Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15484208
D7848.id17757.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7848.id17757.diff
View Options
Index: src/unit/engine/PhpunitResultParser.php
===================================================================
--- src/unit/engine/PhpunitResultParser.php
+++ src/unit/engine/PhpunitResultParser.php
@@ -32,9 +32,18 @@
}
$results = array();
+ $finished = array();
foreach ($report as $event) {
- if ('test' != $event->event) {
- continue;
+ switch ($event->event) {
+ case 'test':
+ break;
+ case 'testStart':
+ if (!isset($finished[$event->test])) {
+ $finished[$event->test] = false;
+ }
+ // fall through
+ default:
+ continue 2; // switch + loop
}
$status = ArcanistUnitTestResult::RESULT_PASS;
@@ -72,8 +81,14 @@
$result->setUserData($user_data);
$results[] = $result;
+ $finished[$event->test] = true;
}
+ foreach ($finished as $name => $didFinish) {
+ if (!$didFinish) {
+ throw new Exception("Test $name did not finish");
+ }
+ }
return $results;
}
Index: src/unit/engine/PhpunitTestEngine.php
===================================================================
--- src/unit/engine/PhpunitTestEngine.php
+++ src/unit/engine/PhpunitTestEngine.php
@@ -71,8 +71,10 @@
$config = $this->configFile ? csprintf('-c %s', $this->configFile) : null;
- $futures[$test_path] = new ExecFuture('%C %C --log-json %s %C %s',
- $this->phpunitBinary, $config, $json_tmp, $clover, $test_path);
+ $stderr = "-d display_errors=stderr";
+
+ $futures[$test_path] = new ExecFuture('%C %C %C --log-json %s %C %s',
+ $this->phpunitBinary, $config, $stderr, $json_tmp, $clover, $test_path);
$tmpfiles[$test_path] = array(
'json' => $json_tmp,
'clover' => $clover_tmp,
@@ -86,10 +88,18 @@
list($err, $stdout, $stderr) = $future->resolve();
- $results[] = $this->parseTestResults(
- $test,
- $tmpfiles[$test]['json'],
- $tmpfiles[$test]['clover']);
+ try {
+ $results[] = $this->parseTestResults(
+ $test,
+ $tmpfiles[$test]['json'],
+ $tmpfiles[$test]['clover']);
+ } catch (Exception $e) {
+ if ($stderr) {
+ $msg = "The test '$test' crashed with the following output:\n$stderr";
+ throw new Exception($msg, 0, $e);
+ }
+ throw $e; // rethrow original
+ }
}
return array_mergev($results);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 10, 5:07 PM (3 d, 23 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7732282
Default Alt Text
D7848.id17757.diff (2 KB)
Attached To
Mode
D7848: Print a more useful error message if any PHPUnit tests crash
Attached
Detach File
Event Timeline
Log In to Comment