bug-grep
[Top][All Lists]
Advanced

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

[PATCH 2/2] tests: add test for newly-fixed performance problem


From: Paolo Bonzini
Subject: [PATCH 2/2] tests: add test for newly-fixed performance problem
Date: Tue, 4 May 2010 17:37:44 +0200

* tests/backref-multibyte-slow: New.
* tests/Makefile.am: Add it.
---
 tests/Makefile.am            |    1 +
 tests/backref-multibyte-slow |   28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)
 create mode 100644 tests/backref-multibyte-slow

diff --git a/tests/Makefile.am b/tests/Makefile.am
index fae2c85..fb8259d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -30,6 +30,7 @@ TESTS =                                               \
   backref.sh                                   \
   backref-word                                 \
   bre.sh                                       \
+  backref-multibyte-slow                       \
   case-fold-backref                            \
   case-fold-backslash-w                                \
   case-fold-char-class                         \
diff --git a/tests/backref-multibyte-slow b/tests/backref-multibyte-slow
new file mode 100644
index 0000000..d0d2b53
--- /dev/null
+++ b/tests/backref-multibyte-slow
@@ -0,0 +1,28 @@
+#!/bin/sh
+# This was approximately quadratic up to grep-2.6.3
+: ${srcdir=.}
+. "$srcdir/init.sh"; path_prepend_ ../src
+
+require_en_utf8_locale_
+require_timeout_
+
+fail=0
+
+set -x
+# Create a 12288-line input
+echo aba | \
+  sed 'p;p;p;p;p;p;p' | \
+  sed 'p;p;p;p;p;p;p' | \
+  sed 'p;p;p;p;p;p;p' | \
+  sed 'p;p;p;p;p;p;p' | \
+  sed 'p;p' > in
+
+  wc -l in
+for LOC in en_US.UTF-8; do
+  out=out-$LOC
+  LC_ALL=$LOC timeout 5s grep -E '^([a-z]).\1$' in > $out 2>&1
+  test $? = 0 || fail=1
+  compare $out in || fail=1
+done
+
+Exit $fail
-- 
1.6.6.1





reply via email to

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