diff --git a/.travis.yml b/.travis.yml index c7a952740ba6c63e044b37593c6df68247769b3b..a78315b597c498373880b147d02ddaad759fb6ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,8 @@ php: - 5.6 env: - TEST_SUITE=unit - - TEST_SUITE=integration + - TEST_SUITE=integrationPart1 + - TEST_SUITE=integrationPart2 - TEST_SUITE=integration_integrity - TEST_SUITE=static_phpcs - TEST_SUITE=static_annotation @@ -32,7 +33,7 @@ before_script: - echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini # Install MySQL 5.6, create DB for integration tests - > - sh -c "if [ '$TEST_SUITE' = 'integration' ] || [ '$TEST_SUITE' = 'integration_integrity' ]; then + sh -c "if [ '$TEST_SUITE' = 'integration_integrity' ]; then sudo apt-get remove --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5; sudo apt-get autoremove; sudo apt-get autoclean; @@ -46,14 +47,17 @@ before_script: - echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - phpenv rehash; - composer install --no-interaction --dev + - chmod +x dev/tests/integration/IntegationTestsForTravis.sh script: # Unit tests - sh -c "if [ '$TEST_SUITE' = 'unit' ]; then ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist; fi" # Integration tests - - sh -c "if [ '$TEST_SUITE' = 'integration' ]; then cd dev/tests/integration/; ./../../../vendor/bin/phpunit -c phpunit.xml.dist; fi" + - sh -c "if [ '$TEST_SUITE' = 'integrationPart1' ] || [ '$TEST_SUITE' = 'integrationPart2' ]; then cd dev/tests/integration/; bash IntegationTestsForTravis.sh 2; fi" + - sh -c "if [ '$TEST_SUITE' = 'integrationPart1' ]; then cd dev/tests/integration/; ./../../../vendor/bin/phpunit -c phpunit.xml.travis1; fi" + - sh -c "if [ '$TEST_SUITE' = 'integrationPart2' ]; then cd dev/tests/integration/; ./../../../vendor/bin/phpunit -c phpunit.xml.travis2; fi" # Integration integrity tests - sh -c "if [ '$TEST_SUITE' = 'integration_integrity' ]; then cd dev/tests/integration/; ./../../../vendor/bin/phpunit -c phpunit.xml.dist testsuite/Magento/Test/Integrity; fi" # Static tests [Code Style] - sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testCodeStyle'; fi" # Static tests [Code Style] - - sh -c "if [ '$TEST_SUITE' = 'static_annotation' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testAnnotationStandard'; fi" + - sh -c "if [ '$TEST_SUITE' = 'static_annotation' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testAnnotationStandard'; fi" \ No newline at end of file diff --git a/dev/tests/integration/IntegationTestsForTravis.sh b/dev/tests/integration/IntegationTestsForTravis.sh new file mode 100644 index 0000000000000000000000000000000000000000..f689a7e321ed20ed2ee42b5f3725a8b7e404d4bd --- /dev/null +++ b/dev/tests/integration/IntegationTestsForTravis.sh @@ -0,0 +1,58 @@ +#usr/bin/bash + +#get number of files in directory +NUMBER_OF_SUITES=$1 +FOLDERSIZE=$(find ./testsuite/Magento/ -maxdepth 1 -type d|wc -l) +FOLDERSIZE=$((FOLDERSIZE/NUMBER_OF_SUITES)) + +#get folders +FOLDERS=$(ls "./testsuite/Magento") + +#mysql 5.6 +sudo apt-get remove --purge mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5; +sudo apt-get autoremove; +sudo apt-get autoclean; +sudo apt-add-repository ppa:ondrej/mysql-5.6 -y; +sudo apt-get update; +sudo apt-get install mysql-server-5.6 mysql-client-5.6; + +#create n testsuites and n databases +i=0 +for i in `seq 1 $NUMBER_OF_SUITES` +do + cp phpunit.xml.dist phpunit.xml.travis$i + perl -pi -e "s/<directory suffix=\"Test.php\">testsuite<\/directory>//g" phpunit.xml.travis$i + cp etc/install-config-mysql.php.dist etc/install-config-mysql$i.php + mysql -uroot -e "SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION; create database magento_integration_tests${i}"; +done + +#replace Memory Usage Tests in all except testsuite 1 +for i in `seq 2 $NUMBER_OF_SUITES` +do + perl -pi -e 's/<!-- Memory tests run first to prevent influence of other tests on accuracy of memory measurements -->//g' phpunit.xml.travis$i + perl -pi -e 's/<testsuite name="Memory Usage Tests">//g' phpunit.xml.travis$i + perl -pi -e 's/<file>testsuite\/Magento\/MemoryUsageTest.php<\/file>//g' phpunit.xml.travis$i + perl -pi -e 's/<\/testsuite>//g' phpunit.xml.travis$i + perl -pi -e "s/<\/testsuites>/<\/testsuite><\/testsuites>/g" phpunit.xml.travis$i +done + +#create list of folders on which tests are to be run +i=0 +j=1 +for FOLDER in $FOLDERS +do + FILE[j]+="\n<directory suffix=\"Test.php\">testsuite\/Magento\/${FOLDER}<\/directory>" + i=$((i+1)) + if [ "$i" -eq "$FOLDERSIZE" ] && [ "$j" -ne "$NUMBER_OF_SUITES" ]; then + j=$((j+1)) + i=0 + fi +done + +# finally replacing in config files. +for i in `seq 1 $NUMBER_OF_SUITES` +do + perl -pi -e "s/<directory suffix=\"Test.php\">..\/..\/..\/update\/dev\/tests\/integration\/testsuite<\/directory>/${FILE[i]}/g" phpunit.xml.travis$i + perl -pi -e "s/magento_integration_tests/magento_integration_tests${i}/g" etc/install-config-mysql${i}.php + perl -pi -e "s/etc\/install-config-mysql.php/etc\/install-config-mysql${i}.php/g" phpunit.xml.travis$i +done \ No newline at end of file