Changeset View
Changeset View
Standalone View
Standalone View
src/unit/parser/ArcanistGoTestResultParser.php
Context not available. | |||||
* @return array | * @return array | ||||
*/ | */ | ||||
public function parseTestResults($path, $test_results) { | public function parseTestResults($path, $test_results) { | ||||
$test_results = explode("\n", $test_results); | $test_results = @explode("\n", $test_results); | ||||
$results = array(); | $results = array(); | ||||
// We'll get our full test case name at the end and add it back in | // We'll get our full test case name at the end and add it back in | ||||
Context not available. | |||||
if (strncmp($line, '--- PASS', 8) === 0) { | if (strncmp($line, '--- PASS', 8) === 0) { | ||||
// We have a passing test | // We have a passing test | ||||
$meta = array(); | $meta = array(); | ||||
preg_match( | @preg_match( | ||||
'/^--- PASS: (?P<test_name>.+) \((?P<time>.+)\s*s(?:econds?)?\).*/', | '/^--- PASS: (?P<test_name>.+) \((?P<time>.+)\s*s(?:econds?)?\).*/', | ||||
$line, | $line, | ||||
$meta); | $meta); | ||||
Context not available. | |||||
// We have a failing test | // We have a failing test | ||||
$reason = trim($test_results[$i + 1]); | $reason = trim($test_results[$i + 1]); | ||||
$meta = array(); | $meta = array(); | ||||
preg_match( | @preg_match( | ||||
'/^--- FAIL: (?P<test_name>.+) \((?P<time>.+)\s*s(?:econds?)?\).*/', | '/^--- FAIL: (?P<test_name>.+) \((?P<time>.+)\s*s(?:econds?)?\).*/', | ||||
$line, | $line, | ||||
$meta); | $meta); | ||||
Context not available. | |||||
if (strncmp($line, 'ok', 2) === 0) { | if (strncmp($line, 'ok', 2) === 0) { | ||||
$meta = array(); | $meta = array(); | ||||
preg_match( | @preg_match( | ||||
'/^ok[\s]+(?P<test_name>\w.*)[\s]+(?:(?P<time>.*)s|\(cached\))/', | '/^ok[\s]+(?P<test_name>\w.*)[\s]+(?:(?P<time>.*)s|\(cached\))/', | ||||
$line, | $line, | ||||
$meta); | $meta); | ||||
Context not available. | |||||
if (strncmp($line, "FAIL\t", 5) === 0) { | if (strncmp($line, "FAIL\t", 5) === 0) { | ||||
$meta = array(); | $meta = array(); | ||||
preg_match( | @preg_match( | ||||
'/^FAIL[\s\t]+(?P<test_name>\w.*)[\s\t]+.*/', | '/^FAIL[\s\t]+(?P<test_name>\w.*)[\s\t]+.*/', | ||||
$line, | $line, | ||||
$meta); | $meta); | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0