Browse Source

run-tests: Print command of failed test cases

This helps the developer to know which command to use when they want to run
a test manually, e.g. in a debugger.
Adrián Pérez de Castro 4 years ago
parent
commit
582bf54e5b
1 changed files with 9 additions and 2 deletions
  1. 9 2
      tools/run-tests

+ 9 - 2
tools/run-tests

@@ -46,6 +46,11 @@ else
 	}
 fi
 
+LAST_CMD=''
+function run_cmd () {
+	LAST_CMD="$*"
+	with_timeout "$@"
+}
 
 if [[ -z ${DUMB_CONSOLE} || ${DUMB_CONSOLE} -eq 0 ]] ; then
 	echo
@@ -76,7 +81,7 @@ for name in "${tests[@]}" ; do
 	fi
 
 	if [[ ${name} = roundtrip/* ]] ; then
-		if with_timeout \
+		if run_cmd \
 		   "${srcdir}/tools/hipack-roundtrip" \
 		   "${srcdir}/test/${name#roundtrip/}.hi" && \
 		   "${srcdir}/tools/hipack-roundtrip" -c \
@@ -87,7 +92,7 @@ for name in "${tests[@]}" ; do
 			passed=false
 		fi &> "/tmp/hipack-$$-${name//\//-}.err"
 	else
-		if with_timeout \
+		if run_cmd \
 		   "${srcdir}/tools/hipack-parse" \
 		   "${srcdir}/test/${name}.hi" \
 		   &> "/tmp/hipack-$$-${name}.err"
@@ -126,6 +131,8 @@ for name in "${tests[@]}" ; do
 		elif [[ -s /tmp/hipack-$$-${name//\//-}.err ]] ; then
 			cat "/tmp/hipack-$$-${name//\//-}.err"
 		fi
+		echo "Command: ${LAST_CMD}"
+		echo
 		echo
 	fi
 	rm -f "/tmp/hipack-$$-${name//\//-}.err"