diff --git a/src/unit/parser/ArcanistGoTestResultParser.php b/src/unit/parser/ArcanistGoTestResultParser.php --- a/src/unit/parser/ArcanistGoTestResultParser.php +++ b/src/unit/parser/ArcanistGoTestResultParser.php @@ -25,7 +25,42 @@ // Temp store for test case results (in case we run multiple test cases) $test_case_results = array(); - foreach ($test_results as $i => $line) { + for ($i = 0; $i < count($test_results); $i++) { + $line = $test_results[$i]; + + if (strncmp($line, '=== RUN', 6) === 0) { + if (strncmp($test_results[$i + 1], '==================', 19) === 0 + && strncmp($test_results[$i + 2], 'WARNING: DATA RACE', 19) === 0) { + // We have a race condition + $i += 2; // Advance to the first goroutine + $reason = ''; + + // loop to collect all data + while (strncmp($test_results[$i], '==================', 19) !== 0) { + $reason .= $test_results[$i++]."\n"; + } + + // We are at ====... advance one line. + $line = $test_results[++$i]; + + // Collect the test name + $meta = array(); + preg_match( + '/^--- PASS: (?P.+) \((?P