summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* pcre: work around a PCRE2_MATCH_INVALID_UTF bugCarlo Marcelo Arenas Belón2023-04-302-0/+32
| | | | | | | | | | | | | | PCRE2 has a bug when using PCRE2_MATCH_INVALID_UTF: it would sometimes fail to match patterns using negative classes like \W and \D. * NEWS (Bug fixes): Mention it. * src/pcre2search.c: Restrict impact of the bug. Do not use the problematic flag with broken versions of PCRE2. Also, generate locale tables only for single-byte locales, as the PCRE2 documentation recommends this. * tests/Makefile.am (TESTS): Add the file name * tests/pcre-utf8-bug224: New file, to test for this.
* grep: improve PCRE2 version outputPaul Eggert2023-04-101-1/+1
| | | | | | | | | | * src/grep.c: No need to include pcre2.h. (main) [HAVE_LIBPCRE]: Call Pprint_version instead of doing it ourselves. * src/pcresearch.c (Pprint_version): New function. It also checks belatedly for buffer overflow, and says "grep -P uses PCRE2" instead of "Built with PCRE". * tests/version-pcre: Adjust test to match.
* tests: skip y2038 test upon touch setup failureJim Meyering2023-04-101-1/+1
| | | | | | * tests/y2038-vs-32-bit: Skip rather than fail, when the touch -t 2039... setup fails. That command failed on a solaris10 sparc build farm host.
* tests: add a known-failing glibc-infloop testJim Meyering2023-04-092-2/+39
| | | | | | | | | * 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.
* grep: --version: print pcre version infoJim Meyering2023-04-092-0/+17
| | | | | | | | | | PCRE is integral to the functioning of grep's -P option, so it is in our interest to make it easy to see which version of PCRE grep uses. * src/grep.c [HAVE_LIBPCRE]: Include <pcre2.h>. [HAVE_LIBPCRE] (main): Print pcre version info. * tests/version-pcre: New test for this. * tests/Makefile.am (TESTS): Add the file name. * NEWS (Changes in behavior): Mention it.
* tests: test for the year-2038 bugJim Meyering2023-04-092-0/+14
| | | | | * tests/y2038-vs-32-bit: New file. * tests/Makefile.am (TESTS): Add the file name
* grep: fix -P [\d] by fixing \w only if PCRE2 10.43Paul Eggert2023-04-022-13/+8
| | | | | | | | | | | | | | Our prepass-based fixes for the -P \d bug have caused repeated further bugs. Avoid the need for a prepass, by using PCRE2_UCP only if PCRE2_EXTRA_ASCII_BSD is also supported. Since the -P \w bug was present from grep 2.5 through 3.8 it’s OK if we wait a little longer to fix it. * NEWS: Mention this. * src/pcresearch.c (pcre_pattern_expand_backslash_d}: Remove. Remove its use. (Pcompile): Use PCRE2_UCP only if PCRE2_EXTRA_ASCII_BSD. * tests/pcre-ascii-digits, tests/pcre-utf8-w: Skip tests on older PCRE2 implementations.
* grep: -P (--perl-regexp) \D once again works like [^0-9]Jim Meyering2023-03-191-1/+32
| | | | | | | | | | | * NEWS: Mention \D, too. * doc/grep.texi: Likewise * src/pcresearch.c (pcre_pattern_expand_backslash_d): Handle \D. Also, ifdef-out this new function and its call site when not needed. * tests/pcre-ascii-digits: Test \D, too. Tighten one test by using returns_ 1. Add comments and tests that work only with 10.43 and newer. Paul Eggert raised the issue of \D in https://bugs.gnu.org/62267#8
* grep: -P (--perl-regexp) \d: match only ASCII digitsJim Meyering2023-03-182-0/+32
| | | | | | | | | | | | | | | | Prior to grep-3.9, the PCRE matcher had always treated \d just like [0-9]. grep-3.9's fix for \w and \b mistakenly relaxed \d to also match multibyte digits. * src/grep.c (P_MATCHER_INDEX): Define enum. (pcre_pattern_expand_backslash_d): New function. (main): Call it for -P. * NEWS (Bug fixes): Mention it. * doc/grep.texi: Document it: with -P, \d matches only ASCII digits. Provide a PCRE documentation URL and an example of how to use (?s) with -z. * tests/pcre-ascii-digits: New test. * tests/Makefile.am (TESTS): Add that file name. Reported as https://bugs.gnu.org/62267
* tests: avoid failure on Alpine Linux 3.17, due to non-POSIX compliant trBruno Haible2023-03-051-4/+4
| | | | | * tests/fmbtest: Don't use [x*n] syntax in the tr options, since tr from BusyBox 1.35 does not support it.
* maint: stop including getprogname.hPaul Eggert2023-01-211-2/+0
| | | | | | It’s obsolete in bleeding-edge Gnulib. * src/grep.c, tests/get-mb-cur-max.c: Don’t include getprogname.h. Instead, rely on stdlib.h to declare getprogname.
* maint: spelling fixesPaul Eggert2023-01-162-2/+3
|
* tests: fix test -eq problemPaul Eggert2023-01-151-1/+1
| | | | | Do not use ‘test "" -eq 1’ when get-mb-cur-max fails, as Bash complains about this. Problem found on AIX.
* tests: port U+10000+ to AIX 7.2Paul Eggert2023-01-152-4/+18
| | | | | | | * tests/hangul-syllable, tests/surrogate-search: 32-bit AIX has WCHAR_MAX == 0xFFFF, and so cannot handle U+10000 and greater. Skip tests involving such chars on this platform.
* tests: update tests/init.shPaul Eggert2023-01-151-4/+5
| | | | * tests/init.sh: Update from Gnulib.
* tests: omit duplicate testsPaul Eggert2023-01-141-6/+4
| | | | | * tests/skip-read: Omit duplicates. Reported by Bruno Haible in: https://lists.gnu.org/r/grep-devel/2023-01/msg00003.html
* tests: better diagnostic for -P sans UnicodePaul Eggert2023-01-121-4/+12
| | | | | | * tests/init.cfg (require_pcre_): When in a UTF-8 locale, test also for Unicode support so that it can be diagnosed differently (Bug#60708).
* pcre: use UTF only when available in the libraryCarlo Marcelo Arenas Belón2023-01-112-2/+5
| | | | | | | | | | | Before this change, if linked with a PCRE library without unicode any invocations of grep when using a UTF locale will error with: grep: this version of PCRE2 does not have Unicode support * src/pcresearch.c: Check whether Unicode was compiled in. * tests/pcre-utf8-w: Add check to skip test. * tests/pcre-utf8: Update check.
* pcre: use UCP in UTF modeCarlo Marcelo Arenas Belón2023-01-072-0/+29
| | | | | | | | | | | | | This fixes a serious bug affecting word-boundary and word-constituent regular expressions when the desired match involves non-ASCII UTF8 characters. * src/pcresearch.c: Set PCRE2_UCP together with PCRE2_UTF * tests/pcre-utf8-w: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention this. * THANKS.in: Add Gro-Tsen and Karl Petterson. Reported by Gro-Tsen https://twitter.com/gro_tsen/status/1610972356972875777 via Karl Pettersson in https://github.com/PCRE2Project/pcre2/issues/185 This bug was present from grep-2.5, when --perl-regexp (-P) support was added.
* maint: update copyright datesJim Meyering2023-01-0187-87/+87
|
* grep: bug: backref in last of multiple patternsPaul Eggert2022-12-051-0/+8
| | | | | | | | * NEWS: Mention this. * src/dfasearch.c (GEAcompile): Trim trailing newline from the last pattern, even if it has back-references and follows a pattern that lacks back-references. * tests/backref: Add test for this bug.
* tests: long-pattern-perf: avoid FP failure on unusual systemsJim Meyering2022-07-091-0/+10
| | | | | | | | * tests/long-pattern-perf: Skip this test whenever the base case takes more than 800ms. See comment for details. Reported by Bruno Haible in https://lists.gnu.org/r/grep-devel/2022-07/msg00004.html https://lists.gnu.org/r/grep-devel/2022-07/msg00006.html
* tests: long-pattern-perf: better handle exhausted virtual memoryJim Meyering2022-07-031-2/+6
| | | | | | | | | * tests/long-pattern-perf: Don't fail due to a syntax error when one of the subtests exhausts virtual memory. The larger test (with a 2MiB regexp) needs about 870MiB of virtual memory. Require that each timing run exit with status 0, else fail with a framework_failure_. Reported by Bruno Haible in https://lists.gnu.org/r/grep-devel/2022-07/msg00006.html
* tests: note that triple-backref is still not fixedJim Meyering2022-07-031-0/+1
| | | | | | | | * tests/triple-backref: I noticed that our sole XFAIL is still required, in spite of a glibc comment that bug 11053 is fixed, so confirmed that it no longer evokes an abort, but still fails to produce the expected match. I.e., this prints nothing: echo a | grep -E '(.?)(.?)(.?)\3\2\1' -- it should print its input.
* tests: do not emit ratio of test durationsJim Meyering2022-07-031-1/+0
| | | | * tests/hash-collision-perf (ratio): Remove stray diagnostic.
* maint: spelling fixesPaul Eggert2022-06-031-2/+2
|
* tests: placate syntax-check's sorted-test ruleJim Meyering2022-05-291-1/+1
| | | | * tests/Makefile.am (TESTS): Insert color-colors in sorted order.
* build: sync init.sh from gnulibJim Meyering2022-05-291-19/+24
|
* tests: new test color-colorsPaul Eggert2022-05-292-0/+49
| | | | | * tests/Makefile.am (TESTS): Add it. * tests/color-colors: New file.
* tests: port to platforms lacking PerlPaul Eggert2022-05-216-0/+13
| | | | | | | * tests/init.cfg (require_perl_): New function. * tests/big-hole, tests/hash-collision-perf, tests/long-pattern-perf: * tests/many-regex-performance, tests/mb-non-UTF8-performance: Use it.
* grep: assume POSIX.1-2017 for [:space:]Paul Eggert2022-05-211-4/+0
| | | | | | | * src/dfasearch.c (dfawarn): Always call dfaerror now, regardless of POSIXLY_CORRECT. * tests/warn-char-classes: Omit test of POSIX.1-2008 behavior, since POSIX.1-2017 allows the GNU behavior.
* tests: make spencer1.tests more POSIX-compliantPaul Eggert2022-05-211-1/+3
| | | | | | | * tests/spencer1.tests: Do not test the regular expression a\x as POSIX says the interpretation of \x is undefined and we may want to warn about it in the future, to allow for future extensions. Instead, test a\\x, a[\]x, and ax.
* tests: improve tests of ‘.’Paul Eggert2022-05-171-1/+88
| | | | * tests/hangul-syllable: Test some encoding errors too.
* maint: spelling fixesPaul Eggert2022-05-141-2/+2
|
* grep: fix bug with . and some Hangul SyllablesPaul Eggert2022-05-132-0/+89
| | | | | | * NEWS: Mention the fix, which comes from the recent Gnulib update. * tests/hangul-syllable: New file. * tests/Makefile.am (TESTS): Add it.
* grep: very long lines no longer evoke unwarranted "memory exhausted"Jim Meyering2022-03-202-0/+12
| | | | | | | | | | | When calling xpalloc (NULL, &n, incr_min, alloc_max, 1) with nontrivial ALLOC_MAX, this must hold: N + INCR_MIN <= ALLOC_MAX. With a very long line, it did not, and grep would mistakenly fail with a report of "memory exhausted". * src/grep.c (fillbuf): When using nontrivial ALLOC_MAX, ensure it is at least N+INCR_MIN. * tests/fillbuf-long-line: New file, to test for this. * tests/Makefile.am (TESTS): Add its name.
* tests: remove redundant testUlrich Eckhardt2022-02-151-8/+1
| | | | * tests/empty: Test #4 is identical to test #1. Remove it.
* maint: make update-copyrightJim Meyering2022-01-0185-85/+85
|
* build: update gnulib to latest; also bootstrap and init.shJim Meyering2022-01-011-1/+18
|
* tests: skip surrogate-search test on CygwinPaul Eggert2021-11-233-6/+43
| | | | | | | | | Cygwin does not support surrogate-pair search strings, so skip the test there (Bug#27555). * tests/Makefile.am (TESTS): Add surrogate-search. * tests/surrogate-pair: Remove surrogate-search test, which is now done by surrogate-search. * tests/surrogate-search: New test, which is skipped on Cygwin.
* grep: -s does not suppress “binary file matches”Paul Eggert2021-11-201-3/+5
| | | | | * src/grep.c (grep): Implement this. * tests/binary-file-matches: Add regression test.
* maint: minor rewording and reindentingPaul Eggert2021-11-141-1/+1
|
* grep: migrate to pcre2Carlo Marcelo Arenas Belón2021-11-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | Mostly a bug by bug translation of the original code to the PCRE2 API. Code still could do with some optimizations but should be good as a starting point. The API changes the sign of some types and therefore some ugly casts were needed, some of the changes are just to make sure all variables fit into the newer types better. Includes backward compatibility and could be made to build all the way to 10.00, but assumes a recent enough version and has been tested with 10.23 (from CentOS 7, the oldest). Performance seems equivalent, and it also seems functionally complete. * m4/pcre.m4 (gl_FUNC_PCRE): Check for PCRE2, not the original PCRE. * src/pcresearch.c (struct pcre_comp, jit_exec) (Pcompile, Pexecute): Use PCRE2, not the original PCRE. * tests/filename-lineno.pl: Adjust to match PCRE2 diagnostics.
* tests: fix pcre test typoPaul Eggert2021-11-101-2/+4
| | | | * tests/pcre-context: Initialize ‘fail’ earlier.
* tests: fix test logic for pcre-contextCarlo Marcelo Arenas Belón2021-11-101-18/+22
| | | | | | | | | | | | | Included in the original bug #20957, but corrupted somehow in transit as the required NUL characters are missing. Add a simpler version of the test case that uses plain characters and match the -z data and output to show the equivalence. Note the output is still not correct as it is missing the expected LF characters, but a full fix will have to wait until PCRE2. Fixes Bug#51735.
* tests: mb-non-UTF8-perf-Fw: use head rather than sedJim Meyering2021-08-222-2/+2
| | | | | | * tests/mb-non-UTF8-perf-Fw: Use head -n 10000000 rather than the work-alike sed command. This provides a 4x speedup and saves 0.5s. * tests/null-byte: Likewise.
* tests: port mb-non-UTF8-perf-Fw to strict POSIXPaul Eggert2021-08-181-1/+1
| | | | | * tests/mb-non-UTF8-perf-Fw: Prefer ‘sed 10q’ to ‘head -10’, which doesn’t conform to POSIX.
* egrep, fgrep: now obsoletePaul Eggert2021-08-161-2/+2
| | | | | | | | | | | | | * NEWS: Mention this (see bug#49996). * doc/Makefile.am (egrep.1 fgrep.1): Remove. All uses removed. * doc/grep.in.1, doc/grep.texi (grep Programs): Remove documentation for egrep, fgrep. * doc/grep.texi (Usage): Add FAQ for egrep and fgrep. * src/Makefile.am (shell_does_substrings): Substitute for ${0##*/}, not for ${0%/\*} (which was not being used anyway). * src/egrep.sh: Issue an obsolescence warning. * tests/fedora: Use "grep -F" instead of "fgrep" in diagnostics, as this tests "grep -F" not "fgrep".
* tests: provide an awk-based seq replacementJim Meyering2021-08-093-6/+17
| | | | | | | | ...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.
* tests: use awk, not seqPaul Eggert2021-08-092-5/+6
| | | | | | | Portability problem reported by Dagobert Michelsen in: https://lists.gnu.org/r/grep-devel/2021-08/msg00004.html * tests/hash-collision-perf, tests/long-pattern-perf: Don’t assume seq is installed; use awk instead.