From ebe9fb868b9d07ddcb5823f5d6beb4d99d93bfb1 Mon Sep 17 00:00:00 2001 From: Ingo Karkat Date: Wed, 25 Jan 2012 15:45:35 +0100 Subject: [PATCH] test-lib: Show full todo.sh output in verbose mode. Now that differences in the output (and exit code) are already printed by default, we can make the verbose mode actually "verbose" by including all todo.sh output generated during the test run. This may help in reviewing the tests and for troubleshooting. By moving the redirection to the output file to test_run_(), all testing-related embellishments have been removed from the command under test itself, resulting in much cleaner test messages. Additionally, also capture stderr in output. todo.sh itself currently prints everything to stdout (but the die() output probably belongs to stderr), so as of now, that has no consequences, but seems to be more consistent and future-proof. --- tests/test-lib.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 2368bd3..431231d 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -199,8 +199,9 @@ test_debug () { } test_run_ () { - eval >&3 2>&4 "$1" + eval > output 2>&1 "$1" eval_ret="$?" + cat >&3 output return 0 } @@ -594,9 +595,9 @@ test_todo_session () { "") if [ ! -z "$cmd" ]; then if [ $status = 0 ]; then - test_expect_output "$1 $subnum" "$cmd > output" + test_expect_output "$1 $subnum" "$cmd" else - test_expect_code_and_output "$status" "$1 $subnum" "$cmd > output" + test_expect_code_and_output "$status" "$1 $subnum" "$cmd" fi subnum=$(($subnum + 1)) @@ -612,9 +613,9 @@ test_todo_session () { done if [ ! -z "$cmd" ]; then if [ $status = 0 ]; then - test_expect_output "$1 $subnum" "$cmd > output" + test_expect_output "$1 $subnum" "$cmd" else - test_expect_code_and_output "$status" "$1 $subnum" "$cmd > output" + test_expect_code_and_output "$status" "$1 $subnum" "$cmd" fi fi }