From 68cce096e66c8c112493096cbb575b5353f77e8f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 14 Jun 2013 14:22:50 +0200 Subject: [PATCH] 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 --- test/frontend/runtests | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/test/frontend/runtests b/test/frontend/runtests index d15c69de3..fac841d18 100755 --- a/test/frontend/runtests +++ b/test/frontend/runtests @@ -8,6 +8,7 @@ CASPER=$(which casperjs) INCLUDE="" EXCLUDE="" VERBOSE=0 +VAGRANT=0 BUILD=0 if [ ! -x $CASPER ]; then @@ -29,18 +30,21 @@ for arg in $@;do continue fi; case $arg in - --verbose) + -v|--verbose) VERBOSE=1 ;; - --include) + -V|--vagrant) + VAGRANT=1 + ;; + -i|--include) PARAM="INCLUDE" continue ;; - --exclude) + -e|--exclude) PARAM="EXCLUDE" continue ;; - --build) + -b|--build) BUILD=1 continue ;; @@ -59,6 +63,27 @@ for arg in $@;do esac; 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" #