summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2023-04-01 21:01:01 -0700
committerJim Meyering <meyering@meta.com>2023-04-09 22:22:42 -0700
commit85e0e4fdd440ff41d12ce8f5fe7b30128a3cdb58 (patch)
tree83647d57e252db8e0b858303a2db8fa582564582 /tests
parent88b2d37c0a975b736841f66c1b64401bb4d329f3 (diff)
downloadgrep-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.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am11
-rwxr-xr-xtests/glibc-infloop30
2 files changed, 39 insertions, 2 deletions
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