Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/bin/sh Fix a test that has been (unnoticed) failing ev...



details:   https://anonhg.NetBSD.org/src/rev/b2639cfae214
branches:  trunk
changeset: 1026283:b2639cfae214
user:      kre <kre%NetBSD.org@localhost>
date:      Tue Nov 16 11:15:26 2021 +0000

description:
Fix a test that has been (unnoticed) failing ever since printf(1) was
changed to exit(1) when it detects a write error to stdout.

Running printf with stdout closed is guaranteed to generate such a
condition.

Until the previous commit, while the test case was actually failing
(stderr was expected to be empty. and was not) this was unnoticed.
We don't want the output (obviously), we also don't want the error
message, so just direct the latter to /dev/null.

diffstat:

 tests/bin/sh/t_redir.sh |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 6cd2d5681c27 -r b2639cfae214 tests/bin/sh/t_redir.sh
--- a/tests/bin/sh/t_redir.sh   Tue Nov 16 11:12:14 2021 +0000
+++ b/tests/bin/sh/t_redir.sh   Tue Nov 16 11:15:26 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_redir.sh,v 1.12 2021/11/16 11:12:14 kre Exp $
+# $NetBSD: t_redir.sh,v 1.13 2021/11/16 11:15:26 kre Exp $
 #
 # Copyright (c) 2016 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -927,7 +927,7 @@
 
        echo '
                . ./f-def || echo >&2 FAIL
-               f >&-
+               f >&- 2>/dev/null
                printf "%s\n" stdin2
        ' | atf_check -s exit:0 -o inline:'stdin2\n' -e empty ${TEST_SH} ||
                atf_fail "stdin2 test failure"



Home | Main Index | Thread Index | Old Index