Module Name:    src
Committed By:   kre
Date:           Thu Sep 10 17:33:17 UTC 2020

Modified Files:
        src/tests/usr.bin/make: t_make.sh

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/usr.bin/make/t_make.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/make/t_make.sh
diff -u src/tests/usr.bin/make/t_make.sh:1.9 src/tests/usr.bin/make/t_make.sh:1.10
--- src/tests/usr.bin/make/t_make.sh:1.9	Sat Aug 15 01:50:54 2020
+++ src/tests/usr.bin/make/t_make.sh	Thu Sep 10 17:33:16 2020
@@ -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 @@ atf_init_test_cases()
 	    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}"

Reply via email to