From f0d051f19225c7b9e99c9d522a4b304c57ed3337 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Fri, 14 Jul 2017 11:22:27 +0200 Subject: [PATCH] testing: Also capture stderr during test cases The output was not correct otherwise due to the reordering of commands. --- testing/do-tests | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/do-tests b/testing/do-tests index 97d7e45f7..ba2abb655 100755 --- a/testing/do-tests +++ b/testing/do-tests @@ -424,6 +424,7 @@ do { next } + printf("cmd_err=\044(tempfile -p test -s err); ") if (command == "tcpdump") { printf("if [ \044TDUP_%s == \"true\" ]; then stop_tcpdump %s; fi; \n", host, host) @@ -431,7 +432,7 @@ do } else { - printf("cmd_out=\044(ssh \044SSHCONF root@\044ipv4_%s %s | grep \"%s\"); ", host, command, pattern) + printf("cmd_out=\044(ssh \044SSHCONF root@\044ipv4_%s %s 2>\044cmd_err | grep \"%s\"); ", host, command, pattern) } printf("cmd_exit=\044?; ") printf("cmd_fail=0; ") @@ -456,6 +457,7 @@ do printf("echo \"%s# %s | grep \047%s\047 [%s]\"; ", host, command, pattern, hit) } printf("if [ -n \"\044cmd_out\" ]; then echo \"\044cmd_out\"; fi; \n") + printf("cat \044cmd_err; rm -f -- \044cmd_err; \n") printf("if [ \044cmd_fail -ne 0 ]; then echo \"~~~~~~~~~~~~~~~~~~~~\"; fi; \n") printf("echo; ") }' $TESTDIR/evaltest.dat` >> $CONSOLE_LOG 2>&1