From 1739793a9d69897161f6b5dba720b9aa83f39ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 1 Mar 2017 10:06:02 +0100 Subject: [PATCH 1/7] Test against multiple HHVM versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #13040 Signed-off-by: Michal Čihař --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 05f516f24d..467942fef5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,9 @@ php: - "7.0" - "5.6" - "5.5" - - hhvm + - hhvm-3.3 + - hhvm-3.12 + - hhvm-3.18 sudo: false From b53ec4dc9c5fa1e11d96bbe764cc88d5a76c33b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 1 Mar 2017 11:40:22 +0100 Subject: [PATCH 2/7] Upgrade Travis to Trusty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 467942fef5..c9eb15a277 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ # - run lint for every PHP version # - run Selenium for single PHP version +dist: trusty + language: php services: From 52a5ae9bb2dfee2897bdbddf96e051f9ed52d40a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 1 Mar 2017 12:09:01 +0100 Subject: [PATCH 3/7] Force install mysql server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It does not seem to be always present on Trusty. Signed-off-by: Michal Čihař --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index c9eb15a277..22f86fc7d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,9 +85,11 @@ cache: - $HOME/runkit # Install APT packages # - git > 2.5.1 needed for worktrees +# - mysql server does not seem to be always present on Travis Trusty environment addons: apt: packages: - git + - mysql-server-5.6 sources: - git-core From 4a2af38d396665e4400f6d80df1ff46b073322a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 1 Mar 2017 12:15:13 +0100 Subject: [PATCH 4/7] Do not add git-core repo, it seems to be already there MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 22f86fc7d2..453003aefd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -91,5 +91,3 @@ addons: packages: - git - mysql-server-5.6 - sources: - - git-core From 118e139ae899720333a8f0eba76dd6478d2208ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 2 Mar 2017 10:03:04 +0100 Subject: [PATCH 5/7] Try with sudo required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to some comments in travis-ci/travis-ci#6842 this should fix the issue with MySQL server. Signed-off-by: Michal Čihař --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 453003aefd..3d853f52f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ php: - hhvm-3.12 - hhvm-3.18 -sudo: false +sudo: required env: matrix: From ce9ca7555576ff1ad64dccb445a17a335b94e86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 2 Mar 2017 10:20:22 +0100 Subject: [PATCH 6/7] Avoid skipping tests on hhvm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They seems to be quite slow on later versions, but work. Signed-off-by: Michal Čihař --- test/classes/properties/options/OptionsPropertyItemTest.php | 6 ------ test/classes/properties/plugins/PluginPropertyItemTest.php | 6 ------ 2 files changed, 12 deletions(-) diff --git a/test/classes/properties/options/OptionsPropertyItemTest.php b/test/classes/properties/options/OptionsPropertyItemTest.php index 9811d8d644..8ed3c26d6a 100644 --- a/test/classes/properties/options/OptionsPropertyItemTest.php +++ b/test/classes/properties/options/OptionsPropertyItemTest.php @@ -93,12 +93,6 @@ class OptionsPropertyItemTest extends PHPUnit_Framework_TestCase */ public function testGetPropertyType() { - if ((defined('HHVM_VERSION') - && (version_compare(constant('HHVM_VERSION'), '3.8', 'lt'))) - ) { - $this->markTestSkipped('Due to a bug in early versions of HHVM, this test cannot be completed.'); - } - $this->assertEquals( 'options', $this->stub->getPropertyType() diff --git a/test/classes/properties/plugins/PluginPropertyItemTest.php b/test/classes/properties/plugins/PluginPropertyItemTest.php index 4e578b64c5..8668822b65 100644 --- a/test/classes/properties/plugins/PluginPropertyItemTest.php +++ b/test/classes/properties/plugins/PluginPropertyItemTest.php @@ -42,12 +42,6 @@ class PluginPropertyItemTest extends PHPUnit_Framework_TestCase */ public function testGetPropertyType() { - if ((defined('HHVM_VERSION') - && (version_compare(constant('HHVM_VERSION'), '3.8', 'lt'))) - ) { - $this->markTestSkipped('Due to a bug in early versions of HHVM, this test cannot be completed.'); - } - $this->assertEquals( "plugin", $this->stub->getPropertyType() From cbcad52b0ec4941d34f24d4d77c208ff71b03413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 2 Mar 2017 10:34:28 +0100 Subject: [PATCH 7/7] List longest lasting tests from the json log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generate JSON report for tests and include it in output Signed-off-by: Michal Čihař --- .travis.yml | 1 + phpunit.xml.dist | 1 + phpunit.xml.hhvm | 1 + phpunit.xml.nocoverage | 1 + scripts/phpunit-top-tests | 26 ++++++++++++++++++++++++++ 5 files changed, 30 insertions(+) create mode 100755 scripts/phpunit-top-tests diff --git a/.travis.yml b/.travis.yml index 3d853f52f3..9f83839c60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,7 @@ after_script: - if [ -f vendor/bin/coveralls ] ; then php vendor/bin/coveralls -v || true ; fi - if [ -f vendor/bin/codacycoverage ] ; then php vendor/bin/codacycoverage clover || true ; fi - if [ -f php.log ] ; then cat php.log ; fi + - if [ -f build/logs/phpunit.json ] ; then ./scripts/phpunit-top-tests build/logs/phpunit.json ; fi after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 959ac0e46d..770a082575 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -35,6 +35,7 @@ + diff --git a/phpunit.xml.hhvm b/phpunit.xml.hhvm index 7ae089b830..956a0d5e0a 100644 --- a/phpunit.xml.hhvm +++ b/phpunit.xml.hhvm @@ -26,5 +26,6 @@ + diff --git a/phpunit.xml.nocoverage b/phpunit.xml.nocoverage index 1683df5b69..cbec556ed1 100644 --- a/phpunit.xml.nocoverage +++ b/phpunit.xml.nocoverage @@ -36,5 +36,6 @@ + diff --git a/scripts/phpunit-top-tests b/scripts/phpunit-top-tests new file mode 100755 index 0000000000..975fc11c6c --- /dev/null +++ b/scripts/phpunit-top-tests @@ -0,0 +1,26 @@ +#!/usr/bin/env python +""" +Prints 10 longest lasting tests from JSON PHPUnit log +""" + +from __future__ import print_function + +import json +import sys + +def main(filename): + with open(filename) as handle: + content = handle.read() + data = json.loads( + '[' + content.replace('}{', '},{') + ']' + ) + printed = ['test', 'status', 'time'] + tests = [item for item in data if item['event'] == 'test'] + for test in sorted(tests, key=lambda item: -item['time'])[:10]: + for item in printed: + print('{0:10s}: {1}'.format(item, test[item])) + print() + + +if __name__ == '__main__': + main(*sys.argv[1:])