Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin/printf ATF runs shell script tests with "sh -e...



details:   https://anonhg.NetBSD.org/src/rev/95fbca53685d
branches:  trunk
changeset: 1009490:95fbca53685d
user:      kre <kre%NetBSD.org@localhost>
date:      Fri Apr 24 14:29:19 2020 +0000

description:
ATF runs shell script tests with "sh -e" (WHY???)

Compensate for that by adding an explicit test to a command so
-e will not kill the shell when the command (expectedly) fails.

Previously this was saved by /bin/sh disabling -e in command subs.

diffstat:

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

diffs (18 lines):

diff -r 97b3c7431bdc -r 95fbca53685d tests/usr.bin/printf/printf.sh
--- a/tests/usr.bin/printf/printf.sh    Fri Apr 24 13:54:56 2020 +0000
+++ b/tests/usr.bin/printf/printf.sh    Fri Apr 24 14:29:19 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: printf.sh,v 1.5 2019/11/12 18:59:51 kre Exp $
+# $NetBSD: printf.sh,v 1.6 2020/04/24 14:29:19 kre Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -178,7 +178,7 @@
        test -z "${RES}" &&
                atf_fail "$*  ... failed (${STAT}) without error message"
 
-       RES="$( do_printf "$@" 2>/dev/null ; echo X )"
+       RES="$( do_printf "$@" 2>/dev/null || : ; echo X )"
        RES=${RES%X}    # hack to defeat \n removal from $() output
 
        case "${RES}" in



Home | Main Index | Thread Index | Old Index