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

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

From: Jani Averbach <jaa_at_jaa.iki.fi>
Date: 2004-08-09 02:59:41 CEST

On 2004-07-24 05:41+0200, Branko ??ibej wrote:
>
> The idea itself is nice, but the patch itself assumes that you have one
> copy of apr-*, httpd and svn for testing. In my case, I use a single
> copy of apr and httpd with three different svn working copies (trunk,
> 1.0.x, 1.1.x); so with your patch, if I run the tests in that order and,
> e.g., APR gets updated during the trunk tests, but not during the 1.0.x
> tests, and there are no changes in 1.0.x, the 1.0.x tests would be
> skipped -- clearly not what you want.

I first though that preventing this behaviour is not worth of trouble,
but I found easy enough way to address your concerns. I will commit
following patch after some test runs if nothing shows up.

> Also, there should be a way to force the tests regardless of actual
> changes; e.g., of you want to restart them after they failed because of
> a problem with the testing box, for example.

With the new system you could do ie. echo '0' > svn_1.1.rb
or echo '0' > apr-util-0.9.rb. ('0' will force rebuilding,
as opposite to old system when '1' did the trick).

Thanks for comments!

BR, Jani

Log:
The svntest framework won't run tests if there aren't any changes to test.
This commit will change the meaning of data in rebuild flag file, the
content is now '0' or epoc timestamp in seconds.

* tools/test-scripts/svntest/svntest.sh
   Abort testing if all rebuild flags are zero and
   the rebuild sequence of projects is in the correct order.

* 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'.

* tools/test-scripts/svntest/README
   Updated documentation.

* tools/test-scripts/svntest/svntest-rebuild-generic.sh
   (NEXT_PROJ, PREV_PROJ) Renamed, and changed the meaning of the second
   argument, it is now the name of previous project.

Patch:
Index: svntest.sh
===================================================================
--- svntest.sh (revision 10341)
+++ svntest.sh (working copy)
@@ -20,17 +20,31 @@
     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 -ne 0 -a $RB_APU -ne 0 -a $RB_HTTPD -ne 0 -a $RB_SVN -ne 0 \
+ -a $RB_APR -lt $RB_APU -a $RB_APU -lt $RB_HTTPD -a $RB_HTTPD -lt $RB_SVN ];
+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-rebuild-generic.sh "$APR_NAME" "" "$MAKE_OPTS" || {
     $EXEC_PATH/svntest-sendmail.sh "update" "" "" "FAIL"
     exit
 }
-$EXEC_PATH/svntest-rebuild-generic.sh "$APU_NAME" "$HTTPD_NAME" "$MAKE_OPTS" || {
+$EXEC_PATH/svntest-rebuild-generic.sh "$APU_NAME" "$APR_NAME" "$MAKE_OPTS" || {
     $EXEC_PATH/svntest-sendmail.sh "update" "" "" "FAIL"
     exit
 }
 # httpd won't build with parallel make
-$EXEC_PATH/svntest-rebuild-generic.sh "$HTTPD_NAME" "" "" || {
+$EXEC_PATH/svntest-rebuild-generic.sh "$HTTPD_NAME" "$APU_NAME" "" || {
     $EXEC_PATH/svntest-sendmail.sh "update" "" "" "FAIL"
     exit
 }
Index: svntest-update.sh
===================================================================
--- svntest-update.sh (revision 10341)
+++ svntest-update.sh (working copy)
@@ -11,33 +11,45 @@
 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
+# Possible values of the status file:
+# 0 == rebuild needed
+# timestamp == timestamp of last build
 #
+# 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
+ echo "0" > "$RB_FILE"
+ else
+ if test "$UP_STATUS" -eq 0
         then
- echo "1" > "$RB_FILE"
- else
             echo "0" > "$RB_FILE"
         fi
     fi
@@ -51,7 +63,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 +72,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 +81,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 +91,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: svntest-rebuild.sh
===================================================================
--- svntest-rebuild.sh (revision 10341)
+++ svntest-rebuild.sh (working copy)
@@ -71,3 +71,7 @@
     FAIL
 }
 PASS
+
+START "$SVN_NAME::rebuild flag" "Updating rebuild flag..."
+$DATE "+%s" > "$TEST_ROOT/$SVN_NAME.rb" || FAIL
+PASS
Index: svntest-sendmail.sh
===================================================================
--- svntest-sendmail.sh (revision 10341)
+++ 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-$$"
Index: README
===================================================================
--- README (revision 10341)
+++ README (working copy)
@@ -130,7 +130,7 @@
    Subversion, build and test all the configurations.
 
 8) If you like force rebuilding of some component, you could do:
- echo "1" > $PROJ_REPO.rb, dependencies are:
+ echo "0" > $PROJ_REPO.rb, dependencies are:
    apr-util depends on apr, and httpd depends on apr and apr-util.
    Any dependent project will be also rebuild.
    When you run this script first time, everything will be rebuilt
Index: svntest-rebuild-generic.sh
===================================================================
--- svntest-rebuild-generic.sh (revision 10341)
+++ svntest-rebuild-generic.sh (working copy)
@@ -6,7 +6,7 @@
 . "$EXEC_PATH/svntest-config.sh"
 
 PROJ_NAME="$1"
-NEXT_PROJ="$2"
+PREV_PROJ="$2"
 LOCAL_MAKE_OPTS="$3"
 
 test -z "$PROJ_NAME" && exit 1
@@ -21,9 +21,17 @@
     "Checking rebuild status of $PROJ_NAME..."
 test -f "$TEST_ROOT/$PROJ_NAME.rb" || FAIL
 REBUILD_PROJ="`$CAT $TEST_ROOT/$PROJ_NAME.rb`"
+if test ! -z "$PREV_PROJ"; then
+ test -f "$TEST_ROOT/$PREV_PROJ.rb" || FAIL
+ REBUILD_PREV_PROJ="`$CAT $TEST_ROOT/$PREV_PROJ.rb`"
+fi
 PASS
 
-if test $REBUILD_PROJ -eq 0 ; then
+if test ! -z "$PREV_PROJ" ; then
+ if test $REBUILD_PROJ -ne 0 -a $REBUILD_PREV_PROJ -lt $REBUILD_PROJ; then
+ exit 0
+ fi
+elif test $REBUILD_PROJ -ne 0 ; then
     exit 0
 fi
 
@@ -73,9 +81,7 @@
 PASS
 
 START "$PROJ_NAME::rebuild flag" "Updating rebuild flag..."
-echo "0" > "$TEST_ROOT/$PROJ_NAME.rb" || FAIL
-# force rebuilding of next depending project
-test -z "$NEXT_PROJ" || echo "1" > "$TEST_ROOT/$NEXT_PROJ".rb
+$DATE "+%s" > "$TEST_ROOT/$PROJ_NAME.rb" || FAIL
 PASS
 
 echo >> $LOG_FILE

-- 
Jani Averbach
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Aug 9 03:01:09 2004

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.