2 . tests/scripts/common-functions
3 . tests/scripts/common-vm
9 export FORGE_HOME=/usr/share/gforge
12 #export FILTER="func/PluginsMediawiki/mediawikiTest.php"
13 export FILTER="DEBDebian70Tests.php"
14 #export FILTER="func/PluginsMoinMoin/moinmoinTest.php"
20 COWBUILDERCONFIG=$BUILDERDIR/config/$DIST.config
23 PKGNAME=$(dpkg-parsechangelog | awk '/^Source:/ { print $2 }')
24 PKGVERS=$(dpkg-parsechangelog | awk '/^Version:/ { print $2 }')
28 if [ -d $CHECKOUTPATH/.svn ] ; then
29 MINOR=-$MINOR+svn$(svn info | awk '/^Revision:/ { print $2 }')
30 elif [ -d $CHECKOUTPATH/.bzr ] ; then
31 MINOR=-$MINOR+bzr$(bzr revno)
32 elif [ -d $CHECKOUTPATH/.git ] ; then
33 MINOR=-$MINOR+git$(git describe --always)
35 MINOR=-$MINOR+$(TZ=UTC date +%Y%m%d%H%M%S)
37 ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
39 # Build out of the source tree
41 CHANGEFILE=${BUILDRESULT}/${PKGNAME}_${SMAJOR}${MINOR}_${ARCH}.changes
43 rm -rf $BUILDPLACE/$PKGNAME-$MAJOR
44 cp -r src/ $BUILDPLACE/$PKGNAME-$MAJOR
45 cd $BUILDPLACE/$PKGNAME-$MAJOR
46 dch -b -v $MAJOR$MINOR -D UNRELEASED "This is $DIST-$ARCH autobuild"
47 sed -i -e "1s/UNRELEASED/$DIST/" debian/changelog
48 pdebuild --configfile $COWBUILDERCONFIG --buildresult $BUILDRESULT
51 lintian -i $CHANGEFILE
52 REPOPATH=$WORKSPACE/build/debian
54 [ ! -d $REPOPATH ] || rm -r $REPOPATH
55 mkdir -p $REPOPATH/conf
56 DEFAULTKEY=buildbot@$(hostname -f)
57 SIGNKEY=${DEBEMAIL:-$DEFAULTKEY}
58 cat > $REPOPATH/conf/distributions <<EOF
63 Architectures: amd64 i386 source
64 Origin: buildbot.fusionforge.org
65 Description: FusionForge autobuilt repository
69 reprepro -Vb $REPOPATH include $DIST $CHANGEFILE
71 rm ${BUILDPLACE}/${PKGNAME}_${SMAJOR}${MINOR}*
72 rm -rf $BUILDPLACE/$PKGNAME-$MAJOR
75 cat $CHANGEFILE | sed '1,/^Checksums-Sha1:/d;/^[[:alnum:]]/,$d' | awk '{print $3}' | xargs rm
80 destroy_vm -t debian7 $HOST
81 start_vm_if_not_keeped -t debian7 $HOST
82 setup_debian_3rdparty_repo
85 cat tests/preseed/* | sed s/@FORGE_ADMIN_PASSWORD@/$FORGE_ADMIN_PASSWORD/ | ssh root@$HOST "LANG=C debconf-set-selections"
88 export DEBMIRROR DEBMIRRORSEC
89 ssh root@$HOST "echo \"deb $DEBMIRROR $DIST main\" > /etc/apt/sources.list"
90 ssh root@$HOST "echo \"deb $DEBMIRRORSEC $DIST/updates main\" > /etc/apt/sources.list.d/security.list"
91 ssh root@$HOST "apt-get update"
92 ssh root@$HOST "UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -o debug::pkgproblemresolver=true -y --force-yes dist-upgrade"
94 ssh root@$HOST "apt-get update"
95 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"
97 ssh root@$HOST "echo \"deb $DEBMIRROR jessie main\" >> /etc/apt/sources.list.d/jessie.list"
98 ssh root@$HOST "apt-get update"
99 ssh root@$HOST "UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -o debug::pkgproblemresolver=true -y --force-yes install loggerhead python"
100 ssh root@$HOST "rm /etc/apt/sources.list.d/jessie.list"
102 ssh root@$HOST "echo \"deb $DEBMIRROR $DIST main\" > /etc/apt/sources.list"
103 ssh root@$HOST "apt-get update"
105 ssh root@$HOST "echo \"deb file:/debian $DIST main\" >> /etc/apt/sources.list"
106 scp -r $WORKSPACE/build/debian root@$HOST:/
107 gpg --export --armor | ssh root@$HOST "apt-key add -"
109 ssh root@$HOST "apt-get update"
111 # Install fusionforge
112 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"
113 echo "Set forge admin password"
114 ssh root@$HOST "/usr/share/gforge/bin/forge_set_password $FORGE_ADMIN_USERNAME $FORGE_ADMIN_PASSWORD"
115 ssh root@$HOST "LANG=C a2dissite default ; LANG=C invoke-rc.d apache2 reload"
116 ssh root@$HOST "(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-buildbot.ini"
117 ssh root@$HOST "(echo [moinmoin];echo use_frame=no) >> /etc/gforge/config.ini.d/zzz-buildbot.ini"
118 ssh root@$HOST "(echo [mediawiki];echo unbreak_frames=yes) >> /etc/gforge/config.ini.d/zzz-buildbot.ini"
119 ssh root@$HOST "[ -e /var/lib/gforge/.bazaar/bazaar.conf ] && sed -i -e s,https://,http://,g /var/lib/gforge/.bazaar/bazaar.conf"
120 ssh root@$HOST "service nscd restart"
123 echo "Dump freshly installed database"
124 ssh root@$HOST "su - postgres -c \"pg_dumpall\" > /root/dump"
127 echo "Stop cron daemon"
128 ssh root@$HOST "invoke-rc.d cron stop" || true
131 ssh root@$HOST "apt-get -o debug::pkgproblemresolver=true -y install selenium"
133 # Install selenium tests
134 ssh root@$HOST "[ -d $FORGE_HOME ] || mkdir -p $FORGE_HOME"
135 rsync -a --delete tests/ root@$HOST:$FORGE_HOME/tests/
137 # Transfer hudson config
138 ssh root@$HOST "cat > $FORGE_HOME/tests/config/phpunit" <<-EOF
139 HUDSON_URL=$HUDSON_URL
145 echo "Run phpunit test on $HOST in $FORGE_HOME"
146 ssh root@$HOST "$FORGE_HOME/tests/func/vncxstartsuite.sh $FILTER"
148 rsync -av root@$HOST:/var/log/ $WORKSPACE/reports/
150 stop_vm_if_not_keeped -t debian7 $@