function writeResultsPerTest()

in agent/extension_phpt_test/scripts/processResults.php [54:109]


function writeResultsPerTest($output, $stats, $testsAllowedToFail, $unexpectedFailures, $segfaults, $baseline)
{
	fwrite($output, "| Status | Test result | count |" . PHP_EOL);
	fwrite($output, "| --- | --- | --- |" . PHP_EOL);
	foreach ($stats as $res => $cnt) {
		fwrite($output, "|  | " . $res . " | " . $cnt . " |" . PHP_EOL);
	}
	fwrite($output, "| " . (count($segfaults) > 0 ? ":x:" : ":heavy_check_mark:") . " | Segmentation faults | " . count($segfaults) . " |" . PHP_EOL);
	fwrite($output, "|  | Tests allowed to fail | " . count($testsAllowedToFail) . " |" . PHP_EOL);
	fwrite($output, "| " . (count($unexpectedFailures) > 0 ? ":warning:" : ":heavy_check_mark:") . " | Unexpected test failures (without baseline) | " . count($unexpectedFailures) . " |" . PHP_EOL);

	$afterBaselineFailures = [];
	$afterBaselineFailures = getUnexpectedFailures($baseline, $unexpectedFailures);
	fwrite($output, "|  | Size of baseline list | " . count($baseline) . " |" . PHP_EOL);
	fwrite($output, "| " . (count($afterBaselineFailures) > 0 ? ":x:" : ":heavy_check_mark:") . " | Unexpected test failures (above baseline) | " . count($afterBaselineFailures) . " |" . PHP_EOL);

	fwrite($output, PHP_EOL);

	if (count($segfaults) > 0) {
		fwrite($output, "#### Tests with segmentation faults" . PHP_EOL);

		fwrite($output, "```" . PHP_EOL);
		foreach ($segfaults as $res) {
			fwrite($output, $res . PHP_EOL);
		}
		fwrite($output, "```" . PHP_EOL);
	}

	$retval = [];

	if (count($afterBaselineFailures) > 0) {
		fwrite($output, "#### Tests which failed and was above baseline and allowed to fail list" . PHP_EOL);

		fwrite($output, "```" . PHP_EOL);
		foreach ($afterBaselineFailures as $res) {
			fwrite($output, $res . PHP_EOL);
		}
		fwrite($output, "```" . PHP_EOL);

		$retval[] = "unexpected test failures even after supression";
	}

	if (count($segfaults) > 0) {
		$retval[] = count($segfaults) . " segmentation faults occurred";
	}

	fwrite($output, PHP_EOL);

	if (count($retval) > 0) {
		fwrite($output, "### :x: Test failed because " . implode(" and ", $retval) . PHP_EOL);
	} else {
		fwrite($output, "### :white_check_mark: Test passed" . PHP_EOL);
	}

	return count($retval) == 0;
}