[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] svntest.sh would skip testing when there isn't anything to do

From: Jani Averbach <jaa_at_jaa.iki.fi>
Date: 2004-07-11 19:16:19 CEST

Hello,

I think it would be nice if svntest won't run tests when there isn't
anything to test. This is the case for branches most of the time.

But I don't know how other people like to use and read svntest.sh's
emails, so I am asking here what you think about this change.

Here is an example what the output would be when testing is no-op.

http://subversion.tigris.org/servlets/ReadMsg?list=svn-breakage&msgNo=12005
http://subversion.tigris.org/servlets/ReadMsg?list=svn-breakage&msgNo=12004

BR, Jani

Log:
The svntest framework won't run tests if there aren't any changes to test.

* tools/test-scripts/svntest/svntest.sh
    Abort testing if all rebuild flags are zero.

* tools/test-scripts/svntest/svntest-update.sh
    (SVN_UPDATE_REGEXP_1, SVN_UPDATE_REGEXP_2): New variables
    (UPDATE_REBUILD_FLAG): New parameter 'mode', this func. could now
                           check rebuild status for SVN projects too.

* tools/test-scripts/svntest/svntest-rebuild.sh
    Added updating of SVN's rebuild flag.

* tools/test-scripts/svntest/svntest-sendmail.sh
    Added new email target 'NOOP'.

Index: tools/test-scripts/svntest/svntest.sh
===================================================================
--- tools/test-scripts/svntest/svntest.sh (revision 10235)
+++ tools/test-scripts/svntest/svntest.sh (working copy)
@@ -20,6 +20,19 @@
     exit
 }
 
+# Check what was the update status for projects,
+# if there is nothing to do, send NOOP email and abort testing
+RB_APR="`$CAT $TEST_ROOT/$APR_NAME.rb`"
+RB_APU="`$CAT $TEST_ROOT/$APU_NAME.rb`"
+RB_HTTPD="`$CAT $TEST_ROOT/$HTTPD_NAME.rb`"
+RB_SVN="`$CAT $TEST_ROOT/$SVN_NAME.rb`"
+
+if [ $RB_APR -eq 0 -a $RB_APU -eq 0 -a $RB_HTTPD -eq 0 -a $RB_SVN -eq 0 ];
+then
+ $EXEC_PATH/svntest-sendmail.sh "update" "" "" "NOOP"
+ exit
+fi
+
 # conditionally rebuild apr, apr-util and httpd
 $EXEC_PATH/svntest-rebuild-generic.sh "$APR_NAME" "$APU_NAME" "$MAKE_OPTS" || {
     $EXEC_PATH/svntest-sendmail.sh "update" "" "" "FAIL"
Index: tools/test-scripts/svntest/svntest-update.sh
===================================================================
--- tools/test-scripts/svntest/svntest-update.sh (revision 10235)
+++ tools/test-scripts/svntest/svntest-update.sh (working copy)
@@ -11,30 +11,46 @@
 CVS_UPDATE_REGEXP_1='^[UPARMC] \(\(docs\)\|\(STATUS\)\|\(CHANGES\)\)'
 CVS_UPDATE_REGEXP_2='^[UPARMC] [A-Za-z]'
 
+SVN_UPDATE_REGEXP_1=\
+'^[ADUCG]\([ADUCG]\| \) \(\(doc\)\|\(notes\)\|\(www\)\|\(contrib\)'\
+'\|\(tools\)\|\(packages\)\|\(STATUS\)\)'
+
+SVN_UPDATE_REGEXP_2='^[ADUCG]\([ADUCG]\| \) [A-Za-z]'
+
 #
 # If update status file contains already
 # '0' (== don't rebuild) then update value,
 # otherwise, honor current 'rebuild needed' (1)
 # value, and don't update it because
 # current rebuild value could be '0'
-# arg1 := cvs update log file
-# arg2 := rebuild flag file
+# arg1 := mode of operation <CVS|SVN>
+# arg2 := update log file
+# arg3 := rebuild flag file
 #
 UPDATE_REBUILD_FLAG () {
- local CVS_UP_LOGFILE="$1"
- local RB_FILE="$2"
- local CVS_UP_STATUS=1
+ local MODE="$1"
+ local UP_LOGFILE="$2"
+ local RB_FILE="$3"
+ local UP_STATUS=1
 
- $GREP -v "$CVS_UPDATE_REGEXP_1" "$CVS_UP_LOGFILE" \
- | $GREP -q "$CVS_UPDATE_REGEXP_2" > /dev/null 2>&1
- CVS_UP_STATUS="$?"
+ if [ $MODE = "SVN" ]; then
+ REGEXP_1="$SVN_UPDATE_REGEXP_1"
+ REGEXP_2="$SVN_UPDATE_REGEXP_2"
+ elif [ $MODE = "CVS" ]; then
+ REGEXP_1="$CVS_UPDATE_REGEXP_1"
+ REGEXP_2="$CVS_UPDATE_REGEXP_2"
+ fi
+
+ $GREP -v "$REGEXP_1" "$UP_LOGFILE" \
+ | $GREP -q "$REGEXP_2" > /dev/null 2>&1
+ UP_STATUS="$?"
     
     if test ! -f "$RB_FILE"
     then
         echo "1" > "$RB_FILE"
     elif test 0 -eq `$CAT "$RB_FILE"`
     then
- if test "$CVS_UP_STATUS" -eq 0
+ if test "$UP_STATUS" -eq 0
         then
             echo "1" > "$RB_FILE"
         else
@@ -51,7 +67,7 @@
     FAIL
 }
 PASS
-UPDATE_REBUILD_FLAG "$TEST_ROOT/LOG_up_apr" "$APR_REPO.rb"
+UPDATE_REBUILD_FLAG CVS "$TEST_ROOT/LOG_up_apr" "$APR_REPO.rb"
 
 START "update $APU_NAME" "Updating $APU_NAME..."
 cd $APU_REPO && $CVS -f -q -z6 update -d -P > "$TEST_ROOT/LOG_up_apu" 2>&1
@@ -60,7 +76,7 @@
     FAIL
 }
 PASS
-UPDATE_REBUILD_FLAG "$TEST_ROOT/LOG_up_apu" "$APU_REPO.rb"
+UPDATE_REBUILD_FLAG CVS "$TEST_ROOT/LOG_up_apu" "$APU_REPO.rb"
 
 START "update $HTTPD_NAME" "Updating $HTTPD_NAME..."
 cd $HTTPD_REPO && $CVS -f -q -z6 update -d -P > "$TEST_ROOT/LOG_up_httpd" 2>&1
@@ -69,7 +85,7 @@
     FAIL
 }
 PASS
-UPDATE_REBUILD_FLAG "$TEST_ROOT/LOG_up_httpd" "$HTTPD_REPO.rb"
+UPDATE_REBUILD_FLAG CVS "$TEST_ROOT/LOG_up_httpd" "$HTTPD_REPO.rb"
 
 # Update svn
 START "update subversion" "Updating Subversion..."
@@ -79,6 +95,7 @@
     FAIL
 }
 PASS
+UPDATE_REBUILD_FLAG SVN "$TEST_ROOT/LOG_up_svn" "$SVN_REPO.rb"
 
 # Run autogen.sh
 START "autogen.sh" "Running autogen.sh..."
Index: tools/test-scripts/svntest/svntest-rebuild.sh
===================================================================
--- tools/test-scripts/svntest/svntest-rebuild.sh (revision 10235)
+++ tools/test-scripts/svntest/svntest-rebuild.sh (working copy)
@@ -71,3 +71,7 @@
     FAIL
 }
 PASS
+
+START "rebuild flag" "Updating rebuild flag..."
+echo "0" > "$TEST_ROOT/$SVN_NAME.rb" || FAIL
+PASS
Index: tools/test-scripts/svntest/svntest-sendmail.sh
===================================================================
--- tools/test-scripts/svntest/svntest-sendmail.sh (revision 10235)
+++ tools/test-scripts/svntest/svntest-sendmail.sh (working copy)
@@ -35,8 +35,8 @@
     exit 1
 fi
 
-# The status may only be PASS or FAIL
-if [ "$BUILD_STAT" != "PASS" -a "$BUILD_STAT" != "FAIL" ]
+# The status may only be PASS or FAIL or NOOP
+if [ "$BUILD_STAT" != "PASS" -a "$BUILD_STAT" != "FAIL" -a "$BUILD_STAT" != "NOOP" ]
 then
     $SENDMAIL -t <<EOF
 From: $FROM
@@ -48,6 +48,19 @@
     exit 1
 fi
 
+# Send the No-Op mail
+if [ "$BUILD_STAT" = "NOOP" ]
+then
+ $SENDMAIL -t <<EOF
+From: $FROM
+Subject: svn $REVPREFIX$REV: NOOP ($TEST)
+To: $TO
+
+$REVPREFIX$REV: There is nothing to test.
+EOF
+ exit 0
+fi
+
 # Send the status mail
 MAILFILE="/tmp/svntest.$$"
 NEXT_PART="NextPart-$$"

-- 
Jani Averbach
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jul 11 19:16:28 2004

This is an archived mail posted to the Subversion Dev mailing list.