diff options
author | Jim Meyering <meyering@fb.com> | 2023-04-01 21:01:01 -0700 |
---|---|---|
committer | Jim Meyering <meyering@meta.com> | 2023-04-09 22:22:42 -0700 |
commit | 85e0e4fdd440ff41d12ce8f5fe7b30128a3cdb58 (patch) | |
tree | 83647d57e252db8e0b858303a2db8fa582564582 | |
parent | 88b2d37c0a975b736841f66c1b64401bb4d329f3 (diff) | |
download | grep-85e0e4fdd440ff41d12ce8f5fe7b30128a3cdb58.tar.gz |
tests: add a known-failing glibc-infloop test
* tests/glibc-infloop: New file.
Based on the command from Koen Claessen
reported in https://bugs.gnu.org/62483
* configure.ac (USE_INCLUDED_REGEX): define.
* tests/Makefile.am (TESTS): Add the file name
* THANKS.in: Add name of reporter.
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 11 | ||||
-rwxr-xr-x | tests/glibc-infloop | 30 |
4 files changed, 41 insertions, 2 deletions
@@ -56,6 +56,7 @@ Karl Pettersson karl.pettersson@klpn.se Kaveh R. Ghazi ghazi@caip.rutgers.edu Kazuro Furukawa furukawa@apricot.kek.jp Keith Bostic bostic@bsdi.com +Koen Claessen koen@chalmers.se Krishna Sethuraman krishna@sgihub.corp.sgi.com Kurt D Schwehr kdschweh@insci14.ucsd.edu Ludovic Courtès ludo@gnu.org diff --git a/configure.ac b/configure.ac index 528349c6..13ec9056 100644 --- a/configure.ac +++ b/configure.ac @@ -212,6 +212,7 @@ dnl then the installer should configure --with-included-regex. AM_CONDITIONAL([USE_INCLUDED_REGEX], [test "$ac_use_included_regex" = yes]) if test "$ac_use_included_regex" = no; then AC_MSG_WARN([Included lib/regex.c not used]) + AC_DEFINE([USE_INCLUDED_REGEX], 1, [building with included regex code]) fi gl_FUNC_PCRE diff --git a/tests/Makefile.am b/tests/Makefile.am index 0ef96d44..7718f24a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,13 +46,19 @@ LDADD = ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a # The triple-backref test is expected to fail with both the system # matcher (i.e., with glibc) and with the included matcher. # Both matchers need to be fixed. -# FIXME-2015: Remove this once the glibc and gnulib bugs are fixed. +# FIXME-2025: Remove this once the glibc and gnulib bugs are fixed. XFAIL_TESTS = triple-backref +# The glibc-infloop test is expected to fail with both the system +# matcher (i.e., with glibc) and with the included matcher. +# Both matchers need to be fixed. +# FIXME-2025: Remove this once the glibc and gnulib bugs are fixed. +XFAIL_TESTS += glibc-infloop + # Equivalence classes are only supported when using the system # matcher (which means only with glibc). # The included matcher needs to be fixed. -# FIXME-2015: Remove this once the gnulib bug is fixed. +# FIXME-2025: Remove this once the gnulib bug is fixed. if USE_INCLUDED_REGEX XFAIL_TESTS += equiv-classes else @@ -108,6 +114,7 @@ TESTS = \ fillbuf-long-line \ fmbtest \ foad1 \ + glibc-infloop \ grep-dev-null \ grep-dev-null-out \ grep-dir \ diff --git a/tests/glibc-infloop b/tests/glibc-infloop new file mode 100755 index 00000000..cc8dc238 --- /dev/null +++ b/tests/glibc-infloop @@ -0,0 +1,30 @@ +#!/bin/sh +# This would infloop when using glibc's regex at least until glibc-2.36. +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +require_timeout_ +require_en_utf8_locale_ + +fail=0 + +cat <<\EOF > glibc-check.c +#include <features.h> +#ifdef __GLIBC__ +int ok; +#else +# error "not glibc" +#endif +EOF +$CC -c glibc-check.c && glibc=1 || glibc=0 + +grep '^#define USE_INCLUDED_REGEX 1' "$CONFIG_HEADER" \ + && included_regex=1 || included_regex=0 + +case $glibc:$included_regex in + 0:0) skip_ 'runs only with glibc or when built with the included regex' +esac + +echo a > in || framework_failure_ +timeout 2 env LC_ALL=en_US.UTF-8 grep -E -w '((()|a)|())*' in || fail=1 + +Exit $fail |