2 . tests/scripts/common-functions
3 . tests/scripts/common-vm
9 export FORGE_HOME=/usr/share/gforge
26 export FILTER="DEBDebian70Tests.php"
32 COWBUILDERCONFIG=$BUILDERDIR/config/$DIST.config
35 PKGNAME=$(dpkg-parsechangelog | awk '/^Source:/ { print $2 }')
36 PKGVERS=$(dpkg-parsechangelog | awk '/^Version:/ { print $2 }')
40 if [ -d $CHECKOUTPATH/.svn ] ; then
41 MINOR=-$MINOR+svn$(svn info | awk '/^Revision:/ { print $2 }')
42 elif [ -d $CHECKOUTPATH/.bzr ] ; then
43 MINOR=-$MINOR+bzr$(bzr revno)
44 elif [ -d $CHECKOUTPATH/.git ] ; then
45 MINOR=-$MINOR+git$(git describe --always)
47 MINOR=-$MINOR+$(TZ=UTC date +%Y%m%d%H%M%S)
49 ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
51 # Build out of the source tree
53 CHANGEFILE=${BUILDRESULT}/${PKGNAME}_${SMAJOR}${MINOR}_${ARCH}.changes
55 rm -rf $BUILDPLACE/$PKGNAME-$MAJOR
56 cp -r src/ $BUILDPLACE/$PKGNAME-$MAJOR
57 cd $BUILDPLACE/$PKGNAME-$MAJOR
58 dch -b -v $MAJOR$MINOR -D UNRELEASED "This is $DIST-$ARCH autobuild"
59 sed -i -e "1s/UNRELEASED/$DIST/" debian/changelog
60 debian/rules debian/control
61 pdebuild --configfile $COWBUILDERCONFIG --buildresult $BUILDRESULT
64 lintian -i $CHANGEFILE
65 REPOPATH=$WORKSPACE/build/debian
67 [ ! -d $REPOPATH ] || rm -r $REPOPATH
68 mkdir -p $REPOPATH/conf
69 DEFAULTKEY=buildbot@$(hostname -f)
70 SIGNKEY=${DEBEMAIL:-$DEFAULTKEY}
71 cat > $REPOPATH/conf/distributions <<EOF
76 Architectures: amd64 i386 source
77 Origin: buildbot.fusionforge.org
78 Description: FusionForge autobuilt repository
82 reprepro -Vb $REPOPATH include $DIST $CHANGEFILE
84 rm ${BUILDPLACE}/${PKGNAME}_${SMAJOR}${MINOR}*
85 rm -rf $BUILDPLACE/$PKGNAME-$MAJOR
88 cat $CHANGEFILE | sed '1,/^Checksums-Sha1:/d;/^[[:alnum:]]/,$d' | awk '{print $3}' | xargs rm
93 destroy_vm -t $VM $HOST
94 start_vm_if_not_keeped -t $VM $HOST
95 setup_debian_3rdparty_repo
98 cat tests/preseed/* | sed s/@FORGE_ADMIN_PASSWORD@/$FORGE_ADMIN_PASSWORD/ | ssh root@$HOST "LANG=C debconf-set-selections"
101 export DEBMIRROR DEBMIRRORSEC
102 ssh root@$HOST "echo \"deb $DEBMIRROR $DIST main\" > /etc/apt/sources.list"
103 ssh root@$HOST "echo \"deb $DEBMIRRORSEC $DIST/updates main\" > /etc/apt/sources.list.d/security.list"
104 ssh root@$HOST "apt-get update"
105 # ssh root@$HOST "UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -o debug::pkgproblemresolver=true -y --force-yes dist-upgrade"
107 ssh root@$HOST "apt-get update"
108 ssh root@$HOST "UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -o debug::pkgproblemresolver=true -y --force-yes install libapache2-mod-wsgi nscd"
110 if [ "$DIST" = wheezy ] ; then
111 ssh root@$HOST "UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -o debug::pkgproblemresolver=true -y --force-yes install javascript-common"
112 ssh root@$HOST "echo \"deb $DEBMIRROR jessie main\" >> /etc/apt/sources.list.d/jessie.list"
113 ssh root@$HOST "apt-get update"
114 ssh root@$HOST "UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -o debug::pkgproblemresolver=true -y --force-yes install loggerhead python"
115 ssh root@$HOST "rm /etc/apt/sources.list.d/jessie.list"
118 ssh root@$HOST "echo \"deb $DEBMIRROR $DIST main\" > /etc/apt/sources.list"
119 ssh root@$HOST "apt-get update"
121 ssh root@$HOST "echo \"deb file:/debian $DIST main\" >> /etc/apt/sources.list"
122 scp -r $WORKSPACE/build/debian root@$HOST:/
123 gpg --export --armor | ssh root@$HOST "apt-key add -"
125 ssh root@$HOST "apt-get update"
127 # Install fusionforge
128 ssh root@$HOST "UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -o debug::pkgproblemresolver=true -y --force-yes install rsync postgresql-contrib fusionforge-full"
129 echo "Set forge admin password"
130 ssh root@$HOST "/usr/share/gforge/bin/forge_set_password $FORGE_ADMIN_USERNAME $FORGE_ADMIN_PASSWORD"
131 ssh root@$HOST "LANG=C a2dissite default ; LANG=C a2dissite 000-default ; LANG=C invoke-rc.d apache2 reload"
132 ssh root@$HOST "(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-buildbot.ini"
133 ssh root@$HOST "(echo [moinmoin];echo use_frame=no) >> /etc/gforge/config.ini.d/zzz-buildbot.ini"
134 ssh root@$HOST "(echo [mediawiki];echo unbreak_frames=yes) >> /etc/gforge/config.ini.d/zzz-buildbot.ini"
135 ssh root@$HOST "[ -e /var/lib/gforge/.bazaar/bazaar.conf ] && sed -i -e s,https://,http://,g /var/lib/gforge/.bazaar/bazaar.conf"
136 ssh root@$HOST "service nscd restart"
139 echo "Dump freshly installed database"
140 ssh root@$HOST "su - postgres -c \"pg_dumpall\" > /root/dump"
143 echo "Stop cron daemon"
144 ssh root@$HOST "invoke-rc.d cron stop" || true
147 ssh root@$HOST "apt-get -o debug::pkgproblemresolver=true -y install selenium"
149 # Install selenium tests
150 ssh root@$HOST "[ -d $FORGE_HOME ] || mkdir -p $FORGE_HOME"
151 rsync -a --delete tests/ root@$HOST:$FORGE_HOME/tests/
153 # Transfer hudson config
154 ssh root@$HOST "cat > $FORGE_HOME/tests/config/phpunit" <<-EOF
155 HUDSON_URL=$HUDSON_URL
161 echo "Run phpunit test on $HOST in $FORGE_HOME"
162 ssh root@$HOST "$FORGE_HOME/tests/func/vncxstartsuite.sh $FILTER" || retcode=$?
163 rsync -av root@$HOST:/var/log/ $WORKSPACE/reports/
166 for i in *_source.changes ; do echo $i ; echo $(basename $i _source.changes)_*.build ; cat $i | sed -e 0,/^Checksums/d -e /^Checksums/,\$d | awk '{print $3}' ; done | xargs rm || true
168 stop_vm_if_not_keeped -t $VM $@