summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* maint: copy bootstrap, tests/init.sh from GnulibPaul Eggert2021-01-011-1/+1
|
* maint: run "make update-copyright"Paul Eggert2021-01-0185-85/+85
|
* grep: avoid performance regression with many patternsJim Meyering2020-11-262-0/+54
| | | | | | | | | | * src/grep.c (hash_pattern): Switch from PJW to DJB2, to avoid an O(N) to O(N^2) performance regression due to hash collisions with patterns from e.g., seq 500000|tr 0-9 A-J Reported by Frank Heckenbach in https://bugs.gnu.org/44754 * NEWS (Bug fixes): Mention it. * tests/hash-collision-perf: New file. * tests/Makefile.am (TESTS): Add it.
* grep: remove GREP_OPTIONSPaul Eggert2020-11-032-2/+0
| | | | | | | | | | | | * NEWS: Mention this. * doc/grep.in.1: Remove GREP_OPTIONS documentation. * doc/grep.texi (Environment Variables): Move GREP_OPTIONS stuff into a “no longer implemented” paragraph. * src/grep.c (prepend_args, prepend_default_options): Remove. (main): Do not look at GREP_OPTIONS. * tests/Makefile.am (TESTS_ENVIRONMENTS): * tests/init.cfg (vars_): Remove GREP_OPTIONS.
* tests: add the test for bugfix in gnulib's dfaNorihiro Tanaka2020-11-011-0/+2
| | | | * tests/ere.tests: Add new test.
* grep: -P: report input filename upon PCRE execution failureJim Meyering2020-10-111-2/+13
| | | | | | | | | | | | Without this, it could be tedious to determine which input file evokes a PCRE-execution-time failure. * src/pcresearch.c (Pexecute): When failing, include the error-provoking file name in the diagnostic. * src/grep.c (input_filename): Make extern, since used above. * src/search.h (input_filename): Declare. * tests/filename-lineno.pl: Test for this. ($no_pcre): Factor out. * NEWS (Bug fixes): Mention this.
* tests: correct filename-lineno.plJim Meyering2020-10-051-1/+1
| | | | | * tests/filename-lineno.pl: Remove a stray envvar that somehow slipped into expected output string.
* tests: fix tests when PCRE is not usedPaul Eggert2020-10-052-9/+10
| | | | | | | | | * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH before setting PCRE_WORKS, so that the latter test uses the just-built grep. * tests/filename-lineno.pl (invalid-re-P-paren) (invalid-re-P-star-paren): Adjust non-PCRE case to match recently-changed behavior.
* tests: restore deleted -P testsJim Meyering2020-09-282-0/+18
| | | | | | | | | | | v3.4-almost-45-g8577dda deleted these two -P-using tests because a grep built without PCRE support would fail those tests. This sets an envvar with the equivalent of the result from the require_pcre_ function and restores the now-guarded tests. Tested by running this: ./configure --disable-perl-regexp && make check * tests/Makefile.am (PCRE_WORKS): Set this envvar. * tests/filename-lineno.pl: Restore invalid-re-P-paren and invalid-re-P-star-paren, now each with a guard.
* tests: skip stack-overflow test when built with ASANJim Meyering2020-09-261-0/+9
| | | | | * tests/stack-overflow: Skip this test when the binary was built with ASAN, to avoid spurious failures.
* tests: fix surrogate-pair test to work on 16-bit wchar_t systemsJim Meyering2020-09-241-5/+19
| | | | | | | | * tests/surrogate-pair: Avoid new failure on systems with 16-bit wchar_t. Detect the condition and exit before the otherwise-failing tests. Remove the now-incorrect in-loop test for that alternate failure mode. This was exposed by testing on gcc119.fsffrance.org, a power8 AIX 7.2 system.
* grep: don't assume PCRE in testsPaul Eggert2020-09-231-6/+0
| | | | | | | * tests/filename-lineno.pl: Remove invalid-re-P-paren and invalid-re-P-star-paren as they assume PCRE support, which causes a false alarm "grep: Perl matching not supported in a --disable-perl-regexp build" on platforms without PCRE.
* grep: fix more Turkish-eyes bugsPaul Eggert2020-09-231-3/+15
| | | | | | | | | | | | | | | | | Fix more bugs recently uncovered by Norihiro Tanaka (Bug#43577). * NEWS: Mention new bug report. * src/grep.c (ok_fold): New static var. (setup_ok_fold): New function. (fgrep_icase_charlen): Reject single-byte characters if they match some multibyte characters when ignoring case. This part of the patch is partly derived from <https://bugs.gnu.org/43577#14>, which means it is: Co-authored-by: Norihiro Tanaka <noritnk@kcn.ne.jp> (main): Call setup_ok_fold if ok_fold might be needed. * src/searchutils.c (kwsinit): With the grep.c changes, this code can now revert to classic 7th Edition Unix style; aborting would be wrong. * tests/turkish-eyes: Add tests for these bugs.
* tests: port timeout test to AlpinePaul Eggert2020-09-221-0/+2
| | | | | | | | Problem reported by Bruno Haible in: https://lists.gnu.org/r/grep-devel/2020-09/msg00080.html * tests/init.cfg (require_timeout_): Check that ‘timeout 0.01 sleep 0.02’ works as expected, to avoid spurious test failure on Alpine.
* tests: test for many-regexp N^2 RSS regressionJim Meyering2020-09-222-0/+80
| | | | | | | * tests/many-regex-performance: New test for this performance regression. * tests/Makefile.am: Add it. * NEWS (Bug fixes): Describe it.
* tests: skip stack-overflow test on midnightbsd*Jim Meyering2020-09-222-0/+6
| | | | | | * tests/stack-overflow: skip_ when run on this OS. See details in https://lists.gnu.org/r/grep-devel/2020-09/msg00062.html * tests/Makefile.am (host_triplet): Export.
* grep: "grep '\)'" reports an error againPaul Eggert2020-09-181-0/+16
| | | | | | | * src/grep.c (try_fgrep_pattern): With -G, pass \) through to GEAcompile so that it can complain. This fixes an unexpected change in behavior from grep 3.4 and earlier. * tests/filename-lineno.pl: Add tests for this sort of thing.
* grep: make echo .|grep '\.' match once againJim Meyering2020-09-182-0/+21
| | | | | | | | | | | | | | The same applied for many other backslash-escaped bytes, not just metacharacters. The switch to rawmemchr in v3.4-almost-10-g9393b97 made some parts of the code require the usually-guaranteed newline sentinel at the end of each pattern. Before, some consumers used a (correct) pattern length and did not care that try_fgrep_pattern could transform a pattern (with sentinel) like "\\.\n" to "..\n", thus violating that assumption. * src/grep.c (try_fgrep_pattern): Preserve the invariant that each regexp is newline-terminated. * tests/backslash-dot: New file. Test for this. * tests/Makefile.am (TESTS): Add it.
* tests: triple-backref: print a reference to glibc bugJim Meyering2020-09-181-0/+7
| | | | | * tests/triple-backref (MALLOC_CHECK_): And tell glibc not to bother with a core dump. Suggested by Pádraig Brady.
* grep: be more consistent about diagnostic formatPaul Eggert2020-09-182-3/+3
| | | | | | | | | | * NEWS: Mention this. * bootstrap.conf (gnulib_modules): Remove 'quote'. * src/grep.c: Do not include quote.h. (grep, grepdirent, grepdesc): Put the three unusual diagnostics into the same "grep: FOO: message" form that grep uses elsewhere. * tests/binary-file-matches, tests/in-eq-out-infloop: Adjust tests to match new diagnostic format.
* * tests/triple-backref: Add comment.Paul Eggert2020-09-171-0/+4
|
* tests: make new test executable, to placate distcheckJim Meyering2020-09-171-0/+0
| | | | * tests/binary-file-matches: Make this executable.
* tests: add coverage for code that emits the new diagnosticJim Meyering2020-09-172-0/+22
| | | | | * tests/binary-file-matches: New file. * tests/Makefile.am (TESTS): Add it.
* Send "Binary file FOO matches" to stderrPaul Eggert2020-09-177-21/+12
| | | | | | | | | | | * NEWS, doc/grep.texi: Mention this change (Bug#29668). * src/grep.c (grep): Send "Binary file FOO matches" to stderr instead of stdout. * tests/encoding-error, tests/invalid-multibyte-infloop: * tests/null-byte, tests/pcre-count, tests/surrogate-pair: * tests/symlink, tests/unibyte-binary: Adjust tests to match new behavior. In all cases this simplifies the tests, which is a good sign.
* Suppress "Binary file FOO matches" if -IPaul Eggert2020-09-171-0/+9
| | | | | | | Problem reported by Jason Franklin (Bug#33552). * NEWS: Mention this. * src/grep.c (grep): Do not output "Binary file FOO matches" if -I. * tests/encoding-error: Add test for this bug.
* grep: fix PCRE JIT test when JIT not availablePaul Eggert2020-09-091-1/+2
| | | | | | | Problem reported by Thomas Deutschmann (Bug#29446#23). * src/pcresearch.c (Pexecute): Diagnose PCRE_ERROR_RECURSIONLIMIT. * tests/pcre-jitstack: Treat recursion limit overflow like stack overflow.
* grep: fix -w bug in UTF-8 localesPaul Eggert2020-09-091-0/+8
| | | | | | | | | Problem reported by Mayo Fark (Bug#43225). * src/searchutils.c (wordchar_prev): In a UTF-8 locale, do not assume that an encoding-error byte cannot be part of a word constituent, as this assumption is incorrect for the last byte of a multibyte word constituent. * tests/word-delim-multibyte: Add a test for the bug.
* Omit duplicate regexpsPaul Eggert2020-09-071-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not pass two copies of the same regexp to the regular-expression engine. Although the engines should perform nearly as well even with the copies, in practice they do not. Problem reported by Luca Borzacchiello (Bug#43040). * bootstrap.conf (gnulib_modules): Add hash. * src/grep.c: Include stdint.h, for SIZE_WIDTH. Include hash.h. (struct patloc, patloc, patlocs_allocated, patlocs_used): Rename from struct FL_pair, fl_pair, n_fl_pair_slots, n_pattern_files, respectively, since the data type is no longer a pair. All uses changed. (struct patloc): New member FILELINE. The lineno member is now ptrdiff_t since nowadays we prefer signed types. (pattern_array, patterns_table): New static vars. (count_nl_bytes, fl_add): Remove; no longer used. (hash_pattern, compare_patterns, update_patterns): New functions. update_patterns does what fl_add used to do, plus remove dups. (pattern_file_name): Adjust to change from fl_pair to patloc. (main): Move some variables to inner blocks for clarity. Maintain the pattern_table hash of all patterns. Update pattern_array to match keys, and use update_patterns instead of fl_add to remove duplicate keys. * tests/filename-lineno.pl (invalid-re-2-files) (invalid-re-2-files2, invalid-re-2e): Ensure regexps are unique in tests so that dups aren’t removed in diagnostics. (invalid-re-line-numbers): New test.
* Revert -L exit status change introduced in grep 3.2Paul Eggert2020-08-221-2/+2
| | | | | | | | | Problems reported by Antonio Diaz Diaz in: https://bugs.gnu.org/28105#29 * NEWS, doc/grep.texi (Exit Status), src/grep.c (usage): Adjust documentation accordingly. * src/grep.c (grepdesc, main): Go back to old behavior. * tests/skip-read: Adjust tests accordingly.
* tests: fix permission issue in previous changePaul Eggert2020-01-201-0/+0
|
* tests: work around GCC -fprofile-generate bugPaul Eggert2020-01-201-1/+2
| | | | | | | * tests/triple-backref: Add a 10 s timeout to work around what appears to be a GCC bug with -fprofile-generate. Problem reported by Martin Liška, with diagnosis by Andreas Schwab (Bug#21513).
* maint: update all copyright year number rangesJim Meyering2020-01-0181-81/+81
| | | | | | | | Run "make update-copyright" and then... * gnulib: Update to latest with copyright year adjusted. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * doc/grep.in.1: Use "-" in copyright year ranges, not \en.
* tests: avoid unwarranted failure in a netbsd 8.1 VMJim Meyering2019-12-311-0/+7
| | | | | * tests/mb-non-UTF8-perf-Fw: Run twice, to avoid first-read penalty. Reported by Nelson H.F. Beebe.
* doc: spell "back-reference" more consistentlyPaul Eggert2019-12-303-4/+4
|
* build: update gnulib to latest; and sync tests/init.shJim Meyering2019-12-261-2/+8
| | | | | * gnulib: update * tests/init.sh: Sync from gnulib (this removes the LC_ALL=C setting).
* tests: avoid spurious failure due to 1-second timeoutJim Meyering2019-12-261-1/+1
| | | | | | | * tests/grep-dev-null-out: Use a 10-second timeout, rather than a 1-second one. This avoids false failure on slow systems. Reported by Assaf Gordon in https://lists.gnu.org/r/grep-devel/2019-12/msg00018.html
* maint: adjust surrogate-pair for 16-bit wchar_tPaul Eggert2019-12-261-2/+5
| | | | | | * tests/surrogate-pair: Adjust to match fixed behavior on AIX 7.2, where wchar_t is 16 bits and cannot represent the test case data.
* tests: fix typo in name of test fileJim Meyering2019-12-252-1/+1
| | | | | | * tests/backslash-s-vs-invalid-multitype: Rename to... * tests/backslash-s-vs-invalid-multibyte: ...this. * tests/Makefile.am (TESTS): Reflect renaming.
* tests: require timeoutJim Meyering2019-12-251-0/+1
| | | | | | | | * tests/mb-non-UTF8-perf-Fw: This test uses "timeout", so must first call require_timeout_. This avoids test spurious failure when running with no timeout program. Reported by Bruno Haible in https://lists.gnu.org/r/grep-devel/2019-12/msg00008.html
* tests: work around AIX 7.2 sh printf bugPaul Eggert2019-12-253-5/+7
| | | | | | | | | | AIX 7.2 /bin/sh’s printf command mishandles octal escapes in multibyte locales: it treats them as characters, not bytes. * tests/backslash-s-vs-invalid-multitype, tests/encoding-error: Use the C locale when employing the printf command with an octal escape that AIX 7.2 sh might mishandle. * tests/init.sh (setup_): Use the C locale for tests. This has the side benefit of making them more reproducible.
* build: update gnulib to latestJim Meyering2019-12-221-225/+282
| | | | | | * gnulib: Update submodule to latest. * bootstrap: Copy from gnulib. * tests/init.sh: Likewise.
* maint: sort test namesJim Meyering2019-12-181-1/+1
| | | | | * tests/Makefile.am (TESTS): Alphabetize the new addition, mb-non-UTF8-perf-Fw to placate syntax-check's sc_sorted_tests.
* grep: do not match invalid UTF-8Paul Eggert2019-12-172-0/+30
| | | | | | | | Update Gnulib to latest. Also: * src/dfasearch.c (EGexecute): Use ptrdiff_t, not size_t, to match new Gnulib API. * tests/Makefile.am (TESTS): Add dfa-invalid-utf8. * tests/dfa-invalid-utf8: New file.
* tests: add test that would have detected -Fw perf regressionJim Meyering2019-12-012-0/+32
| | | | | | * tests/mb-non-UTF8-perf-Fw: New file. Detect v3.3-22-g090a4db's performance regression. * tests/Makefile.am (TESTS): Add it.
* maint: fix test commentJim Meyering2019-11-301-1/+1
| | | | | * tests/mb-non-UTF8-word-boundary: Also correct "introduced-in" version number in a comment here.
* grep: avoid false -Fw match in non-UTF8 multibyte localesJim Meyering2019-11-162-0/+30
| | | | | | | | | | | | | | For example, this command would erroneously print its input line: echo ab | LC_CTYPE=ja_JP.eucjp grep -Fw b This arose when the "memrchr" search for a preceding newline failed: in that case, MB_START was not adjusted and was initially the same as BEG, so wordchar_prev mistakenly returned 0. * src/kwsearch.c (Fexecute): Set MB_START also when there is no preceding newline. * NEWS (Bug fixes): Mention it. * tests/mb-non-UTF8-word-boundary: New file. Test for the bug. * tests/Makefile.am (TESTS): Add it. Reported by NIDE, Naoyuki in https://bugs.gnu.org/38223.
* grep: fix ‘grep -L ... >/dev/null’ bugPaul Eggert2019-10-121-0/+1
| | | | | | | | | Problem reported by Adam Sampson (Bug#37716). * NEWS: Mention this. * src/grep.c (grepdesc): Don’t assume that stdout being /dev/null means list_files == LISTFILES_NONE. (main): Do not change list_files merely because stdout is /dev/null. * tests/skip-read: Test for this bug.
* tests: avoid false positive upon stack overflowJim Meyering2019-02-181-1/+4
| | | | | | * tests/pcre-jitstack: Don't let a stack overflow evoke a false failure. This test is to ensure there is no internal PCRE error. Reported by Andreas Schwab in http://bugs.gnu.org/34370
* maint: update all copyright dates via "make update-copyright"Jim Meyering2019-01-0178-78/+78
| | | | * gnulib: Also update submodule for its copyright updates.
* grep: fix \b DFA-bug in C localeJim Meyering2018-12-201-0/+10
| | | | | | | | Under some conditions, \b would mistakenly fail to match, e.g. echo 123-x|LC_ALL=C grep '.\bx' * NEWS (Bug fixes): Mention it * gnulib: Update to latest, for DFA regression fix. * tests/word-delim-multibyte: Add a test for the dfa.c regression.