From a86e79c4510dee3398d863a3892d75158db5eab1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 8 Jan 2016 19:23:25 -0800 Subject: [PATCH] tests: do use "yes" but via an AWK replacement Also, use sed Nq in place of head -N * tests/init.cfg (yes): Define. * tests/max-count-overread: Revert to using "yes". * tests/mb-non-UTF8-performance: Likewise, and use "sed Nq" in place of head -N. --- tests/init.cfg | 3 +++ tests/max-count-overread | 2 +- tests/mb-non-UTF8-performance | 4 +--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/init.cfg b/tests/init.cfg index be03357..1c7baaa 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -200,3 +200,6 @@ user_time_() $child_user *= 1000; print int ($child_user + 0.5)' "$@" } + +# yes is not portable, fake it with $AWK +yes() { ${AWK-awk} 'BEGIN{for (;;) print "'"$*"'"}'; } diff --git a/tests/max-count-overread b/tests/max-count-overread index ec98ac8..d7aafd6 100755 --- a/tests/max-count-overread +++ b/tests/max-count-overread @@ -9,7 +9,7 @@ fail=0 echo x > exp || framework_failure_ -${AWK-awk} 'BEGIN{for (;;) print "x"}' | timeout 3 grep -m1 x > out || fail=1 +yes x | timeout 3 grep -m1 x > out || fail=1 compare exp out || fail=1 Exit $fail diff --git a/tests/mb-non-UTF8-performance b/tests/mb-non-UTF8-performance index c350dfb..3f9209c 100755 --- a/tests/mb-non-UTF8-performance +++ b/tests/mb-non-UTF8-performance @@ -31,9 +31,7 @@ expensive_ # the unibyte test takes at least 10ms of user time. n_lines=100000 while :; do - ${AWK-awk} -v n_lines=$n_lines \ - 'BEGIN {while (n_lines--) printf "%078d\n", 0}' in || - framework_failure_ + yes $(printf '%078d' 0) | sed ${n_lines}q > in || framework_failure_ ubyte_ms=$(LC_ALL=C user_time_ 1 grep -i foobar in) || fail=1 test $ubyte_ms -ge 10 && break n_lines=$(expr $n_lines + 200000) -- 2.6.4