]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setarch: fix stderr handling in uname26 tests
authorHelge Deller <deller@gmx.de>
Wed, 27 May 2020 23:20:58 +0000 (23:20 +0000)
committerKarel Zak <kzak@redhat.com>
Thu, 28 May 2020 13:59:13 +0000 (15:59 +0200)
A while ago stdout and stderr have been split in these testcases, but
"FATAL: kernel too old" is actually treated as an "okay" output. However
this FATAL ends up on stderr, so when it happens, it is not seen in
the captured stdout.

Fix this by merging stdout/stderr in these cases once again.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=961639
Fixes: cbf858aa085e25aa5afd1d06decaea6e14a8963f
tests/ts/misc/setarch

index 7c99ccad2ed40bcbca8c429beec446fbd90eecba..6c872bf70f106b22fc79241df67f6bcf1bbce20c 100755 (executable)
@@ -45,22 +45,22 @@ ts_init_subtest uname26
 finmsg="" # for debugging 2.6 issues
 
 echo "###### --uname-2.6 echo" >>$TS_OUTPUT
-$TS_CMD_SETARCH $ARCH -v --uname-2.6 echo "2.6 worked" >> $TS_OUTPUT 2>> $TS_ERRLOG
+$TS_CMD_SETARCH $ARCH -v --uname-2.6 echo "2.6 worked" >> $TS_OUTPUT 2>&1
 if [ $? -eq 0 ]; then
        expected='^2.6 worked$'
 else
-       # this may happen after execvp
+       # this may happen after execvp - gets written to stderr
        expected="^FATAL: kernel too old$"
        finmsg+=" echo"
 fi
 sed -i "$ s/$expected/2.6 works or kernel too old/" $TS_OUTPUT
 
 echo "###### --uname-2.6 true, non-verbose" >>$TS_OUTPUT
-$TS_CMD_SETARCH $ARCH --uname-2.6 true >> $TS_OUTPUT 2>> $TS_ERRLOG
+$TS_CMD_SETARCH $ARCH --uname-2.6 true >> $TS_OUTPUT 2>&1
 if [ $? -eq 0 ]; then
        echo "2.6 works or kernel too old" >> $TS_OUTPUT
 else
-       # this may happen after execvp
+       # this may happen after execvp - gets written to stderr
        expected="^FATAL: kernel too old$"
        sed -i "$ s/$expected/2.6 works or kernel too old/" $TS_OUTPUT
        finmsg+=" true"