Commit graph

187 commits

Author SHA1 Message Date
David E. O'Brien 01d217bcc1 Don't process 'lastcomm' if "AUTOMATED" is defined.
The tests for it require manual setup.
2010-01-04 09:54:24 +00:00
David E. O'Brien 8dcfd5d1d6 It is expected these are chmod +x. 2010-01-04 09:50:30 +00:00
David E. O'Brien faddcb5783 Regression test for r201456. 2010-01-04 09:49:23 +00:00
David E. O'Brien 70ec99bfd2 Provide clean output with 'prove -r'. 2010-01-03 11:53:48 +00:00
Jaakko Heinonen d8eba599f5 Don't read the newline character to line buffer because lines are passed
to wcscoll(3). Newline characters could cause incorrect results when
comparing lines.

Also, if an input line didn't contain a newline character, it was
omitted from the output. According to my interpretation, SUSv3 requires
that the newline is always printed.

Add regression tests for the cases. [1]

PR:		bin/140976
Submitted by:	D'Arcy Cain (original version) [1]
Approved by:	trasz (mentor)
2009-12-12 18:18:46 +00:00
Diomidis Spinellis ac8f32ce62 IEEE Std 1003.1, 2004 Edition states:
"The escape sequence '\n' shall match a <newline> embedded in
the pattern space."

It is unclear whether this also applies to a \n embedded in a
character class.  Disable the existing handling of \n in a character
class following Mac OS X, GNU sed version 4.1.5 with --posix, and
SunOS 5.10 /usr/bin/sed.

Pointed by:	Marius Strobl
Obtained from:	Mac OS X
2009-09-20 15:47:31 +00:00
Diomidis Spinellis 76570d0a99 Follow POSIX (IEEE Std 1003.1, 2004 Edition) in the implementation
of the y (translate) command.

"If a backslash character is immediately followed by a backslash
character in string1 or string2, the two backslash characters shall
be counted as a single literal backslash character"

Pointed by:	Marius Strobl
Obtained from:	Mac OS X
2009-09-20 15:17:40 +00:00
Diomidis Spinellis 91f8201727 Add correct test results. 2009-09-20 15:04:50 +00:00
Diomidis Spinellis e00741e355 Describe how other systems treat this case. 2009-09-20 14:20:00 +00:00
Diomidis Spinellis 128e6a12b5 Allow [ to be used as a delimiter.
Pointed by:	Marius Strobl
Obtained from:	Apple
2009-09-20 14:11:33 +00:00
Diomidis Spinellis 8d5e165e7f The transition to Subversion allows us to rename files without
repo-copy hacks.
Remove the test-number prefix from the name of the output files,
so that new test cases can be easily added.
2009-09-20 13:39:44 +00:00
Brian Somers 58a654f664 Fix some uninitialise variables.
PR:		136383
Submitted by:	Ulrich Spoerlein - uqs at spoerlein dot net
Approved by:	re (kib)
MFC after:	3 weeks
2009-07-08 10:16:16 +00:00
Brian Somers 258f721bc9 Regression test the 'addr1,+N' feature added in r192732 2009-05-25 06:58:42 +00:00
Robert Watson 76b6a59f9d Rename files that collide on case-insensitive file systems by encoding
colliding upper case letters as the lower case letter with a '_' in
front.

MFC after:	3 days
Discussed with:	ed
Spotted by:	Michael David Crawford <mdc at prgmr.com>
2009-03-10 09:33:22 +00:00
Ed Schouten af65d772a0 Allow jot(1) regression tests to be checked out on Windows filesystems.
The jot(1) regression tests directory contained two tests named `wx' and
`wX', which doesn't work on case insensitive filesystems. Rename `wX' to
`wX1'.

MFC after:	1 month
2009-01-16 15:47:35 +00:00
Diomidis Spinellis b71c319dc6 Add a test for the "or more" part of the following POSIX specification.
"A function can be preceded by one or more '!' characters, in which
  case the function shall be applied if the addresses do not select
  the pattern space."
2008-11-11 17:10:24 +00:00
Giorgos Keramidas f338227f78 Attach the tr(1) regression tests to the build.
Approved by:	das, dds
2008-01-13 08:33:58 +00:00
Giorgos Keramidas 841cbf48eb Add a new set of regression tests, for the tr(1) utility.
Approved by:    das, dds
2008-01-13 08:33:20 +00:00
Diomidis Spinellis 966909fce1 Make the reported number of tests match their actual number.
This fixes the reporting under prove(1)
2007-12-16 08:02:09 +00:00
Diomidis Spinellis 8d40101acd cd to the correct directory so that the tests can be run from prove(1) 2007-12-16 07:55:33 +00:00
Xin LI 68b843a591 Add a test case for sed(1) regression - we should not ignore case
when not being asked to do so.

Approved by:	re (hrs)
2007-07-06 16:36:52 +00:00
Suleiman Souhlal bdd72b703b Add case-insensitive matching to sed, using the 'I' flag, similarly to GNU sed.
For example,
	sed /foo/Id
	sed s/foo/bar/Ig

Reviewed by:	dds
Approved by:	re (hrs)
2007-07-04 16:42:41 +00:00
Yaroslav Tykhiy 26a5710c40 Don't forget to clear out the hold space for each subsequent file
when in -i mode so that each file gets a clean context of its own.

Add a regression test for the bug.

Tested with:	regression tests
2007-06-12 12:05:24 +00:00
Greg Lehey df16203833 Updated tests for changed features.
Submitted by: edwin@
2007-06-09 06:01:24 +00:00
Greg Lehey 2b04161236 Use correct comment syntax for $FreeBSD$. This file gets put through
cpp, not a shell script.

Pointy hat to: grog
2007-06-04 01:44:07 +00:00
Greg Lehey 88778e972f Add regression tests for calendar.
Submitted by:	edwin@
PR:		bin/113275
MFC after:	2 weeks
2007-06-03 03:29:32 +00:00
Diomidis Spinellis a14e979ed4 Add sparc64 regression test files.
Submitted by:	Carl Johan Gustavsson
2007-05-24 07:00:53 +00:00
Diomidis Spinellis 2055b9dc4f Modify file generation instructions to remove the tty field:
the mapping from number to name differs between systems,
and will cause tests to fail.
2007-05-24 06:57:50 +00:00
Diomidis Spinellis 550bfecc8f Regression tests for sparc64 record formats.
Submitted by:	Carl Johan Gustavsson
2007-05-22 06:34:20 +00:00
Diomidis Spinellis 6f1544c7f1 Regression tests for amd64 file and record formats.
Submitted by:	Larry Rosenman (who also provided access to a testing host)
2007-05-22 06:30:48 +00:00
Diomidis Spinellis eeec998a23 Regression tests for the new and legacy process accounting formats. 2007-05-22 06:21:20 +00:00
Yaroslav Tykhiy f6703c9c0a Change the semantics of -i (in-place editing) so that it treats
each file independently from other files.  The new semantics are
desired in the most of practical cases, e.g.: delete lines 5-9
from each file.

Keep the previous semantics of -i under a new option, -I, which
uses a single continuous address space covering all files to edit
in-place -- they are too cool to just drop them.

Add regression tests for -i and -I.

Approved by:	dds
Compared with:	GNU sed
Discussed on:	-hackers
MFC after:	2 weeks
2007-04-21 01:21:36 +00:00
Yaroslav Tykhiy 78e7d37750 Logically separate the complex hanoi' and math' tests from basic tests. 2007-04-02 08:20:43 +00:00
Yaroslav Tykhiy e9a0eed451 Don't forget to close the range if we branched over its end
and had no chance to match it by the 2nd address precisely.
Otherwise the unclosed range would bogusly extend to the end
of stream.

Add a basic regression test for the bug fixed.  (This change
also fixes the more complex case 5.3 from `multitest.t'.)

Compared with:	SUN and GNU seds
Tested by:	regression tests
MFC after:	1 week
2007-04-02 08:14:46 +00:00
Yaroslav Tykhiy d7cfea0e1a Today SUN and GNU seds fully agree on test 5.3 and behave
in a more reasonable way than BSD sed does: they properly
close the range even if we branched over its end.  No doubt,
the range `1,5' should not match lines from 9 through 14.
2007-04-02 07:50:10 +00:00
Yaroslav Tykhiy 6b8ef68111 This trivial change should fix at least 3 similar bugs. All of
them are related to the `c' function's need to know if we are at
the actual end of the address range.  (It must print the text not
earlier than the whole pattern space was deleted.)  It appears the
only sed function with this requirement.

There is `lastaddr' set by applies(), which is to notify the `c'
function, but it can't always help because it's false when we are
hitting the end of file early.  There is also a bug in applies()
due to which `lastaddr' isn't set to true on degenerate ranges such
as `$,$' or `N,$' if N appears the last line number.

Handling early EOF condition in applies() could look more logical,
but it would effectively revert sed to the unreasonable behaviour
rev. 1.26 of main.c fought against, as it would require lastline()
be called for each line within each address range.  So it's better
to call lastline() only if needed by the `c' function.

Together with this change to sed go regression tests for the bugs
fixed (c1-c3).  A basic test of `c' (c0) is also added as it helped
me to spot my own error.

Discussed with:		dds
Tested by:		the regression tests
MFC after:		1 week
2007-04-01 13:25:03 +00:00
Diomidis Spinellis 6dabf85649 Rename sed.test to multitest.t to comply with the naming scheme of
the regression suite.
2007-03-14 18:58:59 +00:00
Diomidis Spinellis 0a6ffa2714 Reinstate error-testing regression tests. 2007-03-14 13:38:23 +00:00
Diomidis Spinellis ab6386e42d Integrate the tests I wrote in 1992 with our current regression
testing framework and protocol.
2007-03-14 13:05:45 +00:00
Diomidis Spinellis 83f7d3636c Reference results for sed.test (to be renamed into multitest.t).
I have verified these with GNU sed 4.1.5 (and in some cases with Solaris
sed) and they are identical, with the following exceptions:
5.3: The result is unspecified and BSD sed behaves differently.
6.3: GNU sed gets it wrong
7.1: GNU sed gets it wrong
7.8: BSD sed gets it wrong
2007-03-14 12:46:22 +00:00
Diomidis Spinellis ac451395ea - Uncomment tests that were commented out
- Update platform-conditional tests to reflect current reality
- Fix conditional for test 7.8: it is the fault of BSD sed
2007-03-14 11:03:00 +00:00
Diomidis Spinellis 4c1ccdfd94 - It looks like BSD and GNU sed can nowadays pass two more tests.
- Test 7.8 fails for GNU sed not BSD.
2007-03-14 10:10:10 +00:00
Diomidis Spinellis 0bc4fe6eaa Use another non-printing test; address 0 now has a special meaning in GNU sed. 2007-03-14 09:47:00 +00:00
Diomidis Spinellis 7fdac324d9 Update tests to reflect the state of the art of sed in HEAD and
GNU sed 4.1.5.
Almost all of the tests that were skipped for BSD or GNU sed
now appear to work.
2007-03-14 09:05:41 +00:00
Diomidis Spinellis 412e5edfa8 Add sed math regression test. 2007-03-14 07:55:05 +00:00
Diomidis Spinellis 32ad3fd6da Add Towers of Hanoi regression test. 2007-03-14 07:52:38 +00:00
Diomidis Spinellis c29e1340e9 Add missing newline to correct failure of the regression test.
According to IEEE Std 1003.1, 2004 "Whenever the pattern space is
written to standard output or a named file, sed shall immediately
follow it with a <newline>."

An attempt at the same correction might have been made with r1.3,
which is however identical with r1.2.
2007-03-14 07:01:49 +00:00
Diomidis Spinellis 894407d359 New test cases demonstrating fixed bugs, and the reason why
fmtcheck can't be used.
2006-12-03 19:18:41 +00:00
Yaroslav Tykhiy a6afe5ada8 Fix and extend the -j option to pkill/pgrep WRT the jail
wildcard specifications.  Earlier the only wildcard syntax
was "-j 0" for "any jail".  There were at least
two shortcomings in it:  First, jail ID 0 was abused; it
meant "no jail" in other utils, e.g., ps(1).  Second, it
was impossible to match processed not in jail, which could
be useful to rc.d developers.  Therefore a new syntax is
introduced: "-j any" means any jail while "-j none" means
out of jail.  The old syntax is preserved for compatibility,
but now it's deprecated because it's limited and confusing.

Update the respective regression tests.  While I'm here,
make the tests more complex but sensitive:  Start several
processes, some in jail and some out of jail, so we can
detect that only the right processes are killed by pkill
or matched by pgrep.

Reviewed by:	gad, pjd
MFC after:	1 week
2006-11-23 11:55:17 +00:00
Diomidis Spinellis 0dc97cf078 Add the examples from the manual page. 2006-11-06 15:05:03 +00:00
Diomidis Spinellis 3b5adecb00 Updated results for bin/68981
PR:		bin/68981
2006-11-06 15:00:37 +00:00
Diomidis Spinellis 44d251df7a Regress.out is now regress.x.out. 2006-11-06 08:49:43 +00:00
Diomidis Spinellis 2c75d9c7ba Test the handling of supplied and default parameters. 2006-11-06 08:39:52 +00:00
Pawel Jakub Dawidek d56da50ae8 Add tests for -t option with short tty name - pkill(1) should accept both
(eg. "ttyv0" and "v0").
2005-11-07 16:56:16 +00:00
Hartmut Brandt 8cc2581b3d Add first tests for semicolon handling. The first test fails. This is
probably a bug in the parser.
2005-10-18 07:28:09 +00:00
Hartmut Brandt 70ebfd0e40 Add more tests for escaped newline handling and fix a test that currently
should fail because of a bug in the parser (test 2).
2005-10-18 07:20:14 +00:00
Pawel Jakub Dawidek b94557c2aa Add regression tests for '-L' option. 2005-08-25 20:13:58 +00:00
Pawel Jakub Dawidek 02a76f3fd7 '-F' option behaviour was reverted, so revert previous commit. 2005-08-25 20:11:39 +00:00
Pawel Jakub Dawidek dfe47d36df '-F' option now needs locked pidfile. Modify regression tests respectively. 2005-08-24 19:39:29 +00:00
Garance A Drosehn e9651b673d Correct one regression test (which was expected an incorrect answer), and
add a few more tests.  This matches bug fixes recently committed to 'env'.
2005-07-15 02:31:15 +00:00
Garance A Drosehn 2c87a19e7a Upgrade these regression tests to track recent changes to `env'.
Approved by:	re (blanket `env')
2005-06-21 21:43:38 +00:00
Garance A Drosehn 6cc00fe24c Add a suite of regression tests for all the recent changes to `env',
using my own script to handle it.  I wrote my own partially because
of all the quoting-issues involved with testing what I wanted to test,
and partially because this lets me commit one script and one data file,
instead of one-file-per-regression-test.

This suite was good enough for my initial testing (and it did help me
find a few bugs that would have otherwise been missed).  I'm not sure
how well it will work in general use, but I figured I might as well
commit it.  It won't *hurt* to have it available.  At the worst, people
can just ignore it.

Approved by:	re (blanket `env')
2005-06-20 04:17:12 +00:00
Hartmut Brandt 5878452aa9 Add a test for escaped newline handling. 2005-06-01 11:26:47 +00:00
Hartmut Brandt 6772dd14cb Add support for TODO tests. These are tests that are supposed to fail,
because of a make bug that should be fixed.
2005-06-01 11:25:38 +00:00
Hartmut Brandt d9ea463fbf Change the test infrastructure so that tests are easier to maintain and
so that make(1) will run in an almost clean environment and enhance the
description of the test infrastructure.

Add the ability to have multiple tests carried out per test script.

Give some tests more meaningful names.

Fix the usage message from the test scripts.

Make it possible to pass several commands to the test scripts like:
'sh test.t setup run compare clean'.
2005-05-31 14:13:07 +00:00
Hartmut Brandt cfc967e66a Add a test to check whether in compat mode make detectes builtins
on the command line and really executes the shell instead of directly
executing the command.
2005-05-20 15:25:04 +00:00
Hartmut Brandt ac8946e3d3 Add a test to ensure that in compat mode when a line contains no
shell meta characters it is not passed to the shell, but the command
is executed directly (given that the line is not a shell builtin) and
that the line with a meta character is passed to the shell.
2005-05-20 15:06:27 +00:00
Hartmut Brandt c9302692e6 Add a test that test whether we can replace the shell to use by
make with another shell and set all its parameters (meta and builtins
not tested here).
2005-05-20 14:50:30 +00:00
Hartmut Brandt 56f5aba2ca Some test cases for .SHELL target: builtin shell selection and
changing the path of a builtin shell.
2005-05-19 11:23:01 +00:00
Marcel Moolenaar e108c3d726 o -n option added.
o  -x option added.
2005-05-15 07:35:34 +00:00
Hartmut Brandt 1b26a92962 Add an initial regression test suite for make(1).
Submitted by:	Max Okumoto <okumotu@ucsd.edu> (partly, initial version)
2005-04-28 13:20:48 +00:00
Stefan Farfeleder a87ba6e923 Also test \0 in the format string. 2005-04-14 18:33:14 +00:00
Stefan Farfeleder 91e3aee000 Add a few regression tests for printf(1). 2005-04-13 20:08:17 +00:00
Pawel Jakub Dawidek 1897c44125 Add regression tests for pkill/pgrep.
MFC after:	3 days
2005-03-20 12:38:08 +00:00
Hartmut Brandt 012a8b3f81 Repo-copy tools/regression/usr.bin/make to tools/build/make_check
and adjust the path in the Makefile for the upgrade_checks target.
These checks are really feature upgrade checks that should be fast
and just find out whether we need to build a new make before
proceeding with other targets like buildworld. This makes the
place free for a real regression test suite in the old place.
2005-03-02 12:33:23 +00:00
Hartmut Brandt 89f087e8dd Fix builds with a read-only directory and a make upgrade. This is done
by forcing the creation of an object directory for the make regression
tests. Let make handle the tracking of the dependency and installation
of test_shell script.

Submitted by:	ru
2004-12-07 14:41:16 +00:00
Ruslan Ermilov d29cf9e2f3 Make this work under debugging, e.g., "make -dl". 2004-12-06 08:51:30 +00:00
Hartmut Brandt 9c1f3ca3cf Make the tests runnable on a read-only src. To do this you must make sure
that you create one of the object directories make knows (see make(1)).
This uses the -C flag, so add a test that checks that make actually accepts
-C. Also fix the test that selects csh via the .SHELL target to work for
tcsh users too.

This commit renames shell_test to shell_test.sh. There is no history
to preserve so go without a repo-copy.

Reviewed by:	ru
2004-12-02 17:00:58 +00:00
Hartmut Brandt 60f801ee87 Chmod the shell testscript to be executable if it isn't already. According
to the CVS-Meisters x-mode just happens to work, but is not guaranteed to
do so. Try to be on the safe side.
2004-11-30 15:33:18 +00:00
Hartmut Brandt 7b54cdda4e Add some regression tests for the .SHELL target. I'm not sure that the
output of shell_2j is actually correct - it just tests what make currently
does. Make should switch on echoing for the second line, shouldn't it?
2004-11-25 10:03:29 +00:00
Nik Clayton 00e13b1d67 Switch over to a different, more flexible test output protocol that's
understood by Perl's Test::Harness module and prove(1) commands.

Update README to describe the new protocol.  The work's broken down into
two main sets of changes.

First, update the existing test programs (shell scripts and C programs)
to produce output in the ok/not ok format, and to, where possible, also
produce a header describing the number of tests that are expected to be
run.

Second, provide the .t files that actually run the tests.  In some cases
these are copies of, or very similar too, scripts that already existed.
I've kept the old scripts around so that it's possible to verify that
behaviour under this new system (in terms of whether or not a test fails)
is identical to the behaviour under the old system.

Add a TODO file.
2004-11-11 19:47:55 +00:00
Ruslan Ermilov 9a5cf32635 Add a regression test for the alternate shell specification. 2004-10-23 21:38:58 +00:00
Hartmut Brandt 215431deb0 Now that make more correctly handles variable assignments
in .MAKEFLAGS targets enable the regression test for this.
2004-08-12 19:14:10 +00:00
Diomidis Spinellis 30fd73fb81 Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived
software (original contributor).

Reviewed by:	imp
2004-08-09 15:29:41 +00:00
Hartmut Brandt cfe632eaba Back out something I'm working on that crept in with the last commit.
Spotted by: ru
2004-08-05 09:11:44 +00:00
Hartmut Brandt 82eb7072de Remove extra spaces. Remove double quotes around error messages -
they are not needed and will actually be printed.

Submitted by:	ru
2004-08-05 08:44:00 +00:00
Hartmut Brandt c997f47be0 Add another test that checks for a working '+' command flag. 2004-08-05 07:24:06 +00:00
Hartmut Brandt 48ec21e7e6 Add a regression test for the passing of command line
variable assignments via the MAKEFLAGS environment variable.
2004-08-04 07:40:58 +00:00
Sean Kelly 528d980cc0 A new version that does exponents and lots of other neat things. Update
from the original author of math.sed.

Submitted by:	K S Braunsdorf <sed@ksb.npcguild.org>
2004-05-01 02:15:58 +00:00
Ruslan Ermilov 99d3652e69 Add a test for what was broken in rev. 1.28 and fixed in rev. 1.29
of make/str.c.
2004-01-30 09:46:28 +00:00
Ruslan Ermilov 9608d7e2cd Add a test for what was fixed in revs. 1.28 and 1.29 of make/str.c. 2004-01-29 22:51:36 +00:00
Ruslan Ermilov 21159d1687 Fix a bug that prevented exists() from finding "foo/", "foo/."
and "foo/.." when ".PATH: foo" was also given.

PR:		bin/34062
2003-10-02 21:30:30 +00:00
Diomidis Spinellis 37c94e1d78 Test 8.16 in sed.test tests the ability of a sed to handle an empty
regular expression as the first argument to a substitute command. If
used to test a sed which (erroneously) evaluates this at translation
time rather than at execution time, the bugged sed is put into an
infinite loop. This mode of failure seems excessive. Such a failing
sed is the Free Software Foundation's sed 3.02.

The specific test was also not being executed for the BSD sed.

Both problems are now fixed.

PR:		misc/25585
Submitted by:	Walter Briscoe <w.briscoe@ponl.com>
Approved by:	schweikh (mentor)
MFC after:	2 weeks
2003-07-22 19:22:08 +00:00
Ruslan Ermilov c94d70434f Fixed broken arithmetic expression parser.
Reminded by:	bde
In memory of:	alane
2003-07-04 13:33:48 +00:00
Tony Finch 7d3a298ba9 Add tests for the behaviour of substitution when the regex can match
a zero-length string. This shows bugs in the s///g and s///2+ cases.
2003-06-04 15:26:23 +00:00
Garance A Drosehn 413a16d889 The regression-tests for 'make' *expect* to trigger make's warning:
warning: duplicate script for target "double" ignored
The regression-tests do try to hide that message, but the message does
still appear when using -j (eg: 'make -j5 buildworld').  This changes the
regression-test so the expected warning message will not be seen even
when -j is specified.

Reviewed by:	jmallett  ru
2003-02-10 19:56:42 +00:00
Ruslan Ermilov be8b43b4c7 Add a test for what was fixed in revisions 1.39 and 1.50 of
make/parse.c (allow embedded `:' and `!' in target names).

Approved by:	re
2002-11-28 13:21:32 +00:00
Ruslan Ermilov 113cf9e649 Moved make(1) regression tests from src/Makefile to where they
belong (src/tools/regression/usr.bin/make), and use the latter
to test if make(1) is adequate for building the world.

Approved by:	re
2002-11-28 13:08:09 +00:00
Juli Mallett 5661d4a7b9 Hide the test in <target> under '.if make(<target>)' so as to not get any
errors/warnings related to crud in said test block.
2002-10-25 06:17:44 +00:00
Juli Mallett 89d22e2f06 As of revision 1.38 of make/parse.c, our make(1) will warn too. Note that
this isn't just for the sake of testing behaviour, and that things really
do break if this regression occurs.
2002-07-28 03:57:08 +00:00