Skip to contentSkip to conversation

setarch: fix stderr handling in uname26 tests

PATCH Applied Chris Hofstaedtler 2 participants 2 messages May 27, 2020 – May 28, 2020 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 setarch: fix stderr handling in uname26 tests

From: Helge Deller <[email protected]>

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.

---
 tests/ts/misc/setarch | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/ts/misc/setarch +4 -4
index 7c99ccad2..6c872bf70 100755
@@ -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"
Signature · 1 line
2.27.0.rc2
maintainer Applied
#1 lore raw
Quoted 2 lines · Chris Hofstaedtler
 tests/ts/misc/setarch | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com