Created
July 15, 2014 14:45
-
-
Save foertel/7fff3b95e72a429c01fa to your computer and use it in GitHub Desktop.
TYPO3 Functional Tests in Ram
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script will | |
# * fire up a ramdisk | |
# * start a mysql server using it as storage | |
# * copying your typo3 database to ram | |
# * run the tests | |
# * clean up | |
# | |
# use -k as parameter to clean-up after a failed run | |
# use -e as parameter to only run extbase tests | |
# | |
# Why? | |
# It's blazing fast ... | |
# | |
# Time: 05:01 | |
# Tests: 276, Assertions: 2879, Incomplete: 23, Skipped: 21. | |
# | |
# by Felix Oertel <[email protected]> | |
# public domain | |
# if you wanna make your own version, please make it obvious that you messed around with my code. ;-) | |
# | |
startMysqlServer() | |
{ | |
sudo mkdir /tmp/typo3ramdisk | |
sudo mount -t tmpfs -o size=512M tmpfs /tmp/typo3ramdisk | |
sudo chmod -R 700 /tmp/typo3ramdisk | |
sudo chown -R mysql:mysql /tmp/typo3ramdisk | |
sudo mysqld_safe --port=3307 --socket="/var/run/mysqld/mysqld-testing.sock" --user mysql --pid-file="/var/run/mysqld/mysqld-testing.pid" --datadir="/tmp/typo3ramdisk" --skip-grant-tables & | |
while [ ! -S /var/run/mysqld/mysqld-testing.sock ] | |
do | |
sleep 1 | |
done | |
sudo ln -sf /var/run/mysqld/mysqld-testing.sock /var/www/typo3-cms/dev/htdocs/typo3.sock | |
mysqldump -u root -S /var/run/mysqld/mysqld.sock --databases typo3-cms_master | mysql -u root -S /var/run/mysqld/mysqld-testing.sock | |
} | |
stopMysqlServer() | |
{ | |
if [ -f /var/run/mysqld/mysqld-testing.pid ] | |
then | |
sudo ln -sf /var/run/mysqld/mysqld.sock /var/www/typo3-cms/dev/htdocs/typo3.sock | |
sudo kill `sudo cat /var/run/mysqld/mysqld-testing.pid` | |
while [ -f /var/run/mysqld/mysqld-testing.pid ] | |
do | |
sleep 1 | |
done | |
fi | |
sudo umount /tmp/typo3ramdisk | |
sudo rm -rf /tmp/typo3ramdisk | |
} | |
runTestCases() | |
{ | |
startMysqlServer | |
cd /var/www/typo3-cms/dev/htdocs | |
rm -rf typo3temp/functional-* | |
case $runTestCasesFrom in | |
'extbase') | |
# ./typo3conf/ext/phpunit/Composer/vendor/bin/phpunit --process-isolation --bootstrap typo3/sysext/core/Build/FunctionalTestsBootstrap.php typo3/sysext/extbase/Tests/Functional/Persistence | |
#./typo3conf/ext/phpunit/Composer/vendor/bin/phpunit --bootstrap typo3/sysext/core/Build/FunctionalTestsBootstrap.php typo3/sysext/extbase/Tests/Functional/Persistence | |
time find typo3/sysext/extbase/ -name '*Test.php' | grep Functional | parallel --gnu 'echo; echo "Running functional {} tests"; ./bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml {}' | |
;; | |
'all') | |
time find typo3/sysext/ -name '*Test.php' | grep Functional | parallel --gnu 'echo; echo "Running functional {} tests"; ./bin/phpunit -c typo3/sysext/core/Build/FunctionalTests.xml {}' | |
;; | |
esac | |
stopMysqlServer | |
} | |
runTestCasesFrom=all | |
while getopts "ke" option | |
do | |
case $option in | |
'k') | |
stopMysqlServer | |
exit 1 | |
;; | |
'e') | |
runTestCasesFrom=extbase | |
;; | |
esac | |
done | |
runTestCases |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment