UNPKG

967 Bapplication/x-shView Raw
1#!/bin/bash
2
3# sanity check to make sure phantomjs exists in the PATH
4hash /usr/bin/env phantomjs &> /dev/null
5if [ $? -eq 1 ]; then
6 echo "ERROR: phantomjs is not installed"
7 echo "Please visit http://www.phantomjs.org/"
8 exit 1
9fi
10
11# sanity check number of args
12if [ $# -lt 1 ]
13then
14 echo "Usage: `basename $0` path_to_runner.html"
15 echo
16 exit 1
17fi
18
19SCRIPTDIR=$(dirname `perl -e 'use Cwd "abs_path";print abs_path(shift)' $0`)
20TESTFILE=""
21while (( "$#" )); do
22 if [ ${1:0:7} == "http://" -o ${1:0:8} == "https://" ]; then
23 TESTFILE="$TESTFILE $1"
24 else
25 TESTFILE="$TESTFILE `perl -e 'use Cwd "abs_path";print abs_path(shift)' $1`"
26 fi
27 shift
28done
29
30# cleanup previous test runs
31cd $SCRIPTDIR
32rm -f *.xml
33
34# make sure phantomjs submodule is initialized
35cd ..
36git submodule update --init
37
38# fire up the phantomjs environment and run the test
39cd $SCRIPTDIR
40/usr/bin/env phantomjs $SCRIPTDIR/phantomjs-testrunner.js $TESTFILE