8000 [Process] Fix volatile test · symfony/symfony@af4cc8d · GitHub
[go: up one dir, main page]

Skip to content

Commit af4cc8d

Browse files
[Process] Fix volatile test
1 parent 347b17e commit af4cc8d

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ install:
4545
script:
4646
- if [ "$deps" = "no" ]; then echo "$components" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
4747
- if [ "$deps" = "no" ]; then echo -e "\\nRunning tests requiring tty"; phpunit --group tty || (echo -e "\\e[41mKO\\e[0m tty group" && $(exit 1)); fi;
48-
- if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
49-
- if [ "$deps" = "low" ]; then echo "$components" | parallel --gnu --keep-order -j25% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
48+
- if [ "$deps" = "high" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
49+
- if [ "$deps" = "low" ]; then echo "$components" | parallel --gnu --keep-order -j10% 'echo -e "\\nRunning {} tests"; cd {}; composer --prefer-source --prefer-lowest --prefer-stable update; phpunit --exclude-group tty,benchmark,intl-data || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;

src/Symfony/Component/Process/Tests/AbstractProcessTest.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,6 @@ public function testCheckTimeoutOnStartedProcess()
800800
$this->assertFalse($process->isSuccessful());
801801
}
802802

803-
/**
804-
* @group idle-timeout
805-
*/
806803
public function testIdleTimeout()
807804
{
808805
$process = $this->getProcess('php -r "sleep(3);"');
@@ -820,21 +817,18 @@ public function testIdleTimeout()
820817
}
821818
}
822819

823-
/**
824-
* @group idle-timeout
825-
*/
826820
public function testIdleTimeoutNotExceededWhenOutputIsSent()
827821
{
828-
$process = $this->getProcess('php -r "echo \'foo\'; sleep(1); echo \'foo\'; sleep(1); echo \'foo\'; sleep(1); "');
822+
$process = $this->getProcess(sprintf('php -r %s', escapeshellarg('$n = 30; while ($n--) {echo "foo\n"; usleep(100000); }')));
829823
$process->setTimeout(2);
830-
$process->setIdleTimeout(1.5);
824+
$process->setIdleTimeout(1);
831825

832826
try {
833827
$process->run();
834828
$this->fail('A timeout exception was expected.');
835829
} catch (ProcessTimedOutException $ex) {
836-
$this->assertTrue($ex->isGeneralTimeout());
837-
$this->assertFalse($ex->isIdleTimeout());
830+
$this->assertTrue($ex->isGeneralTimeout(), 'A general timeout is expected.');
831+
$this->assertFalse($ex->isIdleTimeout(), 'No idle timeout is expected.');
838832
$this->assertEquals(2, $ex->getExceededTimeout());
839833
}
840834
}

src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public function testDuration()
7676
$event->start();
7777
usleep(100000);
7878
$event->stop();
79+
usleep(50000);
7980
$event->start();
8081
usleep(100000);
8182
$event->stop();
@@ -93,6 +94,7 @@ public function testDurationBeforeStop()
9394
$event->start();
9495
usleep(100000);
9596
$event->stop();
97+
usleep(50000);
9698
$event->start();
9799
usleep(100000);
98100
$this->assertEquals(100, $event->getDuration(), null, self::DELTA);

0 commit comments

Comments
 (0)
0