grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v3.6-32-g6aaef3b


From: Jim Meyering
Subject: grep branch, master, updated. v3.6-32-g6aaef3b
Date: Mon, 9 Aug 2021 20:57:29 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  6aaef3b8a7f109ab8f39fd46ede01aebbd9f8205 (commit)
      from  2192cabb7adae528ebc411cd479cdc74804abd14 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=6aaef3b8a7f109ab8f39fd46ede01aebbd9f8205


commit 6aaef3b8a7f109ab8f39fd46ede01aebbd9f8205
Author: Jim Meyering <meyering@fb.com>
Date:   Mon Aug 9 13:09:55 2021 -0700

    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.

diff --git a/tests/hash-collision-perf b/tests/hash-collision-perf
index 52266b6..898b496 100755
--- a/tests/hash-collision-perf
+++ b/tests/hash-collision-perf
@@ -28,8 +28,7 @@ fail=0
 # for digits, which never exhibited a problem with hash collisions.
 n_pat=40000
 while :; do
-  script="BEGIN { for (i = 1; i <= $n_pat; i++) print i }"
-  ${AWK-awk} "$script" < /dev/null > in || framework_failure_
+  seq $n_pat > in || framework_failure_
   small_ms=$(LC_ALL=C user_time_ 1 grep --file=in empty) || fail=1
   test $small_ms -ge 200 && break
   n_pat=$(expr $n_pat '*' 2)
@@ -37,8 +36,7 @@ done
 
 # Now, search for those same digits mapped to A-J.
 # With the PJW-based hash function, this became O(N^2).
-script="BEGIN { for (i = 1; i <= $n_pat; i++) print i }"
-${AWK-awk} "$script" </dev/null | tr 0-9 A-J > in || framework_failure_
+seq $n_pat | tr 0-9 A-J > in || framework_failure_
 large_ms=$(LC_ALL=C user_time_ 1 grep --file=in empty) || fail=1
 
 # Deliberately recording in an unused variable so it
diff --git a/tests/init.cfg b/tests/init.cfg
index 4abe55a..72cab20 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
diff --git a/tests/long-pattern-perf b/tests/long-pattern-perf
index a4cb089..8151c1a 100755
--- a/tests/long-pattern-perf
+++ b/tests/long-pattern-perf
@@ -27,8 +27,7 @@ expensive_
 
 echo x > in || framework_failure_
 # Note that we want 10x the byte count (not line count) in the larger file.
-script='BEGIN { for (i=10000; i<=50000; i++) printf "%d", i }'
-${AWK-awk} "$script" < /dev/null > r || framework_failure_
+seq 10000 50000 | tr -d '\012' > r || framework_failure_
 cat r r r r r r r r r r > re-10x || framework_failure_
 mv r re || framework_failure_
 

-----------------------------------------------------------------------

Summary of changes:
 tests/hash-collision-perf |  6 ++----
 tests/init.cfg            | 14 ++++++++++++++
 tests/long-pattern-perf   |  3 +--
 3 files changed, 17 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]