get_config
export FORGE_HOME=/usr/share/gforge
- export DIST=wheezy
export HOST=$1
- #export FILTER="func/PluginsMediawiki/mediawikiTest.php"
+ case $HOST in
+ debian7.local)
+ export DIST=wheezy
+ VMTEMPLATE=debian7
+ ;;
+ debian8.local)
+ export DIST=jessie
+ VMTEMPLATE=debian8
+ ;;
+ *)
+ export DIST=jessie
+ VMTEMPLATE=debian8
+ ;;
+ esac
+
+export FILTER="DEBDebian70Tests.php"
- #export FILTER="func/PluginsMoinMoin/moinmoinTest.php"
+
prepare_workspace
CHECKOUTPATH=$(pwd)
reprepro -Vb $REPOPATH include $DIST $CHANGEFILE
+rm ${BUILDPLACE}/${PKGNAME}_${SMAJOR}${MINOR}*
+rm -rf $BUILDPLACE/$PKGNAME-$MAJOR
+
+cd $BUILDRESULT
+cat $CHANGEFILE | sed '1,/^Checksums-Sha1:/d;/^[[:alnum:]]/,$d' | awk '{print $3}' | xargs rm
+rm $CHANGEFILE
+
cd $CHECKOUTPATH
- destroy_vm -t debian7 $HOST
- start_vm_if_not_keeped -t debian7 $HOST
+ destroy_vm -t $VMTEMPLATE $HOST
+ start_vm_if_not_keeped -t $VMTEMPLATE $HOST
+setup_debian_3rdparty_repo
-cd $CHECKOUTPATH
# Transfer preseeding
-# cat tests/preseed/* | sed s/@FORGE_ADMIN_PASSWORD@/$FORGE_ADMIN_PASSWORD/ | ssh root@$HOST "LANG=C debconf-set-selections"
+cat tests/preseed/* | sed s/@FORGE_ADMIN_PASSWORD@/$FORGE_ADMIN_PASSWORD/ | ssh root@$HOST "LANG=C debconf-set-selections"
# Setup debian repo
export DEBMIRROR DEBMIRRORSEC
# Run tests
retcode=0
echo "Run phpunit test on $HOST in $FORGE_HOME"
-
-ssh root@$HOST "apt-get -y install xfonts-base vnc4server ; mkdir -p /root/.vnc"
-ssh root@$HOST "cat > /root/.vnc/xstartup ; chmod +x /root/.vnc/xstartup" <<EOF
-#! /bin/bash
-# Setup ssh key and parameters
-cd
-mkdir -p .ssh
-if ! [ -e .ssh/id_rsa.pub ] ; then
- ssh-keygen -f .ssh/id_rsa -N ''
- cat .ssh/id_rsa.pub >> .ssh/authorized_keys
-fi
-if ! grep -q StrictHostKeyChecking .ssh/config ; then
- echo StrictHostKeyChecking no >> .ssh/config
-fi
-
-[ -e /var/lib/gforge/.bazaar/bazaar.conf ] && sed -i -e s,https://,http://,g /var/lib/gforge/.bazaar/bazaar.conf
-
-: > /root/phpunit.exitcode
-$FORGE_HOME/tests/scripts/phpunit.sh DEBDebian70Tests.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 "$FORGE_HOME/tests/func/vncxstartsuite.sh $FILTER"
+retcode=$?
rsync -av root@$HOST:/var/log/ $WORKSPACE/reports/
-ssh root@$HOST "vncserver -kill :1" || retcode=$?
- stop_vm_if_not_keeped -t debian7 $@
+ stop_vm_if_not_keeped -t $VMTEMPLATE $@
exit $retcode
. tests/scripts/common-vm
export FORGE_HOME=/opt/gforge
- export DIST=wheezy
- #export FILTER="func/PluginsMediawiki/mediawikiTest.php"
+ export HOST=$1
+ case $HOST in
+ debian7.local)
+ export DIST=wheezy
+ VMTEMPLATE=debian7
+ ;;
+ debian8.local)
+ export DIST=jessie
+ VMTEMPLATE=debian8
+ ;;
+ *)
+ export DIST=jessie
+ VMTEMPLATE=debian8
+ ;;
+ esac
+
+export FILTER="DEBDebian70TestsSRC.php"
- #export FILTER="func/PluginsMoinMoin/moinmoinTest.php"
+
get_config $@
prepare_workspace
- destroy_vm -t debian7 $@
- start_vm_if_not_keeped -t debian7 $@
+ destroy_vm -t $VMTEMPLATE $@
+ start_vm_if_not_keeped -t $VMTEMPLATE $@
-# Build 3rd-party
-# make -C 3rd-party -f Makefile.deb BUILDRESULT=$BUILDRESULT LOCALREPODEB=$WORKSPACE/build/debian BUILDDIST=$DIST DEBMIRROR=$DEBMIRROR botclean botbuild
-
-# Setup debian repo
-# ssh root@$HOST "echo \"deb $DEBMIRROR $DIST main\" > /etc/apt/sources.list"
-# ssh root@$HOST "echo \"deb $DEBMIRRORSEC $DIST/updates main\" > /etc/apt/sources.list.d/security.list"
-# ssh root@$HOST "echo \"deb file:/debian $DIST main\" >> /etc/apt/sources.list"
-# scp -r $WORKSPACE/build/debian root@$HOST:/
-# gpg --export --armor | ssh root@$HOST "apt-key add -"
-# sleep 5
+setup_debian_3rdparty_repo
ssh root@$HOST "apt-get update"
# Run tests
retcode=0
-echo "Run phpunit test on $HOST"
-
-ssh root@$HOST "apt-get -y install xfonts-base vnc4server ; mkdir -p /root/.vnc"
-ssh root@$HOST "cat > /root/.vnc/xstartup ; chmod +x /root/.vnc/xstartup" <<EOF
-#! /bin/bash
-: > /root/phpunit.exitcode
-$FORGE_HOME/tests/scripts/phpunit.sh DEBDebian70Tests.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)
+echo "Run phpunit test on $HOST in $FORGE_HOME"
+ssh root@$HOST "$FORGE_HOME/tests/func/vncxstartsuite.sh $FILTER"
+retcode=$?
rsync -av root@$HOST:/var/log/ $WORKSPACE/reports/
-ssh root@$HOST "vncserver -kill :1" || retcode=$?
- stop_vm_if_not_keeped -t debian7 $@
+ stop_vm_if_not_keeped -t $VMTEMPLATE $@
-return $retcode
+exit $retcode