mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
Add support for Go 1.10 (cached) output
Summary: In Go 1.10 the output for tests was changed to have also a "(cached)" mode in addition to the normal timing info printed. This is on by default. This adds support for parsing these lines instead of erroring out on the regex. Test Plan: Have a unit test included, and will continue to poke at it locally. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D19161
This commit is contained in:
parent
be1dd7e2ba
commit
dcd7ef66d0
3 changed files with 28 additions and 2 deletions
|
@ -68,7 +68,7 @@ final class ArcanistGoTestResultParser extends ArcanistTestResultParser {
|
|||
if (strncmp($line, 'ok', 2) === 0) {
|
||||
$meta = array();
|
||||
preg_match(
|
||||
'/^ok[\s\t]+(?P<test_name>\w.*)[\s\t]+(?P<time>.*)s.*/',
|
||||
'/^ok[\s]+(?P<test_name>\w.*)[\s]+(?:(?P<time>.*)s|\(cached\))/',
|
||||
$line,
|
||||
$meta);
|
||||
|
||||
|
@ -84,7 +84,10 @@ final class ArcanistGoTestResultParser extends ArcanistTestResultParser {
|
|||
$result = new ArcanistUnitTestResult();
|
||||
$result->setName($test_name);
|
||||
$result->setResult(ArcanistUnitTestResult::RESULT_PASS);
|
||||
$result->setDuration((float)$meta['time']);
|
||||
|
||||
if (array_key_exists('time', $meta)) {
|
||||
$result->setDuration((float)$meta['time']);
|
||||
}
|
||||
|
||||
$results[] = $result;
|
||||
} else {
|
||||
|
|
|
@ -103,6 +103,27 @@ final class ArcanistGoTestResultParserTestCase extends PhutilTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
public function testNonVerboseOutputV110() {
|
||||
$stubbed_results = Filesystem::readFile(
|
||||
dirname(__FILE__).'/testresults/go.nonverbose-go1.10');
|
||||
|
||||
$parsed_results = id(new ArcanistGoTestResultParser())
|
||||
->parseTestResults('package', $stubbed_results);
|
||||
|
||||
$this->assertEqual(2, count($parsed_results));
|
||||
$this->assertEqual(
|
||||
'Go::TestCase::package::subpackage1',
|
||||
$parsed_results[0]->getName());
|
||||
$this->assertEqual(
|
||||
'Go::TestCase::package::subpackage2',
|
||||
$parsed_results[1]->getName());
|
||||
foreach ($parsed_results as $result) {
|
||||
$this->assertEqual(
|
||||
ArcanistUnitTestResult::RESULT_PASS,
|
||||
$result->getResult());
|
||||
}
|
||||
}
|
||||
|
||||
public function testSingleTestCaseSuccessfulGo14() {
|
||||
$stubbed_results = Filesystem::readFile(
|
||||
dirname(__FILE__).'/testresults/go.single-test-case-successful-go1.4');
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ok package/subpackage1 (cached)
|
||||
ok package/subpackage2 0.010s
|
Loading…
Reference in a new issue