X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=maint%2Ftravis-ci_scripts%2Fcommon.bash;h=676b217234c6ba97c5b55d5f4d16fa58bcd2b349;hb=e861e4f0def5bf218042293ee8d0e748ec458011;hp=896a44c82ca7f518ac14658d9c8282b40f460dce;hpb=47749813ce6ff4520eaf390431672133d289f962;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/maint/travis-ci_scripts/common.bash b/maint/travis-ci_scripts/common.bash index 896a44c..676b217 100755 --- a/maint/travis-ci_scripts/common.bash +++ b/maint/travis-ci_scripts/common.bash @@ -1,5 +1,6 @@ #!/bin/bash +# "autodie" set -e TEST_STDERR_LOG=/tmp/dbictest.stderr @@ -14,13 +15,57 @@ fi tstamp() { echo -n "[$(date '+%H:%M:%S')]" ; } +ci_vm_state_text() { + echo " +========================== CI System information ============================ + += CPUinfo +$(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo) + += Meminfo +$(free -m -t) + += Diskinfo +$(sudo df -h) + +$(mount | grep '^/') + += Kernel info +$(uname -a) + += Network Configuration +$(ip addr) + += Network Sockets Status +$(sudo netstat -an46p | grep -Pv '\s(CLOSING|(FIN|TIME|CLOSE)_WAIT.?|LAST_ACK)\s') + += Processlist +$(sudo ps fuxa) + += Environment +$(env | grep -P 'TEST|HARNESS|MAKE|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v) + += Perl in use +$(perl -V) +=============================================================================" +} + run_or_err() { echo_err -n "$(tstamp) $1 ... " LASTCMD="$2" LASTEXIT=0 START_TIME=$SECONDS + + PRMETER_PIDFILE="$(tempfile)_$SECONDS" + # the double bash is to hide the job control messages + bash -c "bash -c 'echo \$\$ >> $PRMETER_PIDFILE; while true; do sleep 10; echo -n \"\${SECONDS}s ... \"; done' &" + LASTOUT=$( eval "$2" 2>&1 ) || LASTEXIT=$? + + # stop progress meter + for p in $(cat "$PRMETER_PIDFILE"); do kill $p ; done + DELTA_TIME=$(( $SECONDS - $START_TIME )) if [[ "$LASTEXIT" != "0" ]] ; then @@ -42,9 +87,6 @@ apt_install() { # flatten pkgs="$@" - # Need to do this at every step, the sources list may very well have changed - run_or_err "Updating APT available package list" "sudo apt-get update" - run_or_err "Installing Debian APT packages: $pkgs" "sudo apt-get install --allow-unauthenticated --no-install-recommends -y $pkgs" } @@ -114,7 +156,7 @@ parallel_installdeps_notest() { "echo \\ \"$MODLIST\" \\ | xargs -d '\\n' -n 1 -P $NUMTHREADS bash -c \\ - 'OUT=\$($TIMEOUT_CMD cpanm --notest \"\$@\" 2>&1 ) || (LASTEXIT=\$?; echo \"\$OUT\"; exit \$LASTEXIT)' \\ + 'OUT=\$(maint/getstatus $TIMEOUT_CMD cpanm --notest \"\$@\" 2>&1 ) || (LASTEXIT=\$?; echo \"\$OUT\"; exit \$LASTEXIT)' \\ 'giant space monkey penises' " }