Skip to content

Commit

Permalink
run-tests: Print command of failed test cases
Browse files Browse the repository at this point in the history
This helps the developer to know which command to use when they want to run
a test manually, e.g. in a debugger.
  • Loading branch information
aperezdc committed Dec 5, 2015
1 parent 1d6aa3b commit 582bf54
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tools/run-tests
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 582bf54

Please sign in to comment.