Source-Changes-HG archive

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

[src/trunk]: src/tests/usr.bin/make Replace use of tr to translate '-' in tes...



details:   https://anonhg.NetBSD.org/src/rev/81cb5afcfc55
branches:  trunk
changeset: 943777:81cb5afcfc55
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Sep 10 17:33:16 2020 +0000

description:
Replace use of tr to translate '-' in test names into '_' to satisfy ATF
requirements (correct sh variable/function name syntax).  Use a sh
loop instead, and save one fork() one vfork() and one exec of tr for
each test case (many of which don't need anything done to them at all).

This might partially mitigate PR misc/55595

diffstat:

 tests/usr.bin/make/t_make.sh |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r 34c5f036374f -r 81cb5afcfc55 tests/usr.bin/make/t_make.sh
--- a/tests/usr.bin/make/t_make.sh      Thu Sep 10 17:26:38 2020 +0000
+++ b/tests/usr.bin/make/t_make.sh      Thu Sep 10 17:33:16 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_make.sh,v 1.9 2020/08/15 01:50:54 rillig Exp $
+# $NetBSD: t_make.sh,v 1.10 2020/09/10 17:33:16 kre Exp $
 #
 # Copyright (c) 2008, 2010, 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -81,7 +81,14 @@
            include-sub*) continue;;
            esac
 
-           atfname="$(echo "${basename}" | tr "x-" "x_")"
+           atfname=${basename}
+           while :
+           do
+               case "${atfname}" in
+               (*-*)   atfname=${atfname%-*}_${atfname##*-};;
+               (*)     break;;
+               esac
+           done
            descr='' # XXX
             test_case "${atfname}" "${basename}" "${descr}"
            atf_add_test_case "${atfname}"



Home | Main Index | Thread Index | Old Index