Eliminate noise while filtering parserTests

Follow up to I854f89bd823aab297efe29cd4fdee675afd77752

Returns the behaviour to what it was before that patch.

Change-Id: I743fa1118c4c78863f3857f4dc70d82f6bf4f0ac
This commit is contained in:
Arlo Breault 2023-04-13 19:09:39 -04:00
parent 97d5377ea3
commit ddb49b3d82

View file

@ -158,6 +158,9 @@ class ParserTestRunner {
*/
public const DB_PREFIX = 'parsertest_';
/** @var string */
private const FILTER_MSG = "Test doesn't match filter";
/**
* Compute the set of valid test runner modes
*
@ -908,9 +911,11 @@ class ParserTestRunner {
// Run tests
foreach ( $testFileInfo->testCases as $test ) {
$skipMessage = $this->getTestSkipMessage( $test, !$inParsoidMode );
if ( $skipMessage ) {
$this->recorder->startTest( $test, $skipMode );
$this->recorder->skipped( $test, $skipMode, $skipMessage );
if ( $skipMessage !== null ) {
if ( $skipMessage !== self::FILTER_MSG ) {
$this->recorder->startTest( $test, $skipMode );
$this->recorder->skipped( $test, $skipMode, $skipMessage );
}
continue;
}
@ -1010,6 +1015,10 @@ class ParserTestRunner {
public function getTestSkipMessage( ParserTest $test, bool $isLegacy ): ?string {
$opts = $test->options;
if ( !$test->matchesFilter( [ 'regex' => $this->regex ] ) ) {
return self::FILTER_MSG;
}
// Skip deprecated preprocessor tests
if ( isset( $opts['preprocessor'] ) && $opts['preprocessor'] !== 'Preprocessor_Hash' ) {
wfDeprecated( 'preprocessor=Preprocessor_DOM', '1.36' );
@ -1025,9 +1034,7 @@ class ParserTestRunner {
if ( isset( $opts['disabled'] ) && !$this->runDisabled ) {
return "Test disabled";
}
if ( !$test->matchesFilter( [ 'regex' => $this->regex ] ) ) {
return "Test doesn't match filter";
}
// Skip parsoid-only tests if running in a legacy test mode
if (
$test->legacyHtml === null &&
@ -1361,7 +1368,12 @@ class ParserTestRunner {
* @return ParserTestResult The test results.
*/
public function runTest( ParserTest $test, ParserTestMode $mode ): ParserTestResult {
if ( $this->getTestSkipMessage( $test, $mode->isLegacy() ) ) {
$skipMessage = $this->getTestSkipMessage( $test, $mode->isLegacy() );
if ( $skipMessage !== null ) {
if ( $skipMessage !== self::FILTER_MSG ) {
$this->recorder->startTest( $test, $mode );
$this->recorder->skipped( $test, $mode, $skipMessage );
}
return new ParserTestResult( $test, $mode, 'SKIP', 'SKIP' );
}
return $this->runTestInternal( $test, $mode );