tech-toolchain archive

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

Re: Slow test execution for usr.bin/make



On Thu, Sep 10, 2020 at 04:45:45PM +0700, Robert Elz wrote:
 > martin%duskware.de@localhost said:
 >   | Right, but the external tr process will not be run for each of them,
 >   | so there will be a serious speedup (and we have other test programs
 >   | with quite high number of test cases).
 > 
 > I am currently testing a (fairly simple) mod to tests/usr.bin/make/t_make.sh
 > which will remove that command substitution running tr with shell code.

oh, I completely misunderstood; I thought from the various reports
that the tr was buried inside atf_add_test_case and failed to see it
in the script when I looked at the script.

Straightforward case of a shell loop that should be a pipeline...
something like this (not actually tested) should serve:

-	for filename in "$(atf_get_srcdir)"/unit-tests/*.mk ; do
-	    basename="${filename##*/}"
-	    basename="${basename%.mk}"
-	    atfname="$(echo "${basename}" | tr "x-" "x_")"
+	for test in "$(ls "$(atf_get_srcdir)"/unit-tests/*.mk |\
+			sed 's,.*/,,;s,\.mk$,,;h;y/-/_/;G;s,\n,/,')"; do
+	    atfname="${test%/*}"
+	    basename="${test#*/}"

and of course for maintainability one should write that seddery in awk
instead and make the $() part a separate shell function, but it
doesn't fit as neatly in an email that way. :-)

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index