Add --vagrant switch to the frontend test-runner

Added -V|--vagrant switch to the frontend test-runner
to run the tests in the Vagrant VM

refs #4264
This commit is contained in:
Johannes Meyer 2013-06-14 14:22:50 +02:00
parent 2132628b7e
commit 68cce096e6

View File

@ -8,6 +8,7 @@ CASPER=$(which casperjs)
INCLUDE="" INCLUDE=""
EXCLUDE="" EXCLUDE=""
VERBOSE=0 VERBOSE=0
VAGRANT=0
BUILD=0 BUILD=0
if [ ! -x $CASPER ]; then if [ ! -x $CASPER ]; then
@ -29,18 +30,21 @@ for arg in $@;do
continue continue
fi; fi;
case $arg in case $arg in
--verbose) -v|--verbose)
VERBOSE=1 VERBOSE=1
;; ;;
--include) -V|--vagrant)
VAGRANT=1
;;
-i|--include)
PARAM="INCLUDE" PARAM="INCLUDE"
continue continue
;; ;;
--exclude) -e|--exclude)
PARAM="EXCLUDE" PARAM="EXCLUDE"
continue continue
;; ;;
--build) -b|--build)
BUILD=1 BUILD=1
continue continue
;; ;;
@ -59,6 +63,27 @@ for arg in $@;do
esac; esac;
done; done;
#
# If vagrant is set the tests are ran in the vagrant VM
#
if [ $VAGRANT -eq 1 ] && [ $USER != "vagrant" ]; then
# Check if vagrant is installed
if [ ! -n `which vagrant` ]; then
echo "Vagrant is not installed on your system!"
exit 1
fi
# Call the script in the Vagrant VM with the same parameters
vagrant ssh -c "/vagrant/test/frontend/runtests $@"
exit $?
fi
if [ "$CASPER" = "" -o ! -x $CASPER ]; then
echo "CasperJS is not installed but required to run frontend tests\n"\
"Take a look at http://casperjs.org/installation.html to see how the installation works for your system"
exit 1
fi;
EXEC="$CASPER test" EXEC="$CASPER test"
# #