# get config
. tests/config/default
if [ -f tests/config/`hostname` ] ; then . tests/config/`hostname`; fi
+if [ ! -z "$1" ]
+then
+ export HOST="$1"
+else
+ export HOST=centos5.$DNSDOMAIN
+ export VEID=$VEIDCOS
+fi
-export VEID=$VEIDCOS
export LXCTEMPLATE=$LXCCOSTEMPLATE
ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
export VZTEMPLATE=centos-$COSVERS-$ARCH-minimal
export VZPRIVATEDIR
-export HOST=centos5.local
export DEBMIRROR
export DIST
[ ! -d $WORKSPACE/build ] || rm -fr $WORKSPACE/build
[ ! -d $WORKSPACE/reports ] || rm -fr $WORKSPACE/reports
-mkdir -p $WORKSPACE/build/packages $WORKSPACE/reports/coverage
+mkdir -p $WORKSPACE/build/packages $WORKSPACE/build/config $WORKSPACE/reports/coverage
+
+if $KEEPVM
+then
+ echo "Destroying vm $HOST"
+ (cd tests/scripts ; sh ./stop_vm.sh $HOST || true)
+fi
make -f Makefile.rh BUILDRESULT=$WORKSPACE/build/packages all
+(cd 3rd-party/selenium ; make getselenium)
+
+(cd tests/scripts ; sh ./start_vm.sh $HOST)
+
+# FUSIONFORGE REPO
cp src/rpm-specific/fusionforge.repo $WORKSPACE/build/packages/fusionforge.repo
sed -i "s#http://fusionforge.org/#${HUDSON_URL}#" $WORKSPACE/build/packages/fusionforge.repo
-sed -i "s#baseurl = .*#baseurl = $FFORGE_RPM_REPO/#" $WORKSPACE/build/packages/fusionforge.repo
+if [ ! -z "$FFORGE_RPM_REPO" ]
+then
+ sed -i "s#baseurl = .*#baseurl = ${FFORGE_RPM_REPO}/#" $WORKSPACE/build/packages/fusionforge.repo
+fi
+scp $WORKSPACE/build/packages/fusionforge.repo root@$HOST:/etc/yum.repos.d/
+[ ! -e ~/fusionforge_repo ] || scp -rp ~/fusionforge_repo root@$HOST:
+
+# DAG
+cp src/rpm-specific/dag-rpmforge.repo $WORKSPACE/build/packages/dag-rpmforge.repo
+if [ ! -z "$DAG_RPMFORGE_REPO" ] ; then
+ sed -i "s#http://apt.sw.be/redhat#${DAG_RPMFORGE_REPO}#" $WORKSPACE/build/packages/dag-rpmforge.repo
+fi
+scp $WORKSPACE/build/packages/dag-rpmforge.repo root@$HOST:/etc/yum.repos.d/
+
+cat > $WORKSPACE/build/config/phpunit <<-EOF
+HUDSON_URL=$HUDSON_URL
+JOB_NAME=$JOB_NAME
+EOF
-(cd tests/scripts ; sh ./start_vm.sh $HOST)
scp -r tests root@$HOST:/root
+scp -r $WORKSPACE/build/config root@$HOST:/root
+scp 3rd-party/selenium/binary/selenium-server-current/selenium-server.jar root@$HOST:/root
ssh root@$HOST "ln -s gforge /usr/share/src"
-[ ! -e ~/fusionforge_repo ] || scp -rp ~/fusionforge_repo root@$HOST:
-scp -rp src/rpm-specific/dag-rpmforge.repo root@$HOST:/etc/yum.repos.d/
-if [ "x$FFORGE_RPM_REPO" != "x" ]
-then
- ssh root@$HOST "cd /etc/yum.repos.d/; wget $FFORGE_RPM_REPO/fusionforge.repo"
-fi
+
sleep 5
[ ! -e "/tmp/timedhosts.txt" ] || scp -p /tmp/timedhosts.txt root@$HOST:/var/cache/yum/timedhosts.txt
-ssh root@$HOST "yum install -y fusionforge fusionforge-plugin-scmsvn fusionforge-plugin-online_help fusionforge-plugin-extratabs fusionforge-plugin-ldapextauth fusionforge-plugin-scmgit fusionforge-plugin-blocks"
+ssh root@$HOST "yum install -y --skip-broken fusionforge fusionforge-plugin-scmsvn fusionforge-plugin-online_help fusionforge-plugin-extratabs fusionforge-plugin-ldapextauth fusionforge-plugin-scmgit fusionforge-plugin-blocks"
scp -p root@$HOST:/var/cache/yum/timedhosts.txt /tmp/timedhosts.txt || true
ssh root@$HOST '(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-builbot.ini'
ssh root@$HOST "cd /root/tests/func; CONFIGURED=true CONFIG_PHP=config.php.buildbot DB_NAME=$DB_NAME php db_reload.php"
-ssh root@$HOST "su - postgres -c \"pg_dump -Fc $DB_NAME\" > /root/dump"
+#ssh root@$HOST "su - postgres -c \"pg_dump -Fc $DB_NAME\" > /root/dump"
+ssh root@$HOST "su - postgres -c \"pg_dumpall\" > /root/dump"
# Install a fake sendmail to catch all outgoing emails.
# ssh root@".HOST." 'perl -spi -e s#/usr/sbin/sendmail#/usr/share/tests/scripts/catch_mail.php# /etc/gforge/local.inc'
ssh root@$HOST "service crond stop" || true
-cd tests
-phpunit --log-junit $WORKSPACE/reports/phpunit-selenium.xml RPMCentos52Tests.php
-cd ..
-
-(cd tests/scripts ; sh ./stop_vm.sh $HOST)
+retcode=0
+if $REMOTESELENIUM
+then
+ echo "Run phpunit test on $HOST"
+ ssh -X root@$HOST "tests/scripts/phpunit.sh RPMCentos52Tests.php"|| retcode=$?
+else
+ cd tests
+ phpunit --log-junit $WORKSPACE/reports/phpunit-selenium.xml RPMCentos52Tests.php || retcode=$?
+ cd ..
+fi
+if [ "x$SELENIUM_RC_DIR" != "x" ]
+then
+ rsync -av root@$HOST:/var/log/ $SELENIUM_RC_DIR/
+fi
cp $WORKSPACE/reports/phpunit-selenium.xml $WORKSPACE/reports/phpunit-selenium.xml.org
xalan -in $WORKSPACE/reports/phpunit-selenium.xml.org -xsl fix_phpunit.xslt -out $WORKSPACE/reports/phpunit-selenium.xml
+
+if $KEEPVM
+then
+ echo "Keeping vm $HOST alive"
+else
+ (cd tests/scripts ; sh ./stop_vm.sh $HOST)
+fi
+exit $retcode