summaryrefslogtreecommitdiff
path: root/tests/init.cfg
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2021-08-09 13:09:55 -0700
committerJim Meyering <meyering@fb.com>2021-08-09 17:56:31 -0700
commit6aaef3b8a7f109ab8f39fd46ede01aebbd9f8205 (patch)
treef2818bccf74df782e67a37b0d023e43021f4cf8e /tests/init.cfg
parent2192cabb7adae528ebc411cd479cdc74804abd14 (diff)
downloadgrep-6aaef3b8a7f109ab8f39fd46ede01aebbd9f8205.tar.gz
tests: provide an awk-based seq replacement
...so we can continue to use seq, but the wrapper when needed. * tests/init.cfg (seq): Some systems lask seq. Provide a replacement. * tests/hash-collision-perf: Use seq once again. * tests/long-pattern-perf: Likewise. And remove a comment about seq.
Diffstat (limited to 'tests/init.cfg')
-rw-r--r--tests/init.cfg14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/init.cfg b/tests/init.cfg
index 4abe55ae..72cab203 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -204,3 +204,17 @@ user_time_()
# yes is not portable, fake it with $AWK
yes() { line=${*-y} ${AWK-awk} 'BEGIN{for (;;) print ENVIRON["line"]}'; }
+
+# Some systems lack seq.
+# A limited replacement for seq: handle 1 or 2 args; increment must be 1
+if ! type seq > /dev/null 2>&1; then
+ seq()
+ {
+ case $# in
+ 1) start=1 final=$1;;
+ 2) start=$1 final=$2;;
+ *) echo you lose 1>&2; exit 1;;
+ esac
+ awk 'BEGIN{for(i='$start';i<='$final';i++) print i}' < /dev/null
+ }
+fi