Skip to content

Commit c65e387

Browse files
committed
Save results cache files to log folder for later analysis
Bug: T378797 Change-Id: I3f0177e85d71dd5c1526cdd42fbee69d8d1f6eca
1 parent 8300b64 commit c65e387

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ node_modules/
5656
/resources/lib/.foreign
5757
/tests/phpunit/phpunit.phar
5858
.phpunit.result.cache
59+
phpunit*result.cache
5960
/tests/phpunit/.phpunit.result.cache
6061
phpunit.xml
6162
/tests/selenium/log

Diff for: includes/composer/ComposerLaunchParallel.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,20 @@ protected function prepareEnvironment() {
108108
}
109109

110110
private function runTestSuite( int $groupId ) {
111+
$logDir = getenv( 'MW_LOG_DIR' ) ?? '.';
111112
$excludeGroups = array_diff( $this->excludeGroups, $this->groups );
112113
$groupName = "database";
113114
if ( !self::isDatabaseRunForGroups( $this->groups, $excludeGroups ) ) {
114115
$groupName = "databaseless";
115116
}
117+
$resultCacheFile = implode( DIRECTORY_SEPARATOR, [
118+
$logDir, "phpunit_group_{$groupId}_{$groupName}.result.cache"
119+
] );
116120
$result = $this->splitGroupExecutor->executeSplitGroup(
117121
"split_group_$groupId",
118122
$this->groups,
119123
$excludeGroups,
120-
".phpunit_group_{$groupId}_{$groupName}.result.cache",
124+
$resultCacheFile,
121125
$groupId
122126
);
123127
$consoleOutput = $result->getStdout();

Diff for: tests/phpunit/unit/includes/composer/ComposerLaunchParallelTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ private function getMockSystemInterface( string $logFileName ): ComposerSystemIn
4444
}
4545

4646
public function testExecuteDatabaseSuite() {
47+
$logDir = getenv( 'MW_LOG_DIR' ) ?? '.';
4748
$executor = $this->createMock( SplitGroupExecutor::class );
4849
$systemInterface = $this->getMockSystemInterface( 'phpunit_output_1_database.log' );
4950
$composerLaunchParallel = new ComposerLaunchParallel(
@@ -59,7 +60,7 @@ public function testExecuteDatabaseSuite() {
5960
->with( 'split_group_1',
6061
[ 'Database' ],
6162
[ 'Broken' ],
62-
".phpunit_group_1_database.result.cache",
63+
$logDir . "/phpunit_group_1_database.result.cache",
6364
1
6465
)
6566
->willReturn( $result );
@@ -68,6 +69,7 @@ public function testExecuteDatabaseSuite() {
6869
}
6970

7071
public function testExecuteDatabaselessSuite() {
72+
$logDir = getenv( 'MW_LOG_DIR' ) ?? '.';
7173
$executor = $this->createMock( SplitGroupExecutor::class );
7274
$systemInterface = $this->getMockSystemInterface( 'phpunit_output_1_databaseless.log' );
7375
$composerLaunchParallel = new ComposerLaunchParallel(
@@ -83,7 +85,7 @@ public function testExecuteDatabaselessSuite() {
8385
->with( 'split_group_1',
8486
[],
8587
[ 'Broken', 'Standalone', 'Database' ],
86-
".phpunit_group_1_databaseless.result.cache",
88+
$logDir . "/phpunit_group_1_databaseless.result.cache",
8789
1
8890
)
8991
->willReturn( $result );

0 commit comments

Comments
 (0)