export BUILDRESULT=$WORKSPACE/build/packages
+
# Create place to build package if necessary
-[ ! -d $WORKSPACE/build/packages ] || mkdir -p $WORKSPACE/build/packages
+if [ ! -d $WORKSPACE/build/packages ]
+then
+ mkdir -p $WORKSPACE/build/packages
+else
+ # Clean only old fusionforge packages
+ rm -f $WORKSPACE/build/packages/fusionforge*rpm || true
+fi
# Erase config
[ ! -d $WORKSPACE/build/config ] || rm -fr $WORKSPACE/build/config
JOB_NAME=$JOB_NAME
EOF
scp -r $WORKSPACE/build/config root@$HOST:/root/
-rsync -a 3rd-party/selenium/binary/selenium-server-current/selenium-server.jar root@$HOST:/root/selenium-server.jar
+rsync -a 3rd-party/selenium/selenium-server.jar root@$HOST:/root/selenium-server.jar
rsync -a --delete tests/ root@$HOST:/root/tests/
echo "Run phpunit test on $HOST"
-if xterm -e "sh -c exit" 2>/dev/null
+if $REMOTESELENIUM
then
- ssh -X root@$HOST "cd /root; ./tests/scripts/phpunit.sh TarCentos52Tests.php" || retcode=$?
+ ssh root@$HOST "yum install -y vnc-server ; mkdir -p /root/.vnc"
+ ssh root@$HOST "cat > /root/.vnc/xstartup ; chmod +x /root/.vnc/xstartup" <<EOF
+#! /bin/bash
+: > /root/phpunit.exitcode
+/root/tests/scripts/phpunit.sh TarCentos52Tests.php &> /var/log/phpunit.log &
+echo \$! > /root/phpunit.pid
+wait %1
+echo \$? > /root/phpunit.exitcode
+EOF
+ ssh root@$HOST vncpasswd <<EOF
+password
+password
+EOF
+ ssh root@$HOST "vncserver :1"
+ sleep 5
+ pid=$(ssh root@$HOST cat /root/phpunit.pid)
+ ssh root@$HOST "tail -f /var/log/phpunit.log --pid=$pid"
+ sleep 5
+ retcode=$(ssh root@$HOST cat /root/phpunit.exitcode)
+ ssh root@$HOST "vncserver -kill :1" || retcode=$?
else
echo "No display is available, NOT RUNNING TESTS"
retcode=2