minor #16225 [appveyor] fix ini matrix race conditions (nicolas-grekas)

This PR was merged into the 2.3 branch.

Discussion
----------

[appveyor] fix ini matrix race conditions

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

8e59d4a [appveyor] fix ini matrix race conditions
This commit is contained in:
Nicolas Grekas 2015-10-13 18:03:19 +02:00
commit 84f6b30147
2 changed files with 9 additions and 20 deletions

View File

@ -13,7 +13,6 @@ init:
- SET SYMFONY_DEPRECATIONS_HELPER=weak
- SET PHP=1
- SET ANSICON=121x90 (121x90)
- SET PHP_INI_MATRIX=php.ini-min php.ini-max
- SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped
install:
@ -56,4 +55,9 @@ install:
test_script:
- cd c:\projects\symfony
- php phpunit symfony --exclude-group benchmark,intl-data
- SET X=0
- copy /Y c:\php\php.ini-min c:\php\php.ini
- php phpunit symfony --exclude-group benchmark,intl-data || SET X=1
- copy /Y c:\php\php.ini-max c:\php\php.ini
- php phpunit symfony --exclude-group benchmark,intl-data || SET X=1
- exit %X%

21
phpunit
View File

@ -76,22 +76,10 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) {
$cmd[0] = sprintf('%s %s --colors=always', $PHP, ProcessUtils::escapeArgument("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit"));
$cmd = str_replace('%', '%%', implode(' ', $cmd)).' %1$s';
$phpIniMatrix = isset($_SERVER['PHP_INI_MATRIX']) ? explode(' ', $_SERVER['PHP_INI_MATRIX']) : array();
if ($phpIniMatrix) {
if ('\\' !== DIRECTORY_SEPARATOR) {
echo "Error: PHP_INI_MATRIX is a Windows-only feature.\n";
exit(1);
}
$phpDir = ProcessUtils::escapeArgument(dirname(`where.exe php`));
$newCmd = 'cmd /v:on /d /c "(SET X=0';
foreach ($phpIniMatrix as $iniFile) {
$newCmd .= " & copy /Y $phpDir\\$iniFile $phpDir\\php.ini & echo. & echo Running tests with $iniFile: & ($cmd || SET X=1)";
}
$cmd = $newCmd .= ' & exit !X!)%2$s"';
if ('\\' === DIRECTORY_SEPARATOR) {
$cmd = 'cmd /v:on /d /c "('.$cmd.')%2$s"';
} else {
$cmd .= ' %2$s';
$cmd .= '%2$s';
}
if (isset($argv[1]) && 'symfony' === $argv[1]) {
@ -168,9 +156,6 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) {
}
unlink($file);
}
if ($skippedTests) {
@unlink("$component/$skippedTests");
}
if ($procStatus) {
$exit = 1;