[asterisk-commits] contrib/scripts: Update pretty print for changes in runtests... (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 3 12:53:36 CST 2015


Joshua Colp has submitted this change and it was merged.

Change subject: contrib/scripts: Update pretty_print for changes in runtests output
......................................................................


contrib/scripts: Update pretty_print for changes in runtests output

The output of runtests changed a bit so pretty_print needed to be tweaked

Change-Id: Ie8560f4d8b1197074c41a767e91f058ce77c337b
---
M contrib/scripts/pretty_print
1 file changed, 13 insertions(+), 14 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/contrib/scripts/pretty_print b/contrib/scripts/pretty_print
index 7174287..7dc5686 100755
--- a/contrib/scripts/pretty_print
+++ b/contrib/scripts/pretty_print
@@ -22,16 +22,19 @@
 col=$(( $(tput cols) - 36 ))
 
 counter() {
-	s=1
 	status=Running
+	startsec=$SECONDS
 	while(true) ; do
-		sleep 1
-		if [ $test_timeout -gt 0 -a $s -gt $(( ($test_timeout / 4) * 3 )) ] ; then
-			printf "${YELLOW}[%12s %3ss ]${NORM}" "Hung in" $(( $test_timeout - s ))
+		sleep 0.25
+		et=$(( $SECONDS - $startsec))
+		time_left=$(( $test_timeout - et ))
+		if [ $test_timeout -gt 0 -a $et -gt $(( ($test_timeout / 4) * 3 )) ] ; then
+			if [ $time_left -ge 0 ] ; then
+				printf "${YELLOW}[%12s %3ss ]${NORM}" "Hung in" $time_left
+			fi
 		else
-			printf "[%12s %3ss ]" "Running for" $s
+			printf "[%12s %3ss ]" "Running for" $et
 		fi
-		(( s++ ))
 		tput cub 20
 	done
 }
@@ -72,11 +75,12 @@
 		countpid=$!
 	fi
 
-	if [[ $line =~ ^Test.*tests/([^\']+)\',.*(passed|failed|timedout)$ ]] ; then
+	if [[ $line =~ ^Test.*tests/([^\']+)\',.*(passed|failed|timed\ out)$ ]] ; then
 		test=${BASH_REMATCH[1]}
 		status=${BASH_REMATCH[2]}
 		col=$(( $(tput cols) - 36 ))
 		et=$(( $SECONDS - $st ))
+		kill $countpid
 
 		if [[ $status = passed ]] ; then
 			(( passed++ ))
@@ -91,18 +95,17 @@
 			failures+=("FAILED: $test")
 			[[ $et -gt $maxelapsed ]] && maxelapsed=$et
 		fi
-		if [[ $status = timedout ]] ; then
+		if [[ $status = "timed out" ]] ; then
 			(( failed++ ))
 			(( timedout++ ))
 			COLOR=${RED}
 			label=Hung!!
 			timeouts+=("TIMEDOUT: $test")
 		fi
-		kill $countpid
 		printf "[${COLOR}%s${NORM}][${GREEN}%4d${NORM}][${RED}%4d${NORM}]\n" $label $passed $failed
 	fi
 
-	if [[ $line =~ TEST\ RESULTS ]] ; then
+	if [[ $line =~ (TEST\ RESULTS) ]] ; then
 		for fail in "${failures[@]}" ; do
 			echo -e "${RED}$fail${NORM}"
 		done
@@ -119,7 +122,3 @@
 trap - INT ERR
 
 kill $countpid &>/dev/null
-
-
-
-

-- 
To view, visit https://gerrit.asterisk.org/1733
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie8560f4d8b1197074c41a767e91f058ce77c337b
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list