-
-
Save garbast/9485846 to your computer and use it in GitHub Desktop.
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 <typo3@foertel.com> | |
# public domain | |
# | |
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/run/mysqld/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/run/mysqld/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 | |
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 | |
;; | |
'all') | |
./typo3conf/ext/phpunit/Composer/vendor/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