From 651170db9a801ccd454caffd92ca4fa6a6d9a3ae Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 11 Jan 2020 18:12:23 -0500 Subject: [PATCH] Revise run-and-email scripts. --- test/run-and-email.sh | 51 +++++++++++++++++++----------------- test/stdlib/run-and-email.sh | 41 +++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 26 deletions(-) diff --git a/test/run-and-email.sh b/test/run-and-email.sh index a97dba90..a23c955c 100755 --- a/test/run-and-email.sh +++ b/test/run-and-email.sh @@ -27,30 +27,33 @@ for VERSION in $PYVERSIONS ; do typeset -i rc=0 LOGFILE=/tmp/pyenvlib-$VERSION-$$.log - if [[ $VERSION == '3.5.9' ]] ; then - MAX_TESTS=237 # We start failing on "mailbox" at 238 - elif [[ $VERSION == '3.2.6' ]] ; then - MAX_TESTS=172 # We start failing on pkgutil.py - elif [[ $VERSION == '3.3.7' ]] ; then - MAX_TESTS=180 # We start failing on pkgutil.py - elif [[ $VERSION == '3.4.10' ]] ; then - MAX_TESTS=30 # We start failing on aifc - elif [[ $VERSION == '3.6.9' ]] ; then - MAX_TESTS=92 # We start failing on cgiltb.py - elif [[ $VERSION == '3.7.6' ]] ; then - continue - elif [[ $VERSION == '3.8.1' ]] ; then - continue - elif [[ $VERSION == '3.1.5' ]] ; then - continue - elif [[ $VERSION == '3.0.1' ]] ; then - continue - elif [[ $VERSION == '2.6.9' ]] ; then - MAX_TESTS=1300 - continue - else - MAX_TESTS=800 - fi + case "$VERSION" in + 3.7.6 | 3.8.1 | 3.1.5 | 3.0.1 ) + continue + ;; + 3.5.9 ) + MAX_TESTS=237 # We start failing on "mailbox" at 238 + ;; + 3.2.6 ) + MAX_TESTS=172 # We start failing on pkgutil.py + ;; + 3.3.7 ) + MAX_TESTS=180 # We start failing on pkgutil.py + ;; + 3.4.10 ) + MAX_TESTS=30 # We start failing on aifc + ;; + 3.6.9 ) + MAX_TESTS=92 # We start failing on cgiltb.py + ;; + 2.6.9 ) + MAX_TESTS=1300 + ;; + * ) + MAX_TESTS=800 + ;; + esac + actual_versions="$actual_versions $VERSION" if ! pyenv local $VERSION ; then diff --git a/test/stdlib/run-and-email.sh b/test/stdlib/run-and-email.sh index 9ebbe53c..68f06165 100755 --- a/test/stdlib/run-and-email.sh +++ b/test/stdlib/run-and-email.sh @@ -1,16 +1,48 @@ #!/bin/bash + +function displaytime { + printf "ran in " + local T=$1 + local D=$((T/60/60/24)) + local H=$((T/60/60%24)) + local M=$((T/60%60)) + local S=$((T%60)) + (( $D > 0 )) && printf '%d days ' $D + (( $H > 0 )) && printf '%d hours ' $H + (( $M > 0 )) && printf '%d minutes ' $M + (( $D > 0 || $H > 0 || $M > 0 )) && printf 'and ' + printf '%d seconds\n' $S +} + +. ../../admin-tools/pyenv-newer-versions + USER=${USER:-rocky} EMAIL=${EMAIL:-rb@dustyfeet.com} SUBJECT_PREFIX="stdlib unit testing for" -for VERSION in 2.6.9 2.7.17 3.4.10 3.5.9 3.6.9 ; do + +typeset -i RUN_STARTTIME=$(date +%s) + +actual_versions="" +DEBUG="" # -x + +for VERSION in $PYVERSIONS ; do typeset -i rc=0 LOGFILE=/tmp/runtests-$VERSION-$$.log + + case "$VERSION" in + 3.0.1 | 3.1.5 | 3.2.6 | 3.7.6 | 3.8.1 ) + continue + ;; + esac + actual_versions="$actual_versions $VERSION" + if ! pyenv local $VERSION ; then rc=1 else - /bin/bash ./runtests.sh >$LOGFILE 2>&1 + STOP_ONERROR=0 /bin/bash $DEBUG ./runtests.sh >$LOGFILE 2>&1 rc=$? fi + SUBJECT_PREFIX="runtests verify for" if ((rc == 0)); then tail -v $LOGFILE | mail -s "$SUBJECT_PREFIX $VERSION ok" ${USER}@localhost else @@ -18,3 +50,8 @@ for VERSION in 2.6.9 2.7.17 3.4.10 3.5.9 3.6.9 ; do tail -v $LOGFILE | mail -s "$SUBJECT_PREFIX $VERSION not ok" $EMAIL fi done + +typeset -i RUN_ENDTIME=$(date +%s) +(( time_diff = RUN_ENDTIME - RUN_STARTTIME)) +elapsed_time=$(displaytime $time_diff) +echo "Run complete $elapsed_time for versions $actual_versions" | mail -s "runtests in $elapsed_time" ${EMAIL}