diff mbox series

external/test: Display test dir on failure

Message ID 20171128070127.20932-1-oohall@gmail.com
State Accepted
Headers show
Series external/test: Display test dir on failure | expand

Commit Message

Oliver O'Halloran Nov. 28, 2017, 7:01 a.m. UTC
Print some information about the failing test rather than forcing the
user to go dig it up. Also move the stdout and stderr files into the
test directory to make the relevant stdout/stderr files easier to
locate.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 external/test/test.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Stewart Smith Nov. 29, 2017, 5:52 a.m. UTC | #1
Oliver O'Halloran <oohall@gmail.com> writes:
> Print some information about the failing test rather than forcing the
> user to go dig it up. Also move the stdout and stderr files into the
> test directory to make the relevant stdout/stderr files easier to
> locate.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
>  external/test/test.sh | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Some fool didn't do it this way originally. I have no idea who that fool
is, but they keep looking at me weirdly in the mirror.

Merged to master as of afe10960c138295dfeb79f55d79abc5167a126a7
diff mbox series

Patch

diff --git a/external/test/test.sh b/external/test/test.sh
index c3bbc61c197d..7a60c93280a7 100755
--- a/external/test/test.sh
+++ b/external/test/test.sh
@@ -27,6 +27,10 @@  run_binary() {
 
 fail_test() {
 	echo "$0 ($CUR_TEST): test failed";
+	echo "Test directory preserved:"
+	echo "  DATA_DIR = $DATA_DIR"
+	echo "  STDOUT = $STDOUT_OUT"
+	echo "  STDERR = $STDERR_OUT"
 	exit ${1:-1};
 }
 
@@ -76,9 +80,9 @@  run_tests() {
 		exit 1;
 	fi
 
-	export STDERR_OUT=$(mktemp --tmpdir external-test-stderr.XXXXXX);
-	export STDOUT_OUT=$(mktemp --tmpdir external-test-stdout.XXXXXX);
 	export DATA_DIR=$(mktemp --tmpdir -d external-test-datadir.XXXXXX);
+	export STDERR_OUT="$DATA_DIR/stderr"
+	export STDOUT_OUT="$DATA_DIR/stdout"
 	if [ $# -eq 3 ] ; then
 		cp -r $3/* "$DATA_DIR"
 	fi