a few tweaks for having modules.list correctly updated
[build.git] / vbuild-nightly.sh
index ab7abc9..c560460 100755 (executable)
@@ -11,8 +11,8 @@ DEFAULT_PERSONALITY=linux32
 DEFAULT_BASE="@DATE@--@PLDISTRO@-@FCDISTRO@-@PERSONALITY@"
 DEFAULT_SVNPATH="http://svn.planet-lab.org/svn/build/trunk"
 DEFAULT_TESTSVNPATH="http://svn.planet-lab.org/svn/tests/trunk/system/"
-DEFAULT_TESTCONFIG32="onelab onelab_testbox32"
-DEFAULT_TESTCONFIG64="onelab onelab_testbox64"
+DEFAULT_TESTCONFIG32="main 1vnodes 1testbox32"
+DEFAULT_TESTCONFIG64="main 1vnodes 1testbox64"
 DEFAULT_IFNAME=eth0
 
 # web publishing results
@@ -20,7 +20,7 @@ DEFAULT_WEBPATH="/build/@PLDISTRO@/"
 
 # for the test part
 TESTBUILDURL="http://build.one-lab.org/"
-TESTBOXSSH=root@testbox1.one-lab.org
+TESTBOXSSH=root@testbox.one-lab.org
 ####################
 # assuming vserver runs in UTC
 DATE=$(date +'%Y.%m.%d')
@@ -99,9 +99,9 @@ function failure() {
     mkdir -p ${WEBPATH}
     cp $LOG ${WEBLOG}
     summary $LOG >> ${WEBLOG}
-    (echo -n "============================== $COMMAND: failure at " ; date ; tail -c 20k $WEBLOG) > ${WEBLOG}.ko
+    (echo -n "============================== $COMMAND: failure at " ; date ; tail -c 30k $WEBLOG) > ${WEBLOG}.ko
     if [ -n "$MAILTO" ] ; then
-       tail -c 20k ${WEBLOG} | mail -s "Failures for build ${BASE}" $MAILTO
+       tail -c 30k ${WEBLOG} | mail -s "Failures for build ${BASE}" $MAILTO
     fi
     exit 1
 }
@@ -112,7 +112,12 @@ function success () {
     mkdir -p ${WEBPATH}
     cp $LOG ${WEBLOG}
     summary $LOG >> ${WEBLOG}
-    touch ${WEBLOG}.ok
+    if [ -n "$DO_TEST" ] ; then
+       echo "Successfully built and tested - see testlogs for details" > ${WEBLOG}.pass
+       rm -f ${WEBLOG}.ok
+    else
+       echo "Successfully built"> ${WEBLOG}.ok
+    fi
     if [ -n "$MAILTO" ] ; then
        (echo "$PLDISTRO ($BASE) build for $FCDISTRO completed on $(date)" ) | mail -s "Successful build for ${BASE}" $MAILTO
     fi
@@ -171,15 +176,31 @@ function runtest () {
     url=$(echo $rpm | sed -e "s,/vservers/$BASE/build,${TESTBUILDURL}${PLDISTRO}/${BASE},")
 
     # compute test directory name on test box
-    testdir=test-${BASE}
+    testdir=chroot-${BASE}
+    # use another name if any config contains vserver
+    echo $TESTCONFIG | grep vserver &> /dev/null && testdir=vserver-${BASE}
     # clean it
     ssh ${TESTBOXSSH} rm -rf ${testdir}
     # check it out
     ssh ${TESTBOXSSH} svn co ${TESTSVNPATH} ${testdir}
     # invoke test on testbox - pass url and build url - so the tests can use vtest-init-vserver.sh
-    ssh 2>&1 ${TESTBOXSSH} python -u ${testdir}/runtest --build ${SVNPATH} --url ${url} --config "%{TESTCONFIG}" --all 
-       
-    if [ "$?" != 0 ] ; then
+    configs=""
+    for config in ${TESTCONFIG} ; do
+       configs="$configs --config $config"
+    done
+    
+    # need to proceed despite of set -e
+    success=true
+    ssh 2>&1 ${TESTBOXSSH} ${testdir}/runtest --build ${SVNPATH} --url ${url} $configs --all || success=
+
+    # gather logs in the vserver
+    mkdir -p /vservers/$BASE/build/testlogs
+    ssh 2>&1 ${TESTBOXSSH} tar -C ${testdir}/logs -cf - . | tar -C /vservers/$BASE/build/testlogs -xf - || true
+    # push them to the build web
+    rsync --archive --delete /vservers/$BASE/build/testlogs/ $WEBPATH/$BASE/testlogs/
+    chmod -R a+r $WEBPATH/$BASE/testlogs/
+
+    if [ -z "$success" ] ; then
        failure
     fi