<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6217">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pretty_print: Add options to show individual test output<br><br>--show-errors will show the test output if a test errors or<br>times out.<br><br>--verbose will show the test output regardless of status.<br><br>--plain will not use escape sequences to set colors.<br><br>--term-width=n will force the output to 'n' columns regardless of<br>actual terminal width.<br><br>Change-Id: I4a407214d4a16f460efc27c73a76498ec158d386<br>---<br>M contrib/scripts/pretty_print<br>1 file changed, 53 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/17/6217/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/contrib/scripts/pretty_print b/contrib/scripts/pretty_print<br>index 5544652..5c35cf6 100755<br>--- a/contrib/scripts/pretty_print<br>+++ b/contrib/scripts/pretty_print<br>@@ -13,11 +13,42 @@<br> exit 1<br> fi<br> <br>+SHOW_ERRORS=0<br>+VERBOSE=0<br>+TERM_WIDTH=$(tput cols)<br>+PLAIN=0<br>+for a in "$@" ; do<br>+ OPTION_COUNT+=1<br>+ case "$a" in<br>+ --*=*)<br>+ [[ $a =~ --([^=]+)=(.*) ]]<br>+ l=${BASH_REMATCH[1]//-/_}<br>+ r=${BASH_REMATCH[2]}<br>+ eval ${l^^}=$r<br>+ ;;<br>+ --*)<br>+ [[ $a =~ --(.+) ]]<br>+ l=${BASH_REMATCH[1]//-/_}<br>+ eval ${l^^}=1<br>+ ;;<br>+ esac<br>+done<br>+<br> declare -ix test_timeout=0<br>+<br>+if [ $PLAIN -gt 0 ] ; then<br>+YELLOW=''<br>+GREEN=''<br>+RED=''<br>+BOLD=''<br>+NORM=''<br>+else<br> YELLOW='\033[01;33m'<br> GREEN='\033[01;32m'<br> RED='\033[01;31m'<br>+BOLD='\033[1m'<br> NORM='\033[m'<br>+fi<br> <br> status_string="[nnnn of nnnn][Status][Pass][Fail]"<br> <br>@@ -54,8 +85,13 @@<br> declare testname=""<br> starttime=$SECONDS<br> <br>+unset buffer<br>+declare -a buffer<br>+<br> trap 'kill $countpid &>/dev/null' INT ERR<br> while read line ; do<br>+ buffer+=("$line")<br>+<br> ### Running tests for Asterisk GIT-master-99dea9b (run 1 of 1)...<br> if [[ $line =~ ^Running\ tests\ for\ (Asterisk\ +[^\ ]+)\ +\(run\ +([0-9]+)\ +of\ +([0-9]+)\)\.\.\. ]] ; then<br> run=${BASH_REMATCH[2]}<br>@@ -68,18 +104,20 @@<br> export test_timeout=${BASH_REMATCH[4]}<br> echo ===========================================================================================<br> echo "${line/-1/unlimited}"<br>- col=$(( $(tput cols) - ${#status_string} ))<br>+ col=$(( ${TERM_WIDTH:-$(tput cols)} - ${#status_string} ))<br> printf "%-*.*s[%-12s][%s][${GREEN}%4s${NORM}][${RED}%4s${NORM}]\n" $col $col "Test" " Test" "Status" "Pass" "Fail"<br> fi<br> <br> if [[ $line =~ ^--\>.Running.test.\'(.+)\'.\.\.\. ]] ; then<br>+ unset buffer<br>+ declare -a buffer<br> (( tests++ ))<br>- col=$(( $(tput cols) - ${#status_string} -1 ))<br>+ col=$(( ${TERM_WIDTH:-$(tput cols)} - ${#status_string} -1 ))<br> testname=${BASH_REMATCH[1]#*/}<br> tnl=$(( ${#testname} - $col ))<br> [ $tnl -le 0 ] && tnl=0<br> testname=${testname:$tnl}<br>- printf "%-*.*s [%4d of %4d]" $col $col ${testname} $tests $runnable<br>+ printf "${BOLD}%-*.*s${NORM} [%4d of %4d]" $col $col ${testname} $tests $runnable<br> st=$SECONDS<br> counter &<br> disown $!<br>@@ -89,15 +127,17 @@<br> if [[ $line =~ ^Test.*tests/([^\']+)\',.*(passed|failed|timed\ out)$ ]] ; then<br> test=${BASH_REMATCH[1]}<br> status=${BASH_REMATCH[2]}<br>- col=$(( $(tput cols) - ${#status_string} ))<br>+ col=$(( ${TERM_WIDTH:-$(tput cols)} - ${#status_string} ))<br> et=$(( $SECONDS - $st ))<br> kill $countpid<br>+ show=0<br> <br> if [[ $status = passed ]] ; then<br> (( passed++ ))<br> COLOR=${GREEN}<br> label=Passed<br> [[ $et -gt $maxelapsed ]] && maxelapsed=$et<br>+ [ $VERBOSE -gt 0 ] && show=1<br> fi<br> if [[ $status = failed ]] ; then<br> (( failed++ ))<br>@@ -105,6 +145,7 @@<br> label=Failed<br> failures+=("FAILED: $test")<br> [[ $et -gt $maxelapsed ]] && maxelapsed=$et<br>+ [ $SHOW_ERRORS -gt 0 -o $VERBOSE -gt 0 ] && show=1<br> fi<br> if [[ $status = "timed out" ]] ; then<br> (( failed++ ))<br>@@ -112,8 +153,16 @@<br> COLOR=${RED}<br> label=Hung!!<br> timeouts+=("TIMEDOUT: $test")<br>+ [ $SHOW_ERRORS -gt 0 -o $VERBOSE -gt 0 ] && show=1<br> fi<br> printf "[${COLOR}%s${NORM}][${GREEN}%4d${NORM}][${RED}%4d${NORM}]\n" $label $passed $failed<br>+ if [ $show -gt 0 ] ; then<br>+ echo ---------------------------------------------------------------------<br>+ printf "%s\n" "${buffer[@]}"<br>+ echo ---------------------------------------------------------------------<br>+ fi<br>+ unset buffer<br>+ declare -a buffer<br> fi<br> <br> done<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6217">change 6217</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6217"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I4a407214d4a16f460efc27c73a76498ec158d386 </div>
<div style="display:none"> Gerrit-Change-Number: 6217 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>