testing: Also capture stderr during test cases

The output was not correct otherwise due to the reordering of commands.
This commit is contained in:
Tobias Brunner 2017-07-14 11:22:27 +02:00
parent 87c6247e0d
commit f0d051f192
1 changed files with 3 additions and 1 deletions

View File

@ -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