5 if [ -z "$TEST_SUITE" ]
7 echo "Usage : $0 <TEST_SUITE>"
12 relativescriptpath=`dirname $0`
13 TEST_HOME=$(cd $relativescriptpath/..;pwd)
15 if [ ! -f "$TEST_HOME/$TEST_SUITE" ]
17 echo "Test suite $TEST_SUITE not found"
22 if ! type vncserver 2>/dev/null
24 echo "vncserver is missing"
25 if type yum 2>/dev/null
27 yum install -y vnc-server
29 if type apt-get 2>/dev/null
31 apt-get -y install vnc4server
33 if ! type vncserver 2>/dev/null
39 if type apt-get 2>/dev/null ; then
40 apt-get -y install xfonts-base
43 [ -d "/root/.vnc" ] || mkdir /root/.vnc
45 # Setup X11 to start phpunit
46 cat > /root/.vnc/xstartup<<EOF
48 : > /root/phpunit.exitcode
49 $TEST_HOME/scripts/phpunit.sh $TEST_SUITE &> /var/log/phpunit.log &
50 echo \$! > /root/phpunit.pid
52 echo \$? > /root/phpunit.exitcode
54 chmod +x /root/.vnc/xstartup
62 # Setup ssh key and parameters
65 if ! [ -e .ssh/id_rsa.pub ] ; then
66 ssh-keygen -f .ssh/id_rsa -N ''
67 cat .ssh/id_rsa.pub >> .ssh/authorized_keys
69 if ! grep -q StrictHostKeyChecking .ssh/config ; then
70 echo StrictHostKeyChecking no >> .ssh/config
73 # Start vnc server (that will start phpunit)
76 pid=$(cat /root/phpunit.pid)
77 tail -f /var/log/phpunit.log --pid=$pid
81 retcode=$(cat /root/phpunit.exitcode)
82 vncserver -kill :1 || retcode=$?