summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* adjust autogen.sh for gitPaolo Bonzini2009-11-209-0/+0
| | | | * autogen.sh: Remove what is useless with git.
* move .cvsignore files to .gitignorePaolo Bonzini2009-11-201-2/+0
|
* update/add copyright noticesKarl Berry2009-01-3020-4/+131
|
* * tests/foad1.sh: disable tests that fail under cs_CZ.UTF-8.Tony Abou-Assaleh2009-01-212-6/+9
| | | | | | | * tests/fmbtest.sh: likewise * tests/foad1.sh: disable tests that fail under cs_CZ.UTF-8. * tests/fmbtest.sh: likewise
* * tests/foad1.h: Comment out cases that are known to fail. TheseTony Abou-Assaleh2008-02-072-7/+11
| | | | | | | | | | | | should be uncommented after the 2.5.4 release. * tests/yesno.sh: Likewise. * doc/grep.1: Update description of -e PATTERN; from Benno Schulenberg * doc/grep.texi: Likewise. * tests/foad1.h: Comment out cases that are known to fail. These * tests/yesno.sh: Likewise. * doc/grep.1: Update description of -e PATTERN; from Benno Schulenberg * doc/grep.texi: Likewise.
* * Re-commit changes of 2007-10-07Tony Abou-Assaleh2007-10-101-0/+7
| | | | | | | | | | | | | | * configure.ac.in: update version to 2.6-dev * src/grep.c: update --version message * configure.ac.in: update version to 2.6-dev * src/grep.c: update --version message * src/grep.c: When -h and -H are combined, use the last specified, Bug #15620, Patch #4866 * tests/foad1.sh: add tests for -h and -H * ChangeLog: Add a copyright notice (years taken from commit logs), add a license notice (taken from gnulib ChangeLog) * TODO: update the link to a list of other grep implementations
* Revert changes since grep-2.5.3 release to add a tag to CVS.v2.5.3Tony Abou-Assaleh2007-10-101-7/+0
|
* * src/grep.c: When -h and -H are combined, use the last specified,Tony Abou-Assaleh2007-10-071-0/+7
| | | | | | | | | | | | | | | Bug #15620, Patch #4866 * tests/foad1.sh: add tests for -h and -H * ChangeLog: Add a copyright notice (years taken from commit logs), add a license notice (taken from gnulib ChangeLog) * TODO: update the link to a list of other grep implementations * src/grep.c: When -h and -H are combined, use the last specified, Bug #15620, Patch #4866 * tests/foad1.sh: add tests for -h and -H * ChangeLog: Add a copyright notice (years taken from commit logs), add a license notice (taken from gnulib ChangeLog) * TODO: update the link to a list of other grep implementations
* * tests/foad1.sh: Use ": ${VERBOSE=}" so that the caller canCharles Levert2005-11-181-5/+5
| | | | | | | | | | | | | | | | set it without modifying the script; the usual caller (Makefile) still leaves it untouched (usually unset, so it's off by default). Modify "-m1 -A99 '^...$'" tests that failed so that their expectation now corresponds to the output currently produced by grep. Those tests used to expect that two selected (or selectable) lines be output, even with -m1. Nothing was modified with other similar tests that output _context_ lines after one selected line has been output with -m1; they used to and still succeed. Although tests/yesno.sh now provides a more comprehensive framework for testing -m/-C feature interaction, it doesn't exercise mixing them with anchors so the whole relevant tests/foad1.sh test group is kept, notably to check that grep doesn't crash when it is run.
* * tests/yesno.sh: New file. Test feature interactionCharles Levert2005-11-132-2/+118
| | | | | | | | of -C, -v, -o, and -m. This reveals bugs, including some I introduced on 2005-06-21, but also others. * tests/Makefile.am (TESTS): Add yesno.sh. * tests/Makefile.am (CLEANFILES): Add cspatfile and csinput, as created by fmbtest.sh. Add yesno.txt, as created by yesno.sh.
* The introduction of the --only-matching and --color GNU extensionsCharles Levert2005-11-102-17/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to grep added the requirement that each execute() implementation not only be able to identify matching lines as a whole, but also individual "exact" matches within a line known to be matching, from leftmost to rightmost match, when the output from matching lines is actually produced. The interface and implementations of execute() were not up to it. This set of changes aims to rectify that situation. Previously failing tests relative to left anchors (^ and \<) and -w should now pass. This fixes <http://savannah.gnu.org/bugs/?func=detailitem&item_id=11579>, <http://savannah.gnu.org/patch/?func=detailitem&item_id=1834>, <http://savannah.gnu.org/bugs/?func=detailitem&item_id=8243>, and possibly part of other, bigger, pending patches. The problem was also compounded by the POSIX requirement to support a pattern list instead of just an individual pattern (for -G and -E as well). * tests/foad1.sh: Test for increasing/decreasing-length word matches, given pattern order, and leftmost/longest match. * tests/fmbtest.sh: Modify test #6 according to new expectations. Better document what tests #6 and #7 are actually for. Eliminate test #5 in favor of bringing tests #6 and #7 within the F G E loop. * src/grep.h (EXECUTE_ARGS): Change last argument from "int exact" to "char const *start_ptr". Testing for "start_ptr" being non-NULL retains the same semantics as testing for "exact" being non-zero. * src/grep.c (print_line_middle): Call execute() with whole buffer to work on, but using current position as start_ptr. * src/grep.c (prpending, grepbuf): Call execute() with NULL as start_ptr. * src/search.c (EGexecute, Fexecute, Pexecute): When start_ptr is non-NULL, return first match from it as an offset relative to buf. * src/search.c (EGexecute): Consider all patterns if many and, for an exact match, return the best one (leftmost, then longest). Don't explore worst solutions, of course (branch and bound).
* * tests/foad1.sh: Duplicate three "-o -b" tests for the "-F"Charles Levert2005-11-041-0/+3
| | | | | mode because it relies on a different code path that deserves the same kind of testing.
* * src/grep.c (print_line_middle): In case of an empty match,Charles Levert2005-08-241-0/+4
| | | | | | | | | | make minimal progress and continue instead of aborting process of the remainder of the line, in case there's still an upcoming non-empty match. * tests/foad1.sh: Add two tests for this. * doc/grep.texi, doc/grep.1: Document this behavior, since --only-matching and --color are GNU extensions which are otherwise unspecified by POSIX or other standards.
* New pcre.sh regression test file (for "grep -P").Charles Levert2005-07-272-1/+17
| | | | | * tests/pcre.sh: New file. Add test 1. * tests/Makefile.am: Add pcre.sh to TESTS.
* * grep/autogen.sh, grep/src/Makefile.am, grep/tests/backref.sh,Charles Levert2005-06-2313-13/+13
| | | | | | | | | | grep/tests/bre.sh, grep/tests/empty.sh, grep/tests/ere.sh, grep/tests/file.sh, grep/tests/fmbtest.sh, grep/tests/foad1.sh, grep/tests/khadafy.sh, grep/tests/options.sh, grep/tests/spencer1.sh, grep/tests/spencer2.sh, grep/tests/status.sh, grep/tests/warning.sh: As per autoconf's "Portable Shell Programming" guidelines, replace all instances of "#!/bin/sh" by "#! /bin/sh" (notice the space).
* * tests/foad1.sh: Add tests combining -o, -n/-b/-H, and -i,Charles Levert2005-06-211-0/+8
| | | | | | | | | | | | | | | | since there are separate code paths for -i. Add tests combining -o, -n/-b/-H, and -3, since any context line specification should be ignored when combined with -o. * src/grep.c (print_line_head): New function, culled off the top content of prline(). Adds a guard against "lastnl" having already reached "lim", which can happen when if the function is called more than once per line. * src/grep.c (prline): Now calls print_line_head(), not only at the beginning to replace the moved code when -o is not specified, but also for each match when -o is specified (two code paths with this). Patch #3770, more or less. This makes all tests combining -o and -n/-b/-H pass, which they didn't before. Fixes bug #12727.
* * tests/foad1.sh: Since this script is run by /bin/sh, itCharles Levert2005-06-151-56/+59
| | | | | | must work under posix mode. That means not using assignment statements right before a function call (LC_ALL=... grep_test, in this case), because it won't do the expected thing.
* Fix bug #11022 (Line wrapping causes GREP_COLOR backgroundCharles Levert2005-06-142-5/+5
| | | | | | | | | | | | | | color to "smear") by outputting a "clear to end of line" control sequence after each SGR (Select Graphic Rendition) control sequence (START and END). This also avoid similar problems with HT (tab) characters. * src/grep.c (SGR_START, SGR_END, PR_SGR_FMT, PR_SGR_FMT_IF, PR_SGR_START, PR_SGR_END, PR_SGR_START_IF, PR_SGR_END_IF): New macros. * src/grep.c (prline): Use the new macros. * tests/fmbtest.sh, tests/foad1.sh: Adjust the regression tests to expect the new control sequences.
* Add -b and tricky UTF-8 tests.Charles Levert2005-04-291-6/+57
| | | | Display LC_ALL when its value is special. Patch #3962.
* Fix a DFA multibyte character class bug.Julian Foad2005-04-281-0/+9
| | | | | * src/dfa.c: Fix a DFA bug whereby a bracket "[" was matched by the pattern "[[:alpha:]]" in UTF-8 locales. Patch #3800, by Tim Waugh.
* Remove Bash-specific syntax from a test scriptJulian Foad2005-04-281-1/+1
|
* Add more tests, some initially failing.Julian Foad2005-04-273-1/+128
| | | | | | | | Add more tests, some initially failing. * tests/fmbtest.sh: New file of tests for "grep -i" with multi-byte chars, by Jakub Jelinek, from patch #3808: Red Hat's "tests" patch. Initially, test #4 fails (in all three modes). * tests/Makefile.am: Include the new tests file "fmbtest.sh".
* Fix bug of "grep -wF" missing matchesJulian Foad2005-04-271-6/+10
| | | | | | | | | Fix a bug reported by Elliott Hughes in patch #1834 whereby "grep -Fw" would miss matches after a non-word occurrence of the pattern. Fix by Gordon Lack; tests based on reproduction recipes by Gordon Lack. * src/search.c (Fexecute): Fix the "match_words" case. argument is optional. Add a regression test and a test for a similar case that other proposed patches have got wrong.
* Patch #3840 ("grep -m1 -A99" seg-fault); add tests for it.Julian Foad2005-04-121-0/+13
| | | | | | | * src/grep.c: Fix off-by-one error in prpending(). Patch #3840 by Claudio Fontana. * tests/foad1.sh: Add tests by Pavol Gono for patch #3840. Some of them still fail, but no longer seg-fault due to that bug.
* Tidy the test suite a little bitJulian Foad2005-04-124-48/+54
|
* New tests for "-o", initially all failing.Julian Foad2005-04-122-1/+46
| | | | * tests/Makefile.am: Include the new tests file 'grep-o.sh'.
* Enable a regression test for bug #9519.Julian Foad2005-04-121-1/+1
|
* Fix trivial typosJulian Foad2005-02-231-4/+4
| | | | * tests/backref.sh: Fix trivial typos.
* Added two tests for option -sStepan Kasal2005-01-071-1/+15
| | | | | * tests/status.sh: Added two tests--option `-s' should have no influence on the exit status.
* fix for current automake, drop support of legacy autotoolsStepan Kasal2004-11-201-0/+5
| | | | | | | | | | * ./cvsignore: Amended several .cvsignore files and removed *.gmo, acinclude.m4 and stamp-h.in from the root one. * m4/init.m4: Nuked, it was breaking current automake. * m4/Makefile.m4: Removed init.m4. * autogen.m4: Drop support for legacy autoconf; tell whether the auto tools exited successfully or not; fix the permissions of tests/*.sh--CVS doesn't provide a way to fix it.
* fix testsStepan Kasal2004-11-195-8/+9
| | | | | | | | | * tests/spencer1.awk: Use only lines with 3 fields. * tests/spencer1.tests: Disable #55 for now. * tests/ere.tests, tests/bre.tests: Add "TO CORRECT" to disabled tests which had empty $4. * tests/backref.sh: Modify #2 so that current glibc regex can handle it in finite time.
* bug report address changeStepan Kasal2004-11-191-2/+1
| | | | | | | | Change bug-gnu-utils address to bug-grep, on many places; there is no need to have the word ``grep'' in subject then. Thanks to Tony Abou-Assaleh and Benno Schulenberg for pointing out this. * 2.5.1 Release.
* fixed messagesStepan Kasal2003-07-231-6/+5
|
* Fix test 55, as noted by tim waughBernhard Rosenkraenzer2003-06-121-1/+1
|
* no longer usedStepan Kasal2003-06-052-115/+0
|
* Wow! It seems to work!Stepan Kasal2003-06-051-2/+0
|
* test the permissionsStepan Kasal2003-06-051-0/+2
|
* FixBernhard Rosenkraenzer2002-03-151-1/+1
| | | | | | * src/Makefile.am, po/Makefile.in.in: Support DESTDIR properly * tests/bre.tests: Add fix from Peter Breitenlohner <peb@mppmu.mpg.de>
* Add -o optionBernhard Rosenkraenzer2001-11-1911-11/+11
| | | | | * src/grep.c: Add --only-matching (-o) switch (see NEWS) * doc/grep.texi, doc/grep.1, NEWS: Document changes
* new files.Alain Magloire2001-03-071-0/+59
|
* Fix the search bugsAlain Magloire2001-03-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only the Regex patterns should be split in an array, patterns[]. The dfa and KWset compiled patterns should remain global and the patterns compiled all at once. * src/search.c : include "error.h" and "xalloc.h" to get prototyping of x*alloc() and error(). (kwsinit) : Reverse to previous behaviour and takes no argument. (kwsmusts) : Likewised. (Gcompile) : For the regex pattern, split them and each pattern is put in different compiled structure patterns[]. The patterns are given to dfacomp() and kwsmusts() as is. (Ecompile) : Likewised. (Fcompile) : Reverse to the old behaviour of compiling the enire patterns in one shot. (EGexecute) : If falling to GNU regex for the matching, loop in the array of compile patterns[] to find a match. (error) : Many error () were call with arguments in the wrong order. * tests/file.sh : Simple test to check for pattern in files. Reaction to bug report fired by Greg Louis <glouis@dynamicro.on.ca> In multibyte environments, handle multibyte characters as single characters in bracket expressions. * src/dfa.h (mb_char_classes) : new structure. (mbcsets) : new variable. (nmbcsets) : new variable. (mbcsets_alloc) : new variable. * src/dfa.c (prtok) : handle MBCSET. (fetch_wc) : new function to fetch a wide character. (parse_bracket_exp_mb) : new function to handle multibyte character in lex(). (lex) : invoke parse_bracket_exp_mb() for multibyte bracket expression. (atom) : handle MBCSET. (epsclosure) : likewise. (dfaanalyze) : likewise. (dfastate) : likewise. (match_mb_charset) : new function to judge whether a bracket match with a multibyte character. (check_matching_with_multibyte_ops) : handle MBCSET. (dfainit) : initialize new variables. (dfafree) : free new variables.
* (no commit message)Alain Magloire2001-03-043-3/+6
|
* Test for backrer.Alain Magloire2001-02-181-0/+38
|
* (no commit message)Alain Magloire2001-02-181-2/+2
|
* New option back-references are local, beefup manual.Alain Magloire2001-02-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/grep.texi : Document the new options and the new behaviour back-references are local. Use excerpt from Karl Berry regex texinfo. * bootstrap/Makefile.try : Added xstrtoumax.o xstrtoul.o hard-local.o From Guglielmo 'bond' Bondioni : The bug was that using a multi line file that contained REs (one per line), backreferences in the REs were considered global (to the file) and not local (to the line). That is, \1 in line n refers to the first \(.\) in the whole file, rather than in the line itself. From Tapani Tarvainen : # Re: grep -e '\(a\)\1' -e '\(b\)\1' That's not the way it should work: multiple -e arguments should be treated as independent patterns and back references should not refer to previous ones. From Paul Eggert : GNU grep currently does not issue diagnostics for the following two cases, both of which are erroneous: grep -e '[' -e ']' grep '[ ]' POSIX requires a diagnostic in both cases because '[' is not a valid regular expression. To overcome those problems, grep no longer pass the concatenate patterns to GNU regex but rather compile each patterns separately and keep the result in an array. * src/search.c (patterns) : New global variable; a structure array holding the compiled patterns. Declare function prototypes to minimize error. (dfa, kswset, regexbuf, regs) : Removed, no longer static globals, but rather fields in patterns[] structure per motif. (Fcompile) : Alloc an entry in patterns[] to hold the regex. (Ecompile) : Alloc an entry per motif in the patterns[] array. (Gcompile) : Likewise. (EGexecute) : Loop through of array of patterns[] for a match. From Bernd Strieder : # tail -f logfile | grep important | do_something_urgent # tail -f logfile | grep important | do_something_taking_very_long If grep does full buffering in these cases then the urgent operation does not happen as it should in the first case, and in the second case time is lost due to waiting for the buffer to be filled. This is clearly spoken not grep's fault in the first place, but libc's. There is a heuristic in libc that make a stream line-buffered only if a terminal is on the other end. This doesn't take care of the cases where this connection is somehow indirect. * src/grep.c (line_buffered) : new option variable. (prline) : if line_buffered is set fflush() is call. (usage) : line_buffered new option. Input from Paul Eggert, doing setvbuf() may not be portable and breaks grep -z. This patch prevent kwset_matcher from following problems. For example, in SJIS encoding, one character has the codepoint 0x895c. So the second byte of the character can match with '\' incorrectly. And in eucJP encoding, there are the characters whose codepoints are 0xa5b9, 0xa5c8. On the other hand, there is one character whose codepoint is 0xb9a5. So 0xb9a5 can match with 2nd byte of 0xa5b9 and 1st byte of 0xa5c8. (EGexecute) : call check_multibyte_string when kwset is set. (Fexecute) : call to check_multibyte_string. (MB_CUR_MAX) : new macro.
* Locale Makefile.am fix.Alain Magloire2001-02-081-1/+5
| | | | | * tests/Makefile.am (TESTS_ENVIRONMENT): Add LC_ALL=C, since some of the tests assume the C locale.
* -x bug corrected.Alain Magloire2001-02-081-18/+21
|
* Exit status fix.Alain Magloire2001-02-081-2/+16
| | | | | | | | | | | | | | | | | | POSIX.2 conformance fixes: grep -q now exits with status zero if an input line is selected, even if an error also occurs. grep -s no longer affects exit status. * src/grep.c (suppress_errors): Move definition earlier so that suppressible_error can use it. (suppressible_error): New function. (exit_on_match): New var. (grepbuf): If exit_on_match is nonzero, exit with status zero immediately. (grep, grepfile, grepdir): Invoke suppressible_error. (main): -q sets exit_on_match. * doc/grep.1, doc/grep.texi, NEWS: Document -q's behavior as required by POSIX.2. * tests/status.sh: Test for -q and -s behavior as conforming to POSIX.2.
* tests/Makefile.am fixes.Alain Magloire2001-02-081-1/+1
| | | | | * tests/Makefile.am (TESTS_ENVIRONMENT): Set GREP_OPTIONS to the empty string.
* test typo.Alain Magloire2001-02-081-1/+1
| | | | * tests/status.sh: Fix typo: test -b -> test -r.