From 9829ab7ff07f30067772c6a0458d223fd995a4e7 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Fri, 31 Jan 2020 22:34:32 +0100 Subject: [PATCH 1/3] Test PHP 7.4 on Travis CI --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9cd7032..22aa40b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ php: - 7.1 - 7.2 - 7.3 + - 7.4 - hhvm # ignore errors, see below # lock distro so new future defaults will not break the build From be2544a5dec1ebaa6978f0dd494d68c893b653e3 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Fri, 31 Jan 2020 22:54:02 +0100 Subject: [PATCH 2/3] Update PHPUnit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1fdaddd..cfe99ee 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,6 @@ "react/promise": "^2.7.0 || ^1.2.1" }, "require-dev": { - "phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35" } } From 32f2188dc3c13912187204e55330a567df1acee0 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sat, 22 Feb 2020 22:58:10 +0100 Subject: [PATCH 3/3] 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. --- .travis.yml | 3 ++- tests/FunctionRejectTest.php | 8 ++++++++ tests/FunctionResolveTest.php | 8 ++++++++ tests/FunctionTimeoutTest.php | 24 ++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 22aa40b..5fd9922 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,4 +26,5 @@ install: - composer install --no-interaction script: - - vendor/bin/phpunit --coverage-text + - ./vendor/bin/phpunit -v + - ./vendor/bin/phpunit -v --coverage-text --coverage-clover=./build/logs/clover.xml diff --git a/tests/FunctionRejectTest.php b/tests/FunctionRejectTest.php index dbbff3d..30d42de 100644 --- a/tests/FunctionRejectTest.php +++ b/tests/FunctionRejectTest.php @@ -53,6 +53,10 @@ public function testWaitingForPromiseToRejectDoesNotLeaveGarbageCycles() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = Timer\reject(0.01, $this->loop); @@ -68,6 +72,10 @@ public function testCancellingPromiseDoesNotLeaveGarbageCycles() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = Timer\reject(0.01, $this->loop); diff --git a/tests/FunctionResolveTest.php b/tests/FunctionResolveTest.php index c4e2be7..155e82b 100644 --- a/tests/FunctionResolveTest.php +++ b/tests/FunctionResolveTest.php @@ -75,6 +75,10 @@ public function testWaitingForPromiseToResolveDoesNotLeaveGarbageCycles() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = Timer\resolve(0.01, $this->loop); @@ -90,6 +94,10 @@ public function testCancellingPromiseDoesNotLeaveGarbageCycles() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = Timer\resolve(0.01, $this->loop); diff --git a/tests/FunctionTimeoutTest.php b/tests/FunctionTimeoutTest.php index 9652d1a..0c7378d 100644 --- a/tests/FunctionTimeoutTest.php +++ b/tests/FunctionTimeoutTest.php @@ -176,6 +176,10 @@ public function testWaitingForPromiseToResolveBeforeTimeoutDoesNotLeaveGarbageCy $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = Timer\resolve(0.01, $this->loop); @@ -194,6 +198,10 @@ public function testWaitingForPromiseToRejectBeforeTimeoutDoesNotLeaveGarbageCyc $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = Timer\reject(0.01, $this->loop); @@ -212,6 +220,10 @@ public function testWaitingForPromiseToTimeoutDoesNotLeaveGarbageCycles() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = new \React\Promise\Promise(function () { }, function () { @@ -232,6 +244,10 @@ public function testWaitingForPromiseToTimeoutWithoutCancellerDoesNotLeaveGarbag $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = new \React\Promise\Promise(function () { }); @@ -250,6 +266,10 @@ public function testWaitingForPromiseToTimeoutWithNoOpCancellerDoesNotLeaveGarba $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = new \React\Promise\Promise(function () { }, function () { @@ -270,6 +290,10 @@ public function testCancellingPromiseDoesNotLeaveGarbageCycles() $this->markTestSkipped('Not supported on legacy Promise v1 API'); } + if ($this->getTestResultObject()->getCollectCodeCoverageInformation() === true) { + $this->markTestSkipped('This test has memory leaks when code coverage is collected'); + } + gc_collect_cycles(); $promise = new \React\Promise\Promise(function () { }, function () {