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 Add a test where printf is run twice in...



details:   https://anonhg.NetBSD.org/src/rev/33895efcbe97
branches:  trunk
changeset: 433371:33895efcbe97
user:      kre <kre%NetBSD.org@localhost>
date:      Mon Sep 10 15:02:11 2018 +0000

description:
Add a test where printf is run twice in the same shell, and the
first invocation uses \c in a %b arg - make sure that 2nd invocation
is not affected by that  (it was until recently, for a very long time).

diffstat:

 tests/usr.bin/printf/printf.sh    |  11 ++++++++++-
 tests/usr.bin/printf/t_builtin.sh |   5 ++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r d5c86375d14c -r 33895efcbe97 tests/usr.bin/printf/printf.sh
--- a/tests/usr.bin/printf/printf.sh    Mon Sep 10 14:42:29 2018 +0000
+++ b/tests/usr.bin/printf/printf.sh    Mon Sep 10 15:02:11 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: printf.sh,v 1.1 2018/09/05 21:05:40 kre Exp $
+# $NetBSD: printf.sh,v 1.2 2018/09/10 15:02:11 kre Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1345,6 +1345,15 @@
        # This is undefined, though would be nice if we could rely upon it
        # expect "abcd"         %.1b            'a\c' 'b\c' 'c\c' 'd\c' '\c' e
 
+       # Check for interference from one instance of execution of
+       # a builtin printf execution to another
+       # (this makes no sense to test for standalone printf, and for which
+       # the tests don't handle ';' magic args, so this would not work)
+       if $BUILTIN_TEST
+       then
+               expect abcdefjklmno   %s%b%s abc 'def\c' ghi ';' %s%s jkl mno
+       fi
+
        return $RVAL
 }
 define b_SysV_echo_backslash_c 'Use of \c in arg to %b format'
diff -r d5c86375d14c -r 33895efcbe97 tests/usr.bin/printf/t_builtin.sh
--- a/tests/usr.bin/printf/t_builtin.sh Mon Sep 10 14:42:29 2018 +0000
+++ b/tests/usr.bin/printf/t_builtin.sh Mon Sep 10 15:02:11 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_builtin.sh,v 1.2 2018/09/08 18:24:01 kre Exp $
+# $NetBSD: t_builtin.sh,v 1.3 2018/09/10 15:02:11 kre Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -63,6 +63,9 @@
        for ARG
        do
                case "${ARG}" in
+               (';')   # Allow multiple commands
+                       COMMAND="${COMMAND} ; printf"
+                       ;;
                (*\'*)
                        # This is kind of odd, we need a working
                        # printf in order to test printf ...



Home | Main Index | Thread Index | Old Index