Commit Graph

938 Commits

Author SHA1 Message Date
Jilles Tjoelker
b485cf94fb sh: Add a regression test that tries out all arithmetic ops.
MFC after:	1 week
2010-01-03 12:50:27 +00:00
David E. O'Brien
043ccc7cf3 Use t1 & t2 as more symbolic than 'a' and 'b' for the two times. 2010-01-03 12:17:51 +00:00
David E. O'Brien
70ec99bfd2 Provide clean output with 'prove -r'. 2010-01-03 11:53:48 +00:00
David E. O'Brien
91212b8c98 Hide expected error output so the 'prove -r' results are easy to read. 2010-01-03 09:31:33 +00:00
David E. O'Brien
a56d32a6a0 Allow to be driven by 'prove -r'. 2010-01-03 09:30:50 +00:00
David E. O'Brien
a174aecc2e Make sure 'pack' is usable for 'prove -r'. 2010-01-03 08:44:18 +00:00
David E. O'Brien
25255d7808 Transform from kernel file to userland source. 2010-01-03 08:33:24 +00:00
Jilles Tjoelker
f7cc73afc8 sh: Fix some bugs with backquoted builtins:
- correctly handle error output in $(builtin 2>&1), clarify out1/out2 vs
  output/errout in the code
- treat all builtins as regular builtins so errors do not abort the shell
  and variable assignments do not persist
- respect the caller's INTOFF

Some bugs still exist:
- expansion errors may still abort the shell
- some side effects of expansions and builtins persist
2010-01-01 18:17:46 +00:00
Brooks Davis
a6fffd6cb0 The devices that supported EVFILT_NETDEV kqueue filters were removed in
r195175.  Remove all definitions, documentation, and usage.

fifo_misc.c:
	Remove all kqueue tests as fifo_io.c performs all those that
	would have remained.

Reviewed by:	rwatson
MFC after:	3 weeks
X-MFC note:	don't change vlan_link_state() function signature
2009-12-31 20:29:58 +00:00
Jilles Tjoelker
0fb60646df sh: Use PATH= assignment in type.
Example:
  PATH=/var/empty; PATH=/bin type ls
2009-12-31 17:44:24 +00:00
Jilles Tjoelker
06a8a57f82 sh: Allow command -pv and command -pV (lookup using _PATH_STDPATH). 2009-12-31 16:13:33 +00:00
Jilles Tjoelker
63ccda7719 sh: arith: Return only 0 and 1 from && and ||.
This agrees with C, POSIX and other shells.
2009-12-30 15:59:40 +00:00
Antoine Brodin
13e403fdea (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR:		137213
Submitted by:	Eygene Ryabinkin (initial version)
MFC after:	1 month
2009-12-28 22:56:30 +00:00
Edward Tomasz Napierala
20c87efe63 Make tests for ACL preservation by mv(1) and cp(1) more complete
and easier to follow.
2009-12-27 13:05:56 +00:00
Jilles Tjoelker
29d401c22d sh: Do not run callers' exception handlers in subshells.
Reset the exception handler in the child to main's.

This avoids inappropriate double cleanups or shell duplication when the
exception is caught, such as 'fc' and future 'command eval' and 'command .'.
2009-12-25 20:21:35 +00:00
Edward Tomasz Napierala
28df1e77ee Add regression test for NFSv4 ACLs on UFS. 2009-12-21 20:47:41 +00:00
Robert Watson
407cf730b6 Merge libkqueue test suite through r119
Submitted by:	Mark Heily <mark@heily.com>
2009-12-15 10:43:20 +00:00
Robert Watson
60a396a4f7 Add Mark Heily's libkqueue test suite as a general kqueue test suite to
tools/regression.  It tests a number of aspects of kqueue behavior,
although not all currently pass (possibly bugs in the test suite?).

Submitted by:	Mark Heily <mark at heily.com>
Obtained from:	svn://mark.heily.com/libkqueue/trunk/test (r114)
2009-12-13 20:27:46 +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
Jilles Tjoelker
df8d66693f sh: Test ;<newline> as well as ; in the 'for' parser test. 2009-12-06 23:31:23 +00:00
Brian Feldman
20f492f0eb Do not gratuitously fail *env(3) operations due to corrupt ('='-less)
**environ entries.  This puts non-getenv(3) operations in line with
getenv(3) in that bad environ entries do not cause all operations to
fail.  There is still some inconsistency in that getenv(3) in the
absence of any environment-modifying operation does not emit corrupt
environ entry warnings.

I also fixed another inconsistency in getenv(3) where updating the
global environ pointer would not be reflected in the return values.
It would have taken an intermediary setenv(3)/putenv(3)/unsetenv(3)
in order to see the change.
2009-12-01 05:04:31 +00:00
Jilles Tjoelker
772e9b41df Disable job control when running 'sh -i' in the testsuite.
Job control tty manipulations sometimes cause the tests to stop (SIGTTOU
and the like) when run from the 'prove' tool.
2009-11-29 22:58:10 +00:00
Jilles Tjoelker
e1ef314121 Fix some cases where file descriptors from redirections leak to programs.
- Redirecting fds that were not open before kept two copies of the
  redirected file.
    sh -c '{ :; } 7>/dev/null; fstat -p $$; true'
    (both fd 7 and 10 remained open)
- File descriptors used to restore things after redirection were not
  set close-on-exec, instead they were explicitly closed before executing
  a program normally and before executing a shell procedure. The latter
  must remain but the former is replaced by close-on-exec.
    sh -c 'exec 7</; { exec fstat -p $$; } 7>/dev/null; true'
    (fd 10 remained open)

The examples above are simpler than the testsuite because I do not want to
use fstat or procstat in the testsuite.
2009-11-29 22:33:59 +00:00
Jung-uk Kim
0cdc14c810 Make this test case little bit more interesting. 2009-11-23 22:28:15 +00:00
Jilles Tjoelker
eaa3489312 sh: Ensure the same command input file is on top after executing a builtin.
This avoids weirdness when 'fc -e vi' or the like is done and there is a
syntax error in the file. Formerly an interactive shell tried to execute
stuff after the syntax error and exited.

This should also avoid similar issues with 'command eval' and 'command .'
when 'command' is implemented properly as in NetBSD sh.

Special builtins did not have this problem since errors in them cause the
shell to exit or to reset various state such as the current command input
file.
2009-11-22 14:04:20 +00:00
Jilles Tjoelker
e3c2cd7237 trap: do not consider a bad signal name a fatal error.
POSIX explicitly prescribes this.
Continue processing any other signals and return status 1.
2009-11-21 20:44:34 +00:00
Stefan Farfeleder
80d5dd5fdb Add a test for r199631. 2009-11-21 14:54:35 +00:00
Stefan Farfeleder
ee47d334ef Add a few very basic tests for cd -{L,P} and pwd -{L,P}. 2009-11-21 14:12:51 +00:00
Jung-uk Kim
908d88b03b Correct copyright date in the BPF regression test. 2009-11-20 19:01:09 +00:00
Jung-uk Kim
448a7ff2ec Adjust BPF JIT compiler regression tests to catch up with r199603. 2009-11-20 18:53:38 +00:00
Jung-uk Kim
b78db64f58 Add a test case for very long BPF program. 2009-11-19 00:00:31 +00:00
Jilles Tjoelker
7ab07e8ada sh: Allow a newline before "in" in a for command, as required by POSIX. 2009-11-14 22:08:32 +00:00
Dag-Erling Smørgrav
2deaa94b6a Add test-pidfile.c and increase warning level. 2009-11-12 01:37:25 +00:00
Dag-Erling Smørgrav
761ea75d41 Test cases for pidfile(3) - including two designed to catch issues arising
from the incorrect use of fcntl(2) instead of flock(2).
2009-11-12 01:37:02 +00:00
Dag-Erling Smørgrav
6830953bc1 Fix warnings and remove one unnecessary use of vfork(). The other could
also be removed with a little more work.
2009-11-12 01:34:55 +00:00
Dag-Erling Smørgrav
a2f8e5b371 Fix warnings 2009-11-12 01:33:57 +00:00
Dag-Erling Smørgrav
1a29dc59c5 Check fork() return value 2009-11-10 10:42:48 +00:00
Jilles Tjoelker
64254a667a sh: Exempt $@ and $* from set -u
This seems more useful and will likely be in the next POSIX standard.

Also document more precisely in the man page what set -u does (note that
$@, $* and $! are the only special parameters that can ever be unset, all
the others are always set, although they may be empty).
2009-10-24 21:20:04 +00:00
Jilles Tjoelker
941538c0f4 Add some tests for ${var?} and set -u. 2009-10-24 20:57:11 +00:00
Jilles Tjoelker
364e9ccb9c wordexp(3): fix some bugs with signals and long outputs
* retry various system calls on EINTR
* retry the rest after a short read (common if there is more than about 1K
  of output)
* block SIGCHLD like system(3) does (note that this does not and cannot
  work fully in threaded programs, they will need to be careful with wait
  functions)

PR:		90580
MFC after:	1 month
2009-10-23 14:50:11 +00:00
Pawel Jakub Dawidek
2cf3d848b6 Fix a case where rename actually succeeds, which is also expected behaviour
according to POSIX. This fixes ZFS on Solaris testing.

Submitted by:	Milan Cermak <Milan.Cermak@Sun.COM>
2009-10-20 21:08:32 +00:00
Dag-Erling Smørgrav
b146811680 Update copyright. 2009-10-19 07:56:03 +00:00
Dag-Erling Smørgrav
6026385bf4 Remove redundant $FreeBSD$. 2009-10-19 07:55:13 +00:00
Konstantin Belousov
eb9de28f20 Tweaks for sigqueue tests:
- slightly adjust code for style, sort headers.
- in sigqtest2, print received signals, to make it easy to see why test
  failed.
- in sigqtest2, job_control_test(), cover a race by adding sleep after
  child stopped itself to allow for SIGCHLD due to stop and exit to not
  be coalesced.

MFC after:	2 weeks
2009-10-11 17:04:13 +00:00
Xin LI
c27838c722 Fix build on amd64.
PR:		misc/139409
Submitted by:	gk
2009-10-07 23:01:31 +00:00
Jilles Tjoelker
640b70e414 sh: Send the "xyz: not found" message to redirected fd 2.
This also fixes that trying to execute a non-regular file with a command
name without '/' returns 127 instead of 126.
The fix is rather simplistic: treat CMDUNKNOWN as if the command were found
as an external program. The resulting fork is a bit wasteful but executing
unknown commands should not be very frequent.

PR:		bin/137659
2009-10-06 22:00:14 +00:00
Robert Watson
9cad1429d6 A few regression tests for SOCK_SEQPACKET UNIX domain sockets.
Sponsored by:	Google
2009-10-05 15:27:01 +00:00
David Schultz
caf17d8660 Regression tests for r197752 (handling of empty/NULL buffers). 2009-10-04 19:44:41 +00:00
Bjoern A. Zeeb
492ffed1e3 Replace the name of the sysctl to security.bsd.map_at_zero and to be
consistent updated the name of the variable as well, after the change
in r197711.
2009-10-02 17:53:48 +00:00
Jilles Tjoelker
47e5ae08a1 sh: Disallow mismatched quotes in backticks (...).
Due to the amount of code removed by this, it seems that allowing unmatched
quotes was a deliberate imitation of System V sh and real ksh. Most other
shells do not allow unmatched quotes (e.g. bash, zsh, pdksh, NetBSD /bin/sh,
dash).

PR:		bin/137657
2009-10-01 21:40:08 +00:00
Bjoern A. Zeeb
76e2ffb5a5 Add a simple C program to check mmap calls to various different addresses.
The most important test is the mapping fixed at address 0 depending on the
new sysctl.

Things will be updated and possibly converted to m4/.t style once the
details about the kernel patch will be shaken out.

Submitted by:	simon (initial version)
2009-09-27 21:03:33 +00:00
Edward Tomasz Napierala
c39f46352f Add cross-filesystem regression tests for ACLs. 2009-09-23 15:12:20 +00:00
Edward Tomasz Napierala
95e7b798b9 Add ACL fuzzer. It's not used by the regression tests right now,
but I'd prefert to have it here, so it won't get lost.
2009-09-23 15:06:51 +00:00
John Baldwin
0cab1e9602 - Remove a bogus test: setsockopt() doesn't return a length, getsockopt()
does.
- Use %z to printf a size_t to fix compile on 64-bit platforms.
2009-09-23 14:23:09 +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
Edward Tomasz Napierala
6839605389 Add regression tests for NFSv4 ACL granular permission enforcement. 2009-09-07 19:40:22 +00:00
Edward Tomasz Napierala
0103fcf5dc Add regression tests for NFSv4 ACLs and update POSIX.1e tests to the changed
error messages.
2009-09-07 16:26:03 +00:00
Edward Tomasz Napierala
5f483c5f73 Adapt to the fact that ls(1) correctly prints '+' for symlinks with ACLs now. 2009-09-01 15:51:36 +00:00
Edward Tomasz Napierala
2bf078b30b Add regression test for ACLs on device files - mostly to make
sure we don't crash on attempt to set ACL on them.
2009-08-31 20:11:35 +00:00
Jilles Tjoelker
e16947f83d sh: Fix crash with empty functions (f() { }) introduced in r196483
Empty pairs of braces are represented by a NULL node pointer, just like
empty lines at the top level.

Support for empty pairs of braces may be removed later. They make the code
more complex, have inconsistent behaviour (may or may not change $?), are
not specified by POSIX and are not allowed by some other shells like bash,
dash and ksh93.

Reported by:	kan
2009-08-28 22:41:25 +00:00
Jilles Tjoelker
840f51bb6d Add some tests for a fixed bug in an uncommitted patch.
(Trying to get syntax errors for sh -c ':; do' and `:; do`.)
2009-08-27 22:23:23 +00:00
Jilles Tjoelker
e9d90c5143 Add some tests for poll(2)/shutdown(2) interaction. 2009-08-25 20:33:37 +00:00
Jilles Tjoelker
eb33e843b8 sh: Fix crash when undefining or redefining a currently executing function.
Add a reference count to function definitions.
Memory may leak if multiple SIGINTs arrive in interactive mode,
this will be fixed later by changing SIGINT handling.

PR:		bin/137640
2009-08-23 21:09:46 +00:00
Bjoern A. Zeeb
e7fba5c772 Start respecting WITHOUT_INET6.
Make regression/priv compile again after the multi-IP jail
changes.  Note that we are still using the legacy jail(2)
rather than the jail_set(2)/jail(3) syscall.
Add an IPv4,  and an IPv6 loopback address in case we compile
with INET6 enabled.

Make the priv_vfs_extattr_system compile on amd64 as well using the
proper length modifier to printf(3) for ssize_t.

Reviewed by:	rwatson
Approved by:	re (kib)
2009-08-13 09:11:47 +00:00
Konstantin Belousov
5abb7fe2e9 Fix syntax error, makefile comments start with #.
Submitted by:	bde
Approved by:	re (kensmith)
2009-07-25 21:07:56 +00:00
Konstantin Belousov
5861f96654 Test suite for the poll(2)/select(2) on fifos, pipes and sockets,
and recorded results for several operating systems.

Submitted by:	bde
Approved by:	re (kensmith)
2009-07-12 12:50:43 +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
Edward Tomasz Napierala
340263c992 Fix fpathconf(3) on fifos, in effect making ls(1) properly
display '+' on them.  Taken from kern/125613, with cosmetic
changes.

PR:		kern/125613
Submitted by:	Jaakko Heinonen <jh at saunalahti dot fi>
Approved by:	re (kib)
2009-07-02 20:05:21 +00:00
Jilles Tjoelker
886bb28357 Add some tests for r194975 and r194977.
Approved by:	ed (mentor) (implicit)
2009-06-25 17:36:08 +00:00
Jilles Tjoelker
30268dfa3f Designate special builtins as such in command -V and type.
Also document various properties of special builtins that we implement.

Approved by:	ed (mentor) (implicit)
2009-06-24 22:04:04 +00:00
Jilles Tjoelker
97ab37f704 Add test for r190698.
Submitted by:	Eygene Ryabinkin
Approved by:	ed (mentor) (implicit)
2009-06-24 20:22:54 +00:00
Jilles Tjoelker
e2451bddff Add tests for r194774.
Approved by:	ed (mentor) (implicit)
2009-06-23 22:03:56 +00:00
Robert Watson
046a577d69 Up the scale of the SPX loopback check a bit: use much larger data sizes
so that we need to do segmentation.
2009-06-20 18:13:20 +00:00
Jilles Tjoelker
57c21ee73a Add tests for r194406 and r194516.
Approved by:	ed (mentor)
2009-06-19 22:15:59 +00:00
John Baldwin
c4f16b69e1 Add a new 'void closefrom(int lowfd)' system call. When called, it closes
any open file descriptors >= 'lowfd'.  It is largely identical to the same
function on other operating systems such as Solaris, DFly, NetBSD, and
OpenBSD.  One difference from other *BSD is that this closefrom() does not
fail with any errors.  In practice, while the manpages for NetBSD and
OpenBSD claim that they return EINTR, they ignore internal errors from
close() and never return EINTR.  DFly does return EINTR, but for the common
use case (closing fd's prior to execve()), the caller really wants all
fd's closed and returning EINTR just forces callers to call closefrom() in
a loop until it stops failing.

Note that this implementation of closefrom(2) does not make any effort to
resolve userland races with open(2) in other threads.  As such, it is not
multithread safe.

Submitted by:	rwatson (initial version)
Reviewed by:	rwatson
MFC after:	2 weeks
2009-06-15 20:38:55 +00:00
Jilles Tjoelker
1251149b3c Add tests for r194127 and r194128.
Approved by:	ed (mentor)
2009-06-14 16:21:51 +00:00
Dag-Erling Smørgrav
4138849fa7 Check that flopen() can lock against self and that children inherit the lock. 2009-06-06 19:07:15 +00:00
Pawel Jakub Dawidek
bf64a6b6b4 lchflags(2) takes int, not u_long like chflags(2) and fchflags(2).
Strange, isn't it?

Pointed out by:	bde
2009-06-03 09:24:58 +00:00
Stefan Farfeleder
912ee8a8a3 Add tests for r193169. 2009-05-31 17:23:27 +00:00
Zachary Loafman
cc79e34966 Add a regression test for multiple threads of the same process acquiring the same fcntl lock.
Approved by:        dfr (mentor)
2009-05-28 02:39:07 +00:00
Dag-Erling Smørgrav
2234b22628 Increment the counter outside the subshell. 2009-05-27 15:15:58 +00:00
Edwin Groothuis
84ccb25dc7 Add the regression test for bin/date. 2009-05-27 12:31:55 +00:00
Dag-Erling Smørgrav
93f2449bee Add a regression test for kern/21768.
MFC after:	1 week
2009-05-26 20:13:06 +00:00
Brian Somers
258f721bc9 Regression test the 'addr1,+N' feature added in r192732 2009-05-25 06:58:42 +00:00
Edwin Groothuis
a2f237f8b7 Add regression tests for the date(1) + argument for user-defined
format strings.

PR:		bin/127514
Submitted by:	edwin@
MFC after:	1 week
2009-05-20 22:01:43 +00:00
Stefan Farfeleder
c410810eb7 Add a test for r191009. 2009-04-13 19:12:28 +00:00
Edward Tomasz Napierala
00a76e962d Add a few more regression tests for POSIX.1e ACLs. 2009-04-13 13:51:53 +00:00
David Schultz
6685ac34d9 Return -1 instead of 0 upon reaching EOF. This is somewhat ill-advised
because it means getdelim() returns -1 for both error and EOF, and
never returns 0. However, this is what the original GNU	implementation
does, and POSIX inherited the bug.

Reported by:	marcus@
2009-04-06 13:50:04 +00:00
Stefan Farfeleder
acd5c42915 Test the r190298 change. 2009-03-22 23:00:52 +00:00
Stefan Farfeleder
8b1fa08c95 Add a few tests for the read built-in. 2009-03-22 22:14:46 +00:00
Stefan Farfeleder
d956d1eed5 Update test for r190284. 2009-03-22 21:12:00 +00:00
Stefan Farfeleder
2c93c8f251 Update and extend the tests for alias. 2009-03-22 17:22:14 +00:00
Pawel Jakub Dawidek
a71f46d368 Oops. Correct comment in the LICENSE file. 2009-03-14 21:59:12 +00:00
Pawel Jakub Dawidek
2f9e552de1 Regression tests for mac_portacl(4). 2009-03-14 21:54:19 +00:00
Roman Divacky
300d03a832 Switch over to gnu99 compilation on default for userland.
Tested by:	make universe
Tested by:	ports exp build (done by pav)
Reviewed by:	ru
Reviewed by:	silence on arch
Approved by:	ed (mentor)
2009-03-14 17:55:16 +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
Robert Watson
0ca4746bcb In UNIX domain socket GC regression test, after setting a socket
non-blocking, EINPROGRESS is an acceptable result from connect().
2009-03-08 21:06:02 +00:00
David Schultz
7fb2aa104f Tests for getdelim(). 2009-02-28 06:39:39 +00:00
David Schultz
e2ef8d9b1d Add a file containing tests for simple format specifiers.
Currently it only has tests for a few sign issues with integer
formats, including PR 131880.
2009-02-28 06:37:10 +00:00
David Schultz
f04a5a6c81 Tests for wcscasecmp(), wcsnlen(), and stpncpy(). 2009-02-28 06:34:04 +00:00
Ed Schouten
b3aaa0cc21 Rename all symbols in libmp(3) to mp_*, just like Solaris.
The function pow() in libmp(3) clashes with pow(3) in libm. We could
rename this single function, but we can just take the same approach as
the Solaris folks did, which is to prefix all function names with mp_.

libmp(3) isn't really popular nowadays. I suspect not a single
application in ports depends on it. There's still a chance, so I've
increased the SHLIB_MAJOR and __FreeBSD_version.

Reviewed by:	deischen, rdivacky
2009-02-26 21:43:15 +00:00
Pawel Jakub Dawidek
af30ab766e Add explicit casting in few places.
It is only really necessary for open(2)'s third argument, which is optional and
obtained through stdarg(3). open(2)'s third argument is 32bit and we pass 64
bits. On little endian it works, because we take lower 32 bits, but on big
endian platforms we take upper 32 bits, so we end up with 0.

Reported by:	Milan Čermák <Milan.Cermak@Sun.COM>
2009-02-23 07:33:29 +00:00
Robert Watson
d0e723a10c Add a regresion test to determine whether or not a file descriptor is
allocated in a fork(2)-inheritable way at the beginning or end of an
accept(2) system call.  This test creates a test thread and blocks it
in accept(2), then forks a child process which tests to see if the
next available file descriptor is defined or not (EBADF vs EINVAL for
ftruncate(2)).

This detects a regression introduced during the network stack locking
work, in which a very narrow race during which fork(2) from one
thread during accept(2) in a second thread lead to an extra inherited
file descriptor turned into a very wide race ensuring that a
descriptor was leaked into the child even though it hadn't been
returned.

PR:		kern/130348
2009-02-11 13:44:27 +00:00
David Schultz
acb3b7c668 Test wprintf() in addition to printf(). 2009-01-31 18:32:39 +00:00
David Schultz
d7b27f3d13 Add tests for conj{,f,l}() that I wrote some time ago. These test the
versions in libm, not the gcc builtins.
2009-01-31 18:31:57 +00:00
Pawel Jakub Dawidek
092513dad4 Be more Solaris-friendly.
Submitted by:	Milan Cermak <Milan.Cermak@Sun.COM>
2009-01-16 18:09:49 +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
Stefan Farfeleder
b0cb038bc5 Update for 185401, errors now go to stderr. 2008-11-28 18:59:04 +00:00
Edward Tomasz Napierala
c55f5be9d1 Add tools-level test for POSIX.1e functionality.
Approved by:	rwatson (mentor)
2008-11-25 18:29:33 +00:00
Pawel Jakub Dawidek
bbc9c92b45 This actually works on Linux, I just had wrong directory permission.
Found by:	trasz
2008-11-24 16:33:23 +00:00
Pawel Jakub Dawidek
6362fd6090 Include TODO messages even if tests succeeds, so we can detect when something
suddenly started to work.
2008-11-24 16:32:39 +00:00
Stefan Farfeleder
a5e27424dd Add a test for r185231. 2008-11-23 20:27:03 +00:00
Pawel Jakub Dawidek
e6b0bd3a3c Mark all the places where Linux is not POSIX-compilant. Tested on ext3. 2008-11-23 20:17:17 +00:00
Pawel Jakub Dawidek
e5419ebc25 fstest for Linux:
- Use -- when needed so Linux getopt(3) won't get confused.
- Follow POSIX more closely.

Submitted by:	Szabolcs Szakacsits <szaka@ntfs-3g.org>
2008-11-23 20:07:00 +00:00
Pawel Jakub Dawidek
d385c6dd7e fstest for Linux:
Automatically detect file system type.
2008-11-23 20:02:14 +00:00
Pawel Jakub Dawidek
48a8b4cd56 FreeBSD's way of handling rmdir("..") is not POSIX-compilant. 2008-11-23 19:58:26 +00:00
Pawel Jakub Dawidek
92c1c812f1 Shorter version. 2008-11-23 19:57:16 +00:00
Pawel Jakub Dawidek
564ecacd18 Add support for pathconf(2). 2008-11-23 19:56:40 +00:00
Pawel Jakub Dawidek
12459746f8 Detect operating system automatically. 2008-11-23 19:56:09 +00:00
Pawel Jakub Dawidek
707d3a52eb fstest for Linux:
- Use /dev/urandom, it is more portable.
- Implement todo() function which allows to mark known failures.
2008-11-23 19:50:20 +00:00
Pawel Jakub Dawidek
36aca13fdf IFp4: Regression tests for FreeBSD/ZFS chflags(2)/lchflags(2). 2008-11-22 13:27:15 +00:00
Pawel Jakub Dawidek
1ba4a712dd Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes.
This bring huge amount of changes, I'll enumerate only user-visible changes:

- Delegated Administration

	Allows regular users to perform ZFS operations, like file system
	creation, snapshot creation, etc.

- L2ARC

	Level 2 cache for ZFS - allows to use additional disks for cache.
	Huge performance improvements mostly for random read of mostly
	static content.

- slog

	Allow to use additional disks for ZFS Intent Log to speed up
	operations like fsync(2).

- vfs.zfs.super_owner

	Allows regular users to perform privileged operations on files stored
	on ZFS file systems owned by him. Very careful with this one.

- chflags(2)

	Not all the flags are supported. This still needs work.

- ZFSBoot

	Support to boot off of ZFS pool. Not finished, AFAIK.

	Submitted by:	dfr

- Snapshot properties

- New failure modes

	Before if write requested failed, system paniced. Now one
	can select from one of three failure modes:
	- panic - panic on write error
	- wait - wait for disk to reappear
	- continue - serve read requests if possible, block write requests

- Refquota, refreservation properties

	Just quota and reservation properties, but don't count space consumed
	by children file systems, clones and snapshots.

- Sparse volumes

	ZVOLs that don't reserve space in the pool.

- External attributes

	Compatible with extattr(2).

- NFSv4-ACLs

	Not sure about the status, might not be complete yet.

	Submitted by:	trasz

- Creation-time properties

- Regression tests for zpool(8) command.

Obtained from:	OpenSolaris
2008-11-17 20:49:29 +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
Edward Tomasz Napierala
24878441f6 Make test for write access to the directory being moved a little more
specific.

Approved by:	rwatson (mentor)
2008-11-07 14:46:46 +00:00
Edward Tomasz Napierala
74019bf2bc Improve output when a test fails.
Approved by:	rwatson (mentor)
2008-11-07 14:45:42 +00:00
Edward Tomasz Napierala
b92eda309d Change ZFS behaviour to match UFS: when moving (rename(2)) a subdirectory
from one parent directory to another, in addition to the usual access checks
one also needs write access to the subdirectory being moved.

Approved by:    rwatson (mentor), pjd
2008-11-06 19:17:58 +00:00
Doug Rabson
a9148abd9d Implement support for RPCSEC_GSS authentication to both the NFS client
and server. This replaces the RPC implementation of the NFS client and
server with the newer RPC implementation originally developed
(actually ported from the userland sunrpc code) to support the NFS
Lock Manager.  I have tested this code extensively and I believe it is
stable and that performance is at least equal to the legacy RPC
implementation.

The NFS code currently contains support for both the new RPC
implementation and the older legacy implementation inherited from the
original NFS codebase. The default is to use the new implementation -
add the NFS_LEGACYRPC option to fall back to the old code. When I
merge this support back to RELENG_7, I will probably change this so
that users have to 'opt in' to get the new code.

To use RPCSEC_GSS on either client or server, you must build a kernel
which includes the KGSSAPI option and the crypto device. On the
userland side, you must build at least a new libc, mountd, mount_nfs
and gssd. You must install new versions of /etc/rc.d/gssd and
/etc/rc.d/nfsd and add 'gssd_enable=YES' to /etc/rc.conf.

As long as gssd is running, you should be able to mount an NFS
filesystem from a server that requires RPCSEC_GSS authentication. The
mount itself can happen without any kerberos credentials but all
access to the filesystem will be denied unless the accessing user has
a valid ticket file in the standard place (/tmp/krb5cc_<uid>). There
is currently no support for situations where the ticket file is in a
different place, such as when the user logged in via SSH and has
delegated credentials from that login. This restriction is also
present in Solaris and Linux. In theory, we could improve this in
future, possibly using Brooks Davis' implementation of variant
symlinks.

Supporting RPCSEC_GSS on a server is nearly as simple. You must create
service creds for the server in the form 'nfs/<fqdn>@<REALM>' and
install them in /etc/krb5.keytab. The standard heimdal utility ktutil
makes this fairly easy. After the service creds have been created, you
can add a '-sec=krb5' option to /etc/exports and restart both mountd
and nfsd.

The only other difference an administrator should notice is that nfsd
doesn't fork to create service threads any more. In normal operation,
there will be two nfsd processes, one in userland waiting for TCP
connections and one in the kernel handling requests. The latter
process will create as many kthreads as required - these should be
visible via 'top -H'. The code has some support for varying the number
of service threads according to load but initially at least, nfsd uses
a fixed number of threads according to the value supplied to its '-n'
option.

Sponsored by:	Isilon Systems
MFC after:	1 month
2008-11-03 10:38:00 +00:00
Dag-Erling Smørgrav
75bd5e763f #ifdef out the lock-against-self test. I'm not sure it makes sense, and
it relies on non-portable flock(2) semantics.  Not only is flock(2) not
portable, but on some OSes that do have it, it is implemented in terms
of fcntl(2) locks, which are per-process rather than per-descriptor.
2008-10-20 17:26:30 +00:00
Robert Watson
a848550a77 Update udpzerobyte to understand that passing 0 as a length to recv(2)
will cause it to return 0, not EAGAIN.

Add UNIX domain socket support to udpzerobyte, which suggests this
regression test should be moved to the general sockets test area rather
than netinet.
2008-10-07 21:01:23 +00:00
Robert Watson
dba96bd99f Add IPv6 support to zero-size UDP transmit/receive test. 2008-10-07 14:13:59 +00:00
Robert Watson
8c3bc1af40 Regression test for the loopback handling of zero-length UDP packets, which
should be delivered but without payload.
2008-10-07 10:31:55 +00:00
Robert Watson
cb824561e6 Add very simple regression test for fstat(2) on sockets: make sure it
returns success for various socket types.  It's easy to imagine this
being enhanced to validate the returned data, but...
2008-10-06 19:42:03 +00:00
Maxim Konovalov
4225b7d6fa o Correct a comment: a test file size is a four pages not three. 2008-09-10 09:32:25 +00:00
David Schultz
73a3a6581e Regression tests for bugs in gdtoa. 2008-09-03 07:35:14 +00:00
Robert Watson
72cf344f9c Update README to reflect removal of netatm/harp test parts some time ago.
MFC after:	3 days
2008-08-31 11:41:31 +00:00
Jung-uk Kim
4c84e72151 Connect a forgotten test case to Makefile. 2008-08-29 20:58:01 +00:00
Jung-uk Kim
51fc382e51 Do not pass validatation level since all issues are fixed now. 2008-08-29 20:20:30 +00:00
Jung-uk Kim
ec07961360 Merge local copy of bpf_validate() with bpf_filter.c. 2008-08-29 20:07:02 +00:00
Pawel Jakub Dawidek
ba196edbd2 By default backup geli metadata to a file. It is quite critical 512 bytes,
once it is lost, all data is gone.

Option '-B none' can by used to prevent backup. Option '-B path' can be
used to backup metadata to a different file than the default, which is
/var/backups/<prov>.eli.

The 'geli init' command also prints backup file location and gives short
procedure how to restore metadata.

The 'geli setkey' command now warns that even after passphrase change or keys
update there could be version of the master key encrypted with old
keys/passphrase in the backup file.

Add regression tests to verify that new functionality works as expected.

Update other regression tests so they don't create backup files.

Reviewed by:	keramida, rink
Dedicated to:	a friend who lost 400GB of his live by accidentally overwritting geli metadata
MFC after:	2 weeks
2008-08-29 18:10:18 +00:00
Jung-uk Kim
f6cd36de6f Merge bpf_filter.c r182425 and add test cases for jump range checks.
While I am here, fix stupid typos in test0080.h and make it JIT compiler only.
2008-08-29 02:12:45 +00:00
Jung-uk Kim
eaa830ed41 Move comments to the right places. 2008-08-28 22:41:31 +00:00
Jung-uk Kim
291e9e2772 Merge bpf_filter.c r182412 and remove additional local checks.
While I am here, use more realistic value for illegal code test case.
2008-08-28 22:19:57 +00:00
Jung-uk Kim
dfedc4d796 Fix style consistencies and a comment. 2008-08-28 18:38:55 +00:00
Jung-uk Kim
855aaac7ac Merge bpf_filter.c r182380 and remove additional local checks
for BPF_STX and BPF_LDX|BPF_MEM instructions.
2008-08-28 17:59:16 +00:00
Jung-uk Kim
c0e134d668 Add a test case for uninitialized scratch memory (for JIT compiler). 2008-08-28 16:58:30 +00:00
Stefan Farfeleder
8d372294f9 Add a test for r182300. 2008-08-27 20:26:34 +00:00
Jung-uk Kim
218223bb17 Add a test case for null filter. 2008-08-26 21:54:47 +00:00
Jung-uk Kim
bf2a220894 Add more test cases for invalid instructions and add comments
about bpf_validate(9) issues.
2008-08-26 19:24:58 +00:00
Jung-uk Kim
e3a315fed1 Remove some hacks from regression test since bpf_filter.c builds fine now. 2008-08-26 00:35:04 +00:00
Jung-uk Kim
143a24dad7 Add a trivial bpf filter benchmark. 2008-08-25 23:36:24 +00:00
Jung-uk Kim
71d7a7dd88 Use sys/net/bpf_jitter.c instead of rolling our own version
since it is compilable on user land now.
2008-08-25 22:45:18 +00:00
Jung-uk Kim
f7402f1a67 Reflect sys/net/bpf_jitter.h changes to regression test. 2008-08-25 21:33:12 +00:00
Jung-uk Kim
ed97cc0f0c Add test case for 'divide by 0' with BPF_ALU|BPF_DIV|BPF_X instruction. 2008-08-18 23:05:19 +00:00
Jung-uk Kim
b82a8cd81c Fix two test cases on 32-bit architectures. 2008-08-18 21:40:03 +00:00
Jung-uk Kim
b0729b181a Add simple bpf(9) regression tests and test cases. 2008-08-18 19:01:58 +00:00
Dag-Erling Smørgrav
2616144e43 Add sbuf_new_auto as a shortcut for the very common case of creating a
completely dynamic sbuf.

Obtained from:	Varnish
MFC after:	2 weeks
2008-08-09 11:14:05 +00:00
David Schultz
b1e24d8714 Test that the result is correctly rounded when |y/x| is huge. 2008-08-02 19:21:33 +00:00
David Schultz
4c7c6686c3 Regression tests for fmtcheck(3).
Obtained from:	NetBSD
2008-08-02 06:03:04 +00:00
Sean Farley
3522c38bbe Detect if the application has cleared the environ variable by setting
the first value (environ[0]) to NULL.  This is in addition to the
current detection of environ being replaced, which includes being set to
NULL.  Without this fix, the environment is not truly wiped, but appears
to be by getenv() until an *env() call is made to alter the enviroment.

This change is necessary to support those applications that use this
method for clearing environ such as Dovecot and Postfix.  Applications
such as Sendmail and the base system's env replace environ (already
detected).  While neither of these methods are defined by SUSv3, it is
best to support them due to historic reasons and in lieu of a clean,
defined method.

Add extra units tests for clearing environ using four different methods:
1. Set environ to NULL pointer.
2. Set environ[0] to NULL pointer.
3. Set environ to calloc()'d NULL-terminated array.
4. Set environ to static NULL-terminated array.

Noticed by:	Timo Sirainen

MFC after:	3 days
2008-08-02 02:34:35 +00:00
Sean Farley
86168e1567 Fix whitespace. 2008-08-02 01:38:03 +00:00
David Schultz
eb516506c9 Add some tests for acos*(), asin*(), atan*(), and atan2*(). 2008-07-31 22:43:38 +00:00
Stefan Farfeleder
58bbcf95ef Add a regression test for r181017.
Submitted by:	simon
2008-07-30 21:18:52 +00:00
Robert Watson
fc384eb954 Remove extra comment that snuck in in last commit. 2008-07-29 18:38:37 +00:00
Robert Watson
8969dfea49 Add a simple ICMPv6 filter test for IPv6 raw sockets: determine that
the default ICMPv6 filter is pass all, test that we can set it to block
all and restore to pass all.  No attempt is made to test that the
filtering works, just that we can get and set it.
2008-07-29 18:33:56 +00:00
David Schultz
8bb8d6397d Add regression tests for fmin{,f,l} and fmax{,f,l}.
I wrote these to test amd64 asm functions that used
maxss, maxsd, minss, and minsd, but it turns out that
those instructions don't handle NaNs and signed zero
in the same way as fmin() and fmax() are required to,
so we're stuck with the C versions for now.
2008-07-03 23:06:06 +00:00
David Schultz
b03825c532 Add some regression tests for printf() with positional arguments.
The first test comes from OpenBSD, and the others are additions or
adaptations.

This is based on OpenBSD's
src/regress/lib/libc/sprintf/sprintf_test.c, v1.3.
I deliberately did not use v1.4 because it's bogus.
2008-06-29 21:03:14 +00:00
John Baldwin
6bc1e9cd84 Rework the lifetime management of the kernel implementation of POSIX
semaphores.  Specifically, semaphores are now represented as new file
descriptor type that is set to close on exec.  This removes the need for
all of the manual process reference counting (and fork, exec, and exit
event handlers) as the normal file descriptor operations handle all of
that for us nicely.  It is also suggested as one possible implementation
in the spec and at least one other OS (OS X) uses this approach.

Some bugs that were fixed as a result include:
- References to a named semaphore whose name is removed still work after
  the sem_unlink() operation.  Prior to this patch, if a semaphore's name
  was removed, valid handles from sem_open() would get EINVAL errors from
  sem_getvalue(), sem_post(), etc.  This fixes that.
- Unnamed semaphores created with sem_init() were not cleaned up when a
  process exited or exec'd.  They were only cleaned up if the process
  did an explicit sem_destroy().  This could result in a leak of semaphore
  objects that could never be cleaned up.
- On the other hand, if another process guessed the id (kernel pointer to
  'struct ksem' of an unnamed semaphore (created via sem_init)) and had
  write access to the semaphore based on UID/GID checks, then that other
  process could manipulate the semaphore via sem_destroy(), sem_post(),
  sem_wait(), etc.
- As part of the permission check (UID/GID), the umask of the proces
  creating the semaphore was not honored.  Thus if your umask denied group
  read/write access but the explicit mode in the sem_init() call allowed
  it, the semaphore would be readable/writable by other users in the
  same group, for example.  This includes access via the previous bug.
- If the module refused to unload because there were active semaphores,
  then it might have deregistered one or more of the semaphore system
  calls before it noticed that there was a problem.  I'm not sure if
  this actually happened as the order that modules are discovered by the
  kernel linker depends on how the actual .ko file is linked.  One can
  make the order deterministic by using a single module with a mod_event
  handler that explicitly registers syscalls (and deregisters during
  unload after any checks).  This also fixes a race where even if the
  sem_module unloaded first it would have destroyed locks that the
  syscalls might be trying to access if they are still executing when
  they are unloaded.

  XXX: By the way, deregistering system calls doesn't do any blocking
  to drain any threads from the calls.
- Some minor fixes to errno values on error.  For example, sem_init()
  isn't documented to return ENFILE or EMFILE if we run out of semaphores
  the way that sem_open() can.  Instead, it should return ENOSPC in that
  case.

Other changes:
- Kernel semaphores now use a hash table to manage the namespace of
  named semaphores nearly in a similar fashion to the POSIX shared memory
  object file descriptors.  Kernel semaphores can now also have names
  longer than 14 chars (up to MAXPATHLEN) and can include subdirectories
  in their pathname.
- The UID/GID permission checks for access to a named semaphore are now
  done via vaccess() rather than a home-rolled set of checks.
- Now that kernel semaphores have an associated file object, the various
  MAC checks for POSIX semaphores accept both a file credential and an
  active credential.  There is also a new posixsem_check_stat() since it
  is possible to fstat() a semaphore file descriptor.
- A small set of regression tests (using the ksem API directly) is present
  in src/tools/regression/posixsem.

Reported by:	kris (1)
Tested by:	kris
Reviewed by:	rwatson (lightly)
MFC after:	1 month
2008-06-27 05:39:04 +00:00
John Baldwin
62344da1e6 Fix compile on 64-bit platforms. 2008-06-26 21:26:34 +00:00
Doug Rabson
c675522fc4 Re-implement the client side of rpc.lockd in the kernel. This implementation
provides the correct semantics for flock(2) style locks which are used by the
lockf(1) command line tool and the pidfile(3) library. It also implements
recovery from server restarts and ensures that dirty cache blocks are written
to the server before obtaining locks (allowing multiple clients to use file
locking to safely share data).

Sponsored by:	Isilon Systems
PR:		94256
MFC after:	2 weeks
2008-06-26 10:21:54 +00:00
Robert Watson
1a0046f73b Teach fifo_create regression test to also try to use mknod(2) to create
fifos, as this is required by the Single UNIX Specification, although
not currently implemented on FreeBSD.

While here, fix a bug in the directory timestamp checking test by
sleeping after querying the starting timestamp, rather than before.
2008-06-22 21:03:26 +00:00
David Schultz
c0ff67d57f Regression test for a recently fixed strtod bug. 2008-06-21 19:28:26 +00:00
Robert Watson
dfc98f3895 Remove two netatm-specific test parts.
MFC after:	3 weeks
Spotted by:	bz
2008-05-26 22:41:40 +00:00
Roman Divacky
e5de992c3f Simple testing program for *at family of syscalls.
Approved by:	kib (mentor)
2008-05-18 08:34:04 +00:00
Stefan Farfeleder
bf7c82844c Test the expansion of $LINENO. 2008-05-15 19:58:44 +00:00
Adrian Chadd
a47f853e1c Add the ability to do all read, all write, or random read/write. 2008-05-15 16:10:55 +00:00
Adrian Chadd
86067c7714 Include a very basic (and beta) tool for stressing disks using the POSIX
AIO calls.

This small program queues up a controllable number of concurrent AIO
read operations w/ controllable io size against a disk or regular file.
There are a few other things to add (notably optional write support!)
but it works well enough at the present time to stress the AIO code out
relatively harshly in the disk IO case.
2008-05-07 07:23:47 +00:00
Sean Farley
0b5e889911 Add four utility functions related to struct grp processing modeled in-part
after similar calls related to struct pwd in libutil/pw_util.c:
  - gr_equal()
    Perform a deep comparison of two struct grp's.  It does a thorough, yet
    unoptimized comparison of all the members regardless of order.

  - gr_make()
    Create a string (see group(5)) from a struct grp.

  - gr_dup()
    Duplicate a struct grp.  Returns a value that is a single contiguous
    block of memory.

  - gr_scan()
    Create a struct grp from a string (as produced by gr_make()).

MFC after:	3 weeks
2008-04-23 00:49:13 +00:00
Sean Farley
8cfaf5a9e1 Differentiate in the tests against getenv() between an empty string and a
NULL by having the test program return *NULL* for NULL's (no existing
variable) instead of an empty string (variable with empty value).
2008-04-23 00:45:48 +00:00
David Schultz
e058c00c40 Updates for changes in the way printf() handles hex floating point
numbers.
2008-04-12 03:11:56 +00:00
David Schultz
c79a26333b Add some tests for fma(), fmaf(), and fmal(). 2008-04-03 06:15:58 +00:00
David Schultz
d6722d7484 Test remainderl() and remquol() as well. 2008-03-30 20:48:33 +00:00
David Schultz
958be17bad Add some minimal tests for csqrtl(). 2008-03-30 20:09:51 +00:00
Doug Rabson
f794f567e9 Fix the __FreeBSD_version check. 2008-03-26 15:42:22 +00:00
Doug Rabson
a94c70d79c Add some regression tests for posix record locks. 2008-03-26 15:39:44 +00:00
Stefan Farfeleder
c20ee5ab6d Add a test case for options.c revision 1.26. 2008-03-22 14:07:49 +00:00
Antoine Brodin
e3ad7f6626 Introduce a new F_DUP2FD command to fcntl(2), for compatibility with
Solaris and AIX.
fcntl(fd, F_DUP2FD, arg) and dup2(fd, arg) are functionnaly equivalent.
Document it.
Add some regression tests (identical to the dup2(2) regression tests).

PR:		120233
Submitted by:	Jukka Ukkonen
Approved by:	rwaston (mentor)
MFC after:	1 month
2008-03-08 22:02:21 +00:00
David Schultz
fb3b9b52bc Don't run tests that assume <= 64-bit precision on machines with quad
precision.
2008-03-02 20:49:24 +00:00
Sean Farley
143d18cafc Remove a dereference. It was unintended and a no-op.
Use the correct value of errno.  Although the errno value passed into
printf() follows the *env() call, it is not guaranteed to be the errno
from that call.  When I wrote the regression tester, the environment I
used did pass the errno from the call.  Consolidate the print for the
return code and errno into a function in the process of fixing this.

Approved by:	wes (mentor)
2008-03-01 00:02:12 +00:00
Stefan Farfeleder
7cdc70f201 Add a regression test for cd.c's revision 1.35. 2008-02-24 16:52:02 +00:00
Ruslan Ermilov
b7498df286 getopt(3) returns -1, not EOF. 2008-02-19 07:09:19 +00:00
David Schultz
a84bcdcea5 Some basic regression tests for {sin,cos,tan}{,f,l}(). 2008-02-18 02:00:16 +00:00
David Schultz
69aa771036 There are 3 tests here, not 2. 2008-02-17 22:45:53 +00:00
Robert Watson
b0cfa3c432 Add open_to_operation, a security regression test that opens files with
various open flags and then tests various operations to make sure that
they are properly constrained by open flags.  Various I/O mechansms
are tried, including aio if compiled into the kernel or loaded as a
module.  There's more to be done here but it's a useful start, running
about 220 individual tests.

This is in support of FreeBSD-SA-08:03.sendfile.
2008-02-14 20:57:38 +00:00
Dag-Erling Smørgrav
ecd14de7d7 mutex_islocked_np -> mutex_isowned_np 2008-02-06 19:41:05 +00:00
Mike Silbersack
fd2e4074d2 This is a regression test to verify the proper behavior of IP ID generation
code.  It will push 200000 packets, then report back what the min and max
periods it saw for different IDs were.
2008-02-06 15:48:43 +00:00
Dag-Erling Smørgrav
fcd61d9141 After careful consideration (and a brief discussion with attilio@), change
the semantics of pthread_mutex_islocked_np() to return true if and only if
the mutex is held by the current thread.

Obviously, change the regression test to match.

MFC after:	2 weeks
2008-02-04 12:35:23 +00:00
Dag-Erling Smørgrav
8dbd3d1b6b Add a regression test for pthread_mutex_islocked_np().
MFC after:	2 weeks
2008-02-03 22:35:45 +00:00
Robert Watson
9cf15e9671 Add unix_sorflush, a regression test for the following scenario:
- Process (a) is blocked in read on a socket waiting on data.
 - Process (b) is blocked in shutdown() on a socket waiting on (a).
 - Process (c) delivers a signal to (b) interrupting its wait.

When the signal is delivered, the kernel panics as sblock() fails in
sorflush().  Even if it didn't panic, shutdown() would block potentially
indefinitely waiting for recv() to succeeded.  Fixes to follow.

Reported by:	Jos Backus <jos at catnook dot com>
2008-01-30 13:23:34 +00:00
David Schultz
007d5445df expm1(-big) generates an inexact exception but not underflow. 2008-01-18 22:10:57 +00:00
David Schultz
e5af135aad Add some regression tests for libm's exponential functions. These
mostly just test corner cases rather than accuracy. Some of the
tests don't pass right now if you compile libm at -O2 due to gcc
constant-folding some things that it shouldn't. I'll fix that
shortly.
2008-01-18 21:46:54 +00:00
John Baldwin
8ffbe1559e Add a set of regression tests for the POSIX shm API (shm_open(2) and
shm_unlink(2)).
2008-01-16 15:51:24 +00:00
David Schultz
dd00a42722 Tests for lrintl() and llrintl(). I didn't add anything specially
tailored for the long double format; instead, I just modified the existing
tests to test lrintl() and llrintl() as well.
2008-01-14 02:18:00 +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
Robert Watson
c8c3fc568f Add regression tests for UNIX domain socket garbage collection. Should be
run from single-user mode, as they look at global open file and inflight
descriptor counts to check for leaks.
2007-12-31 16:45:27 +00:00
Diomidis Spinellis
990ccb021b Update the number of reported tests to keep prove(1) happy. 2007-12-19 11:52:33 +00:00
Diomidis Spinellis
8990390086 Correct the "move file from directory to existing directory" test for
cross-device moves.
2007-12-19 11:00:22 +00:00
Diomidis Spinellis
381e3dcbea Portability improvements to investigate behavior of other OSs.
Now works under Solaris and Linux.
2007-12-18 08:53:04 +00:00
Diomidis Spinellis
36571ab3b5 Add more tests. All rename(2)-based tests now succeed.
The performance of the cross-device equivalents is under investigation.
2007-12-18 08:49:47 +00:00
David Schultz
5a97a86c28 Fix an amusing typo that has prevented this from compiling since 2004. 2007-12-16 23:38:55 +00:00
David Schultz
3f7112a1f4 Don't try the long double tests on i386. Our reduced precision
can cause them to fail.
2007-12-16 23:36:37 +00:00
David Schultz
64577b835b Remove another Alpha remnant. 2007-12-16 23:00:18 +00:00
David Schultz
83f63fd648 Regression tests for nan{,f,l}(). 2007-12-16 21:19:51 +00:00
Diomidis Spinellis
e08ef41d11 Verify that the moved source is no longer there. 2007-12-16 08:25:34 +00:00
Diomidis Spinellis
67c3750f97 Regression tests for upcoming makeup of mv.
Case 20 corresponds to PR bin/118367.
2007-12-16 08:11:38 +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
David Schultz
2fd9221748 Regression tests for csqrt(3). 2007-12-15 09:16:26 +00:00
David Schultz
1b12fbb195 Remove some test instrumentation. (The Symbol.map changes broke it anyway.) 2007-12-09 21:00:12 +00:00
David Schultz
a468cce785 Fixes to avoid overzealous constant folding. 2007-12-09 20:56:08 +00:00
David Schultz
4e97f925b6 gcc 4 does some overzealous constant folding, and since it doesn't
support FENV_ACCESS, that was causing this test to fail. Use a volatile
to avoid the constant folding.
2007-12-09 20:16:48 +00:00
David Schultz
8b9f0f2a42 Make sure we set the locale to "C" when testing thousands' separator
support, rather than just "", which refers to the system default based
on the environment.
2007-12-03 17:48:55 +00:00
David Schultz
b40c4c7013 Tests for rounding, and for the leading 0's bug. 2007-12-03 07:18:47 +00:00
Bjoern A. Zeeb
4f744c0454 Convert errx(-1, ..., strerror(errno)) to err(-1, ...).
Discussed with: rwatson
2007-11-28 20:38:05 +00:00
Bjoern A. Zeeb
551944a21a Add support for tcpmd5 tests.
Add README.tcpmd5 to describe how to build a simple test setup
and run tests.

Convert compile time options to run time options [1].

Discussed with:	rwatson
Suggested by:	rwatson [1]
2007-11-28 20:33:58 +00:00
Bjoern A. Zeeb
f3d220fb9e Remove empty setup and cleanup functions for the pfkey test.
Add regression tests for privileged and supposedly unprivileged
IP_IPSEC_POLICY,IPV6_IPSEC_POLICY setsockopt cases.

We may need to review the current 'good' results to make
sure they reflect what we really want.

Discussed with:	rwatson
Reviewed by:	rwatson
2007-11-16 21:24:45 +00:00
Bjoern A. Zeeb
6007da5f92 In sys/netipsec/keysock.c rev. 1.19 a missing priv check was added.
Before that non-su users were able to open pfkey sockets as well.

Add a regression test so we can detect such problems in an automated way
in the future.
2007-11-13 08:59:29 +00:00
Pawel Jakub Dawidek
53c0785606 Hide geli warnings about sector size beeing bigger than the page size when
doing regression testing.
2007-10-26 08:31:11 +00:00
Stefan Farfeleder
aafd6a87a6 The exit status of a case statement where none of the patterns is matched
is supposed to be 0, not the status of the previous command.

Reported by:	Eygene Ryabinkin
PR:		116559
Approved by:	re (gnn)
2007-10-04 16:14:48 +00:00
Robert Watson
d903306a26 Enhance and expand kernel privilege regression tests in support of
work present in FreeBSD 7.0 to refine the kernel privilege model:

- Introduce support for jail as a testing variable, in order to
  confirm that privileges are properly restricted in the jail
  environment.

- Restructure overall testing approach so that privilege and jail
  conditions are set in the testing infrastructure before tests
  are invoked, and done so in a custom-created process to isolate
  the impact of tests from each other in a more consistent way.

- Tests now provide setup and cleanup hooks that occur before and
  after the test runs.

- New privilege tests are now present for several audit
  privileges, several credential management privileges, dmesg
  buffer reading privilege, and netinet raw socket creation.

- Other existing tests are restructured and generally improved as
  a result of better framework structure and jail as a variable.
  For exampe, we now test that certain sysctls are writable only
  outside jail, while others are writable within jail.  On a
  similar note, privileges relating to setting UFS file flags are
  now better exercised, as with the right to chmod and utimes
  files.

Approved by:	re (bmah)
Obtained from:	TrustedBSD Project
2007-09-09 23:08:39 +00:00
Pawel Jakub Dawidek
864cba9669 Add support for Camellia encryption algorithm.
PR:		kern/113790
Submitted by:	Yoshisato YANAGISAWA <yanagisawa@csg.is.titech.ac.jp>
Approved by:	re (bmah)
2007-09-01 06:33:02 +00:00
Xin LI
d73f7c1723 New regression test updates for rename, etc.
Obtained from:	NetBSD
Approved by:	re (tmpfs blanket)
2007-08-10 10:08:43 +00:00
Dag-Erling Smørgrav
2174a10b9e Add regression tests for flopen(3).
Approved by:	re (blanket)
2007-08-03 11:29:49 +00:00
Sean Farley
9bab236702 Added environ-replacement detection. For programs that "clean" (i.e., su)
or replace (i.e., zdump) the environment after a call to setenv(), putenv()
or unsetenv() has been made, a few changes were made.
  - getenv() will return the value from the new environ array.
  - setenv() was split into two functions:  __setenv() which is most of the
    previous setenv() without checks on the name and setenv() which
    contains the checks before calling __setenv().
  - setenv(), putenv() and unsetenv() will unset all previous values and
    call __setenv() on all entries in the new environ array which in turn
    adds them to the end of the envVars array.  Calling __setenv() instead
    of setenv() is done to avoid the temporary replacement of the '=' in a
    string with a NUL byte.  Some strings may be read-only data.

Added more regression checks for clearing the environment array.

Replaced gettimeofday() with getrusage() in timing regression check for
better accuracy.

Fixed an off-by-one bug in __remove_putenv() in the use of memmove().  This
went unnoticed due to the allocation of double the number of environ
entries when building envVars.

Fixed a few spelling mistakes in the comments.

Reviewed by:	ache
Approved by:	wes
Approved by:	re (kensmith)
2007-07-20 23:30:13 +00:00
Pawel Jakub Dawidek
2125ff0886 Make fstest work out-of-the-box on Solaris:
- Solaris' setgroups(2) doesn't change process' effective gid, so set it
  explicitly.
- POSIX doesn't define O_NOFOLLOW. FreeBSD returns EMLINK when target is
  a symbolic link, but Solaris returns ELOOP then.
- Solaris doesn't define O_SHLOCK and O_EXLOCK flags.

Approved by:	re (rwatson)
2007-07-18 18:07:15 +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
Sean Farley
2966d28c32 Significantly reduce the memory leak as noted in BUGS section for
setenv(3) by tracking the size of the memory allocated instead of using
strlen() on the current value.

Convert all calls to POSIX from historic BSD API:
 - unsetenv returns an int.
 - putenv takes a char * instead of const char *.
 - putenv no longer makes a copy of the input string.
 - errno is set appropriately for POSIX.  Exceptions involve bad environ
   variable and internal initialization code.  These both set errno to
   EFAULT.

Several patches to base utilities to handle the POSIX changes from
Andrey Chernov's previous commit.  A few I re-wrote to use setenv()
instead of putenv().

New regression module for tools/regression/environ to test these
functions.  It also can be used to test the performance.

Bump __FreeBSD_version to 700050 due to API change.

PR:		kern/99826
Approved by:	wes
Approved by:	re (kensmith)
2007-07-04 00:00:41 +00:00
Xin LI
544970d64e Fix a obsecure coredump while testing with tmpfs on amd64.
Approved by:	re (kensmith)
2007-06-26 13:51:53 +00:00
Xin LI
6e347527f4 id generation is now handled by uma(9) subsystem,
so remove the (now) irrevelent test case.

Requested by:	Howard Su
Approved by:	re (tmpfs blanket)
2007-06-25 18:47:09 +00:00
Michael Bushkov
e088274144 - Bugs in gethostbyXXX/getipnodebyXXX regression tests fixed.
Tests for getipnodebyXXX functions now cover most number of flags
  combinations.

Approved by: re (kensmith), brooks (mentor)
2007-06-24 06:14:18 +00:00
Xin LI
f8c94cec4b MFp4: Add regression tests for tmpfs.
Obtained from:	NetBSD via p4
Submitted by:	Howard Su
2007-06-16 02:04:44 +00:00
Hartmut Brandt
3c9b26f049 Make the order of tests the same for user and kernel. Use the natural
layer order from bottom to top.
2007-06-14 20:11:48 +00:00
Bruce M Simpson
b13321fc4e Add regression test for SSM code. 2007-06-12 16:29:22 +00:00
Bruce M Simpson
71498f308b Import rewrite of IPv4 socket multicast layer to support source-specific
and protocol-independent host mode multicast. The code is written to
accomodate IPv6, IGMPv3 and MLDv2 with only a little additional work.

This change only pertains to FreeBSD's use as a multicast end-station and
does not concern multicast routing; for an IGMPv3/MLDv2 router
implementation, consider the XORP project.

The work is based on Wilbert de Graaf's IGMPv3 code drop for FreeBSD 4.6,
which is available at: http://www.kloosterhof.com/wilbert/igmpv3.html

Summary
 * IPv4 multicast socket processing is now moved out of ip_output.c
   into a new module, in_mcast.c.
 * The in_mcast.c module implements the IPv4 legacy any-source API in
   terms of the protocol-independent source-specific API.
 * Source filters are lazy allocated as the common case does not use them.
   They are part of per inpcb state and are covered by the inpcb lock.
 * struct ip_mreqn is now supported to allow applications to specify
   multicast joins by interface index in the legacy IPv4 any-source API.
 * In UDP, an incoming multicast datagram only requires that the source
   port matches the 4-tuple if the socket was already bound by source port.
   An unbound socket SHOULD be able to receive multicasts sent from an
   ephemeral source port.
 * The UDP socket multicast filter mode defaults to exclusive, that is,
   sources present in the per-socket list will be blocked from delivery.
 * The RFC 3678 userland functions have been added to libc: setsourcefilter,
   getsourcefilter, setipv4sourcefilter, getipv4sourcefilter.
 * Definitions for IGMPv3 are merged but not yet used.
 * struct sockaddr_storage is now referenced from <netinet/in.h>. It
   is therefore defined there if not already declared in the same way
   as for the C99 types.
 * The RFC 1724 hack (specify 0.0.0.0/8 addresses to IP_MULTICAST_IF
   which are then interpreted as interface indexes) is now deprecated.
 * A patch for the Rhyolite.com routed in the FreeBSD base system
   is available in the -net archives. This only affects individuals
   running RIPv1 or RIPv2 via point-to-point and/or unnumbered interfaces.
 * Make IPv6 detach path similar to IPv4's in code flow; functionally same.
 * Bump __FreeBSD_version to 700048; see UPDATING.

This work was financially supported by another FreeBSD committer.

Obtained from:  p4://bms_netdev
Submitted by:   Wilbert de Graaf (original work)
Reviewed by:    rwatson (locking), silence from fenner,
		net@ (but with encouragement)
2007-06-12 16:24:56 +00:00