invoke the test framework through ssh -n
[build.git] / vbuild-nightly.sh
index 3b7a186..ef3582e 100755 (executable)
@@ -10,7 +10,7 @@ DEFAULT_PLDISTRO=planetlab
 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/"
+# TESTSVNPATH to be computed from the -tags.mk file - no default anymore
 DEFAULT_TESTCONFIG="default"
 DEFAULT_IFNAME=eth0
 
@@ -151,6 +151,8 @@ function build () {
     make -C /build $DRY_RUN "${MAKEVARS[@]}" stage1=true 
     # versions
     make -C /build $DRY_RUN "${MAKEVARS[@]}" versions
+    # store testsvnpath
+    make -C /build $DRY_RUN "${MAKEVARS[@]}" stage1=true testsvnpath
     # actual stuff
     make -C /build $DRY_RUN "${MAKEVARS[@]}" $MAKETARGETS
 
@@ -165,21 +167,39 @@ function runtest () {
 
     echo -n "============================== Starting $COMMAND:runtest on $(date)"
 
-    ### the URL to the myplc package
-    rpm=$( find /vservers/$BASE/build/RPMS -name 'myplc-[0-9]*' )
-    if [ ${#rpm[@]} != 1 ] ; then
-       echo "$COMMAND: Cannot locate rpm for testing"
+    # where to find TESTSVNPATH
+    stamp=/vservers/$BASE/build/testsvnpath
+    if [ ! -f $stamp ] ; then
+       echo "$COMMAND: Cannot figure TESTSVNPATH from missing $stamp"
+       failure
+       exit 1
+    fi
+    TESTSVNPATH=$(cat $stamp)
+    # use only this pat of the tests right now
+    TESTSVNPATH=${TESTSVNPATH}/system
+
+    ### the URL to the RPMS/<arch> location
+    url=""
+    for a in i386 x86_64; do
+       archdir=/vservers/$BASE/build/RPMS/$a
+       if [ -d $archdir ] ; then
+           url=$(echo $archdir | sed -e "s,/vservers/$BASE/build,${TESTBUILDURL}${PLDISTRO}/${BASE},")
+           break
+       fi
+    done
+
+    if [ -z "$url" ] ; then
+       echo "$COMMAND: Cannot locate arch URL for testing"
        failure
        exit 1
     fi
-    url=$(echo $rpm | sed -e "s,/vservers/$BASE/build,${TESTBUILDURL}${PLDISTRO}/${BASE},")
 
     # test directory name on test box
     testdir=${BASE}
     # clean it
-    ssh ${TESTBOXSSH} rm -rf ${testdir}
+    ssh -n ${TESTBOXSSH} rm -rf ${testdir}
     # check it out
-    ssh ${TESTBOXSSH} svn co ${TESTSVNPATH} ${testdir}
+    ssh -n ${TESTBOXSSH} svn co ${TESTSVNPATH} ${testdir}
     # invoke test on testbox - pass url and build url - so the tests can use vtest-init-vserver.sh
     configs=""
     for config in ${TESTCONFIG} ; do
@@ -188,11 +208,11 @@ function runtest () {
     
     # need to proceed despite of set -e
     success=true
-    ssh 2>&1 ${TESTBOXSSH} ${testdir}/runtest --build ${SVNPATH} --url ${url} $configs --all || success=
+    ssh 2>&1 -n ${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
+    ssh 2>&1 -n ${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/
@@ -238,7 +258,6 @@ function usage () {
     echo " -t pldistrotags - defaults to \${PLDISTRO}-tags.mk"
     echo " -r tagsrelease - a release number that refers to PLDISTROTAGS - defaults to HEAD"
     echo " -s svnpath - where to fetch the build module"
-    echo " -x testsvnpath - defaults to $DEFAULT_TESTSVNPATH"
     echo " -c testconfig - defaults to $DEFAULT_TESTCONFIG"
     echo " -w webpath - defaults to $DEFAULT_WEBPATH"
     echo " -m mailto - no default"
@@ -271,7 +290,6 @@ function main () {
            t) PLDISTROTAGS=$OPTARG ;;
            r) TAGSRELEASE=$OPTARG ;;
            s) SVNPATH=$OPTARG ;;
-           x) TESTSVNPATH=$OPTARG ;;
            c) TESTCONFIG="$TESTCONFIG $OPTARG" ;;
            w) WEBPATH=$OPTARG ;;
            m) MAILTO=$OPTARG ;;
@@ -303,7 +321,6 @@ function main () {
     [ -z "$WEBPATH" ] && WEBPATH="$DEFAULT_WEBPATH"
     [ -z "$IFNAME" ] && IFNAME="$DEFAULT_IFNAME"
     [ -z "$SVNPATH" ] && SVNPATH="$DEFAULT_SVNPATH"
-    [ -z "$TESTSVNPATH" ] && TESTSVNPATH="$DEFAULT_TESTSVNPATH"
     [ -z "$TESTCONFIG" ] && TESTCONFIG="$DEFAULT_TESTCONFIG"
 
     [ -n "$DRY_RUN" ] && MAILTO=""
@@ -339,6 +356,8 @@ function main () {
            set -x
            echo "XXXXXXXXXX $COMMAND: using existing vserver $BASE" $(date)
            show_env
+           # start in case e.g. we just rebooted
+           vserver ${BASE} start || :
            # update build
            vserver ${BASE} exec svn update /build
        else
@@ -402,6 +421,8 @@ function main () {
        rm -rf $WEBPATH/$BASE ; mkdir -p $WEBPATH/$BASE/{RPMS,SRPMS}
        rsync --archive --delete --verbose /vservers/$BASE/build/RPMS/ $WEBPATH/$BASE/RPMS/
        rsync --archive --delete --verbose /vservers/$BASE/build/SRPMS/ $WEBPATH/$BASE/SRPMS/
+       # publish myplc-release
+       rsync --verbose /vservers/$BASE/build/myplc-release $WEBPATH/$BASE
        
        if [ -n "$DO_TEST" ] ; then 
            runtest