]> granicus.if.org Git - python/commitdiff
Two new functions:
authorSkip Montanaro <skip@pobox.com>
Fri, 15 Feb 2008 19:03:59 +0000 (19:03 +0000)
committerSkip Montanaro <skip@pobox.com>
Fri, 15 Feb 2008 19:03:59 +0000 (19:03 +0000)
  * place_summary_first copies the regrtest summary to the front of the file
    making it easier to scan quickly for problems.

  * count_failures gets the actual count of the number of failing tests, not
    just a 1 (some failures) or 0 (no failures).

Misc/build.sh

index 0500cb25a0f3556aae24a7f2ad53943b8b2920b3..690b92046ac78b0ebad18e985bb645f6b9baa345 100755 (executable)
@@ -90,6 +90,24 @@ update_status() {
     echo "<li><a href=\"$2\">$1</a> <font size=\"-1\">($time seconds)</font></li>" >> $RESULT_FILE
 }
 
+place_summary_first() {
+    testf=$1
+    sed -n '/^[0-9][0-9]* tests OK\./,$p' < $testf \
+       | egrep -v '\[[0-9]+ refs\]' > $testf.tmp
+    echo "" >> $testf.tmp
+    cat $testf >> $testf.tmp
+    mv $testf.tmp $testf
+}
+
+count_failures () {
+    testf=$1
+    n=`grep -ic " failed:" $testf`
+    if [ $n -eq 1 ] ; then
+       n=`grep " failed:" $testf | sed -e 's/ .*//'`
+    fi
+    echo $n
+}
+
 mail_on_failure() {
     if [ "$NUM_FAILURES" != "0" ]; then
         dest=$FAILURE_MAILTO
@@ -185,14 +203,16 @@ if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then
             F=make-test.out
             start=`current_time`
             $PYTHON $REGRTEST_ARGS >& build/$F
-            NUM_FAILURES=`grep -ic " failed:" build/$F`
+            NUM_FAILURES=`count_failures build/$F`
+            place_summary_first build/$F
             update_status "Testing basics ($NUM_FAILURES failures)" "$F" $start
             mail_on_failure "basics" build/$F
 
             F=make-test-opt.out
             start=`current_time`
             $PYTHON -O $REGRTEST_ARGS >& build/$F
-            NUM_FAILURES=`grep -ic " failed:" build/$F`
+            NUM_FAILURES=`count_failures build/$F`
+            place_summary_first build/$F
             update_status "Testing opt ($NUM_FAILURES failures)" "$F" $start
             mail_on_failure "opt" build/$F
 
@@ -204,6 +224,7 @@ if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then
             $PYTHON $REGRTEST_ARGS -R 4:3:$REFLOG -u network $LEAKY_SKIPS >& build/$F
            LEAK_PAT="($LEAKY_TESTS|sum=0)"
             NUM_FAILURES=`egrep -vc "$LEAK_PAT" $REFLOG`
+            place_summary_first build/$F
             update_status "Testing refleaks ($NUM_FAILURES failures)" "$F" $start
             mail_on_failure "refleak" $REFLOG "$LEAK_PAT"
 
@@ -213,7 +234,8 @@ if [ $err = 0 -a "$BUILD_DISABLED" != "yes" ]; then
             ## skip curses when running from cron since there's no terminal
             ## skip sound since it's not setup on the PSF box (/dev/dsp)
             $PYTHON $REGRTEST_ARGS -uall -x test_curses test_linuxaudiodev test_ossaudiodev >& build/$F
-            NUM_FAILURES=`grep -ic " failed:" build/$F`
+            NUM_FAILURES=`count_failures build/$F`
+            place_summary_first build/$F
             update_status "Testing all except curses and sound ($NUM_FAILURES failures)" "$F" $start
             mail_on_failure "all" build/$F
         fi