8000 Run tests twice, once with, and once without coverage · reactphp/promise-timer@d10e897 · GitHub
[go: up one dir, main page]

Skip to content

Commit d10e897

Browse files
committed
Run tests twice, once with, and once without coverage
We're doing this because certain tests have memory leaks only when code coverage is collected.
1 parent be2544a commit d10e897

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ install:
2626
- composer install --no-interaction
2727

2828
script:
29-
- vendor/bin/phpunit --coverage-text
29+
- ./vendor/bin/phpunit -v
30+
- ./vendor/bin/phpunit -v --coverage-text --coverage-clover=./build/logs/clover.xml

tests/FunctionRejectTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public function testWaitingForPromiseToRejectDoesNotLeaveGarbageCycles()
5353
$this->markTestSkipped('Not supported on legacy Promise v1 API');
5454
}
5555

56+
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
57+
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
58+
}
59+
5660
gc_collect_cycles();
5761

5862
$promise = Timer\reject(0.01, $this->loop);
@@ -68,6 +72,10 @@ public function testCancellingPromiseDoesNotLeaveGarbageCycles()
6872
$this->markTestSkipped('Not supported on legacy Promise v1 API');
6973
}
7074

75+
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
76+
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
77+
}
78+
7179
gc_collect_cycles();
7280

7381
$promise = Timer\reject(0.01, $this->loop);

tests/FunctionResolveTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ public function testWaitingForPromiseToResolveDoesNotLeaveGarbageCycles()
7575
$this->markTestSkipped('Not supported on legacy Promise v1 API');
7676
}
7777

78+
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
79+
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
80+
}
81+
7882
gc_collect_cycles();
7983

8084
$promise = Timer\resolve(0.01, $this->loop);
@@ -90,6 +94,10 @@ public function testCancellingPromiseDoesNotLeaveGarbageCycles()
9094
$this->markTestSkipped('Not supported on legacy Promise v1 API');
9195
}
9296

97+
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
98+
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
99+
}
100+
93101
gc_collect_cycles();
94102

95103
$promise = Timer\resolve(0.01, $this->loop);

tests/FunctionTimeoutTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ public function testWaitingForPromiseToResolveBeforeTimeoutDoesNotLeaveGarbageCy
176176
$this->markTestSkipped('Not supported on legacy Promise v1 API');
177177
}
178178

179+
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
180+
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
181+
}
182+
179183
gc_collect_cycles();
180184

181185
$promise = Timer\resolve(0.01, $this->loop);
@@ -194,6 +198,10 @@ public function testWaitingForPromiseToRejectBeforeTimeoutDoesNotLeaveGarbageCyc
194198
$this->markTestSkipped('Not supported on legacy Promise v1 API');
195199
}
196200

201+
if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) {
202+
$this->markTestSkipped('This test has memory leaks when code coverage is collected');
203+
}
204+
197205
gc_collect_cycles();
198206

199207
$promise = Timer\reject(0.01, $this->loop);

0 commit comments

Comments
 (0)
0