Commit Graph

2456 Commits

Author SHA1 Message Date
Adrian Chadd
9a086c6988 This is a full 32 bit field for kite. 2011-05-09 10:39:15 +00:00
Jilles Tjoelker
07eb7033a6 sh: Add \u/\U support (in $'...') for UTF-8.
Because we have no iconv in base, support for other charsets is not
possible.

Note that \u/\U are processed using the locale that was active when the
shell started. This is necessary to avoid behaviour that depends on the
parse/execute split (for example when placing braces around an entire
script). Therefore, UTF-8 encoding is implemented manually.
2011-05-08 17:40:10 +00:00
Jilles Tjoelker
7cc6b3df80 sh: Add UTF-8 support to pattern matching.
?, [...] patterns match codepoints instead of bytes. They do not match
invalid sequences. [...] patterns must not contain invalid sequences
otherwise they will not match anything. This is so that ${var#?} removes the
first codepoint, not the first byte, without putting UTF-8 knowledge into
the ${var#pattern} code. However, * continues to match any string and an
invalid sequence matches an identical invalid sequence. (This differs from
fnmatch(3).)
2011-05-08 11:32:20 +00:00
Jilles Tjoelker
4c244ed255 sh: Add UTF-8 support to ${#var}.
If the current locale uses UTF-8, ${#var} counts codepoints (more precisely,
bytes b with (b & 0xc0) != 0x80).
2011-05-07 14:32:16 +00:00
Ruslan Ermilov
751f92ecc8 MK_GPIO changed its default; reflect. 2011-05-06 19:14:06 +00:00
Ruslan Ermilov
a7a066b13f Removed trailing whitespace. 2011-05-06 19:13:03 +00:00
Ruslan Ermilov
64a9cf7693 Tidy up formatting. 2011-05-06 19:10:27 +00:00
Jilles Tjoelker
a62ab0274a sh: Add $'quoting' (C-style escape sequences).
A string between $' and ' may contain backslash escape sequences similar to
the ones in a C string constant (except that a single-quote must be escaped
and a double-quote need not be). Details are in the sh(1) man page.

This construct is useful to include unprintable characters, tabs and
newlines in strings; while this can be done with a command substitution
containing a printf command, that needs ugly workarounds if the result is to
end with a newline as command substitution removes all trailing newlines.

The construct may also be useful in future to describe unprintable
characters without needing to write those characters themselves in 'set -x',
'export -p' and the like.

The implementation attempts to comply to the proposal for the next issue of
the POSIX specification. Because this construct is not in POSIX.1-2008,
using it in scripts intended to be portable is unwise.

Matching the minimal locale support in the rest of sh, the \u and \U
sequences are currently not useful.

Exp-run done by: pav (with some other sh(1) changes)
2011-05-05 20:55:55 +00:00
Jilles Tjoelker
3937fc9c26 sh: Apply set -u to variables in arithmetic.
Note that this only applies to variables that are actually used.
Things like (0 && unsetvar) do not cause an error.

Exp-run done by: pav (with some other sh(1) changes)
2011-05-04 22:12:22 +00:00
Jilles Tjoelker
fc0818fef3 sh: Detect an error for ${#var<GARBAGE>}.
In particular, this makes things like ${#foo[0]} and ${#foo[@]} errors
rather than silent equivalents of ${#foo}.

PR:		bin/151720
Submitted by:	Mark Johnston
Exp-run done by: pav (with some other sh(1) changes)
2011-05-04 21:49:34 +00:00
Jonathan Anderson
ceb42a13a1 Regression tests for Capsicum capability mode.
Ensure that system calls that access global namespaces, e.g. open(2), are not permitted, and that whitelisted sysctls like kern.osreldate are.

Approved by: rwatson
Sponsored by: Google, Inc.
2011-05-04 12:44:46 +00:00
George V. Neville-Neil
c3b14674a7 Give some sort of message when the program is not run as root.
Root privileges are required to talk to the device.

Submitted by:	Sriram Rapuru at Wipro for Exar Inc.
MFC after:	2 weeks
2011-05-03 16:00:36 +00:00
Dimitry Andric
6b943ff3a3 Vendor import of llvm trunk r130700:
http://llvm.org/svn/llvm-project/llvm/trunk@130700
2011-05-02 19:34:44 +00:00
Bjoern A. Zeeb
970a765389 Introduce two new options MK_INET and MK_INET_SUPPORT analogically
with INET6 equivalents. Patch reather than re-genenerating src.conf
(given the current problem with the script that does the re-gen).

Reviewed by:	gnn
Sponsored by:	The FreeBSD Foundation
Sponsored by:	iXsystems
MFC after:	2 weeks
2011-04-30 17:58:28 +00:00
George V. Neville-Neil
3c31540d7c A diagnostic tool to go along with the vxge(4) 10GbE driver.
This tool can be used to print statistics, registers, and
other device specific information once the driver is loaded
into the kernel.

Submitted by:	Sriram Rapuru from Exar
MFC after:	2 weeks
2011-04-28 16:29:19 +00:00
Dag-Erling Smørgrav
158e440d2b executable 2011-04-28 11:21:49 +00:00
Jilles Tjoelker
03b3a844d0 sh: Set $? to 0 for background commands.
For backgrounded pipelines and subshells, the previous value of $? was being
preserved, which is incorrect.

For backgrounded simple commands containing a command substitution, the
status of the last command substitution was returned instead of 0.

If fork() fails, this is an error.
2011-04-25 20:54:12 +00:00
Jilles Tjoelker
45496405c6 sh: Allow EV_EXIT through function calls, make {...} <redir more consistent.
If EV_EXIT causes an exit, use the exception mechanism to unwind
redirections and local variables. This way, if the final command is a
redirected command, an EXIT trap now executes without the redirections.

Because of these changes, EV_EXIT can now be inherited by the body of a
function, so do so. This means that a function no longer prevents a fork
before an exec being skipped, such as in
  f() { head -1 /etc/passwd; }; echo $(f)

Wrapping a single builtin in a function may still cause an otherwise
unnecessary fork with command substitution, however.

An exit command or -e failure still invokes the EXIT trap with the
original redirections and local variables in place.

Note: this depends on SHELLPROC being gone. A SHELLPROC depended on
keeping the redirections and local variables and only cleaning up the
state to restore them.
2011-04-23 22:28:56 +00:00
Simon L. B. Nielsen
d95c6beaac Expand / correct newsyslog regression tests:
- Test newslog with clasic naming of rotates files to actually test
  the correct number of log files as newsyslog now does the correct
  thing post r220926.
- Add some more newsyslog tests which tests keeping 0, 1, and 2
  logfiles.
2011-04-21 16:40:34 +00:00
Jilles Tjoelker
caa7ccdc54 sh: Do not word split "${#parameter}".
This is only a problem if IFS contains digits, which is unusual but valid.

Because of an incorrect fix for PR bin/12137, "${#parameter}" was treated
as ${#parameter}. The underlying problem was that "${#parameter}"
erroneously added CTLESC bytes before determining the length. This
was properly fixed for PR bin/56147 but the incorrect fix was not backed
out.

Reported by:	Seeker on forums.freebsd.org
MFC after:	2 weeks
2011-04-20 22:24:54 +00:00
Jilles Tjoelker
1e5dccaa9b sh: Add test for bin/12137. 2011-04-15 15:33:24 +00:00
Jilles Tjoelker
9638724dc8 sh: Add test for obscure and ambiguous ${#?}. 2011-04-15 15:26:05 +00:00
Jilles Tjoelker
149cf1e03b sh: Add test for bin/56147. 2011-04-15 15:14:58 +00:00
Adrian Chadd
6b3664c018 Generate opt_ah.h now for all ath tools, a recent HAL change of mine
now requires it.
2011-04-11 06:53:45 +00:00
Ulrich Spörlein
cebea500a0 Regenerate after r220401. It turns out makeman is clever about implied
flags, so remove that part from WITHOUT_CXX again.

This is only partially regenerated, as the entries for FDT and GPIO seem to
have switched their default state, too.
2011-04-06 20:19:07 +00:00
Ulrich Spörlein
b3eb927f6e Complete WITHOUT_CXX support. It implies WITHOUT_GROFF and
WITHOUT_CLANG.

Don't build clang bootstrap/build-tools depending on this flag. We also
keep gperf, devd and libstdc++ around to prevent foot-shooting and to
make this a two-way street.
2011-04-06 20:08:23 +00:00
Jilles Tjoelker
2973057493 Allow strerror(0) and strerror_r(0, ...).
Of course, strerror_r() may still fail with ERANGE.

Although the POSIX specification said this could fail with EINVAL and
doing this likely indicates invalid use of errno, most other
implementations permitted it, various POSIX testsuites require it to
work (matching the older sys_errlist array) and apparently some
applications depend on it.

PR:		standards/151316
MFC after:	1 week
2011-04-05 21:56:05 +00:00
Adrian Chadd
179d23212e * re-enable marker stuff, I accidentally disabled it during debugging
* correct arg check
2011-04-05 16:12:38 +00:00
Adrian Chadd
0a74f776db Flesh out a simple tool to print the ALQ dump generated by the HAL. 2011-04-05 15:11:09 +00:00
Michael Reifenberger
9d47a91b22 Use ${NANO_WORLDDIR}/var/empty as copy source since it has no schg flag set.
Copying over /var/empty's schg flag had unpleasant side effects (schg flag on /etc and /cfg)
during nanobsd boot before.
2011-03-28 07:00:41 +00:00
Adrian Chadd
7ee26a530a Oops, fix badness i must've introduced earlier. 2011-03-23 11:16:06 +00:00
Edward Tomasz Napierala
a8e852babc Add test for acl_is_trivial_np(3). 2011-03-22 17:26:56 +00:00
Michael Reifenberger
0380bf4d79 Delete all GPT partitions at once. (Suggested by Andrey V. Elsukov <bu7cher@yandex.ru>)
Fix amd64 merge script.
2011-03-21 13:23:25 +00:00
Michael Reifenberger
e1c9ab494d Add a file with some remarks for setting up a zfs boot environment 2011-03-20 13:01:57 +00:00
Michael Reifenberger
24f0cf3b18 - Add script for preparing disks in GPT/ZFS boot environment
- Add merge script for integrating amd64 slice into i386 disk image
2011-03-20 12:40:17 +00:00
Michael Reifenberger
8ad865445e - Build disk image (for USB sticks) and iso image
- Change name to reflect this
- Install all kernel modules
- Choose image size that i386 and amd64 can be combined into one image
- Mount tmpfs over /boot/zfs for zpool imports
2011-03-18 22:56:53 +00:00
Jilles Tjoelker
35c641ed21 sh: Fix some parameter expansion variants ${#...}.
These already worked: $# ${#} ${##} ${#-} ${#?}
These now work as well: ${#+word} ${#-word} ${##word} ${#%word}

There is an ambiguity in the standard with ${#?}: it could be the length of
$? or it could be $# giving an error in the (impossible) case that it is not
set. We continue to use the former interpretation as it seems more useful.
2011-03-13 20:02:39 +00:00
Pawel Jakub Dawidek
fb7db28c25 POSIX accepts only ELOOP if O_NOFOLLOW is specified and target is a symlink. 2011-03-13 19:35:13 +00:00
Jilles Tjoelker
18584d14e3 sh: Add some tests for ${#parameter}. 2011-03-13 16:20:38 +00:00
Rebecca Cran
d7d3cbdadf Fix warnings and style(9) issues.
Set WARNS to 6.
2011-03-12 14:47:54 +00:00
Pawel Jakub Dawidek
87c7a11664 Add some missing consts. 2011-03-12 14:09:43 +00:00
Rebecca Cran
71c8cbe3ef Fix warnings and style(9) issues.
Set WARNS to 6.
2011-03-11 19:32:15 +00:00
Rebecca Cran
ac34e5511b Fix the build: we have snprintf(3).
MFC after:	1 week
2011-03-11 19:19:47 +00:00
Rebecca Cran
e6bcbac1f7 Fix warnings and set WARNS to 6.
MFC after:	1 week
2011-03-11 18:51:42 +00:00
Rebecca Cran
59d06d2fb0 Fix warnings and set WARNS to 6.
MFC after:	1 week
2011-03-11 18:48:28 +00:00
Rebecca Cran
a797c79b34 mptable.h is now in include/x86. 2011-03-11 18:44:16 +00:00
Rebecca Cran
01ded8b942 Fix warnings and style(9) issues.
Set WARNS to 6.

MFC after:	1 week
2011-03-11 17:33:31 +00:00
Pawel Jakub Dawidek
7ab5d09839 Add support for *at syscalls:
- openat(2)
- unlinkat(2)
- mkdirat(2)
- linkat(2)
- symlinkat(2)
- renameat(2)
- mkfifoat(2)
- mknodat(2)
- fchmodat(2)
- fchownat(2)
- fstatat(2)
2011-03-10 21:00:30 +00:00
Pawel Jakub Dawidek
97b700501b Improve test a bit, now that we have fstat(2) support.
The test was support to check if SUID/SGID bits are removed on first
write, but actually we were checking if they were removed after close.
Now we can check if SUID/SGID bits are gone after first write.

While here add checks to see if when both SUID and SGID bits are set they are
both cleared on first write.
2011-03-10 20:59:02 +00:00
Pawel Jakub Dawidek
7a0452188b Few initial ftruncate(2) tests. One of them covers stand/154873.
PR:	stand/154873
2011-03-09 23:11:30 +00:00
Pawel Jakub Dawidek
7535f6533c Pass descriptor number to write(2), now that it is possible. 2011-03-09 22:50:15 +00:00
Pawel Jakub Dawidek
446727a7a4 Add support for the following syscalls:
- fchmod(2),
- fchown(2),
- fchflags(2),
- fstat(2),
- ftruncate(2),
- fpathconf(2),
- lpathconf(2).
Make write(2) syscall to take descriptor instead of file name.

We implement descriptors by keeping track of open files and allowing to
reference them by the following syscalls. Because pjdfstest already supports
executing multiple syscalls from one command it works pretty well.

For example, the following command:

	pjdfstest open foo "O_CREAT,O_RDWR" 0 : open bar "O_CREAT,O_RDONLY" 640 : fchmod 0 0666 : fchown 0 -1 20 : fchmod 1 0444

is equivalent of (error checking omitted):

	int fd[2];

	fd[0] = open("foo", O_CREAT | O_RDWR, 0);
	fd[1] = open("bar", O_CREAT | O_RDONLY, 0640);
	fchmod(fd[0], 0666);
	fchown(fd[0], -1, 20);
	fchmod(fd[1], 0444);
2011-03-09 22:39:10 +00:00
Adrian Chadd
d445d5407a The regdomain entries are 16 bits, not 8. Print out all 16 bits. 2011-03-09 04:48:06 +00:00
Adrian Chadd
87cd3ddacc Update to keep in sync with the HAL 2011-03-08 12:08:23 +00:00
Jilles Tjoelker
7b8b6c9c46 sh: Test that . /dev/null returns exit status 0 and does not preserve $?.
Preserving $? may cause problems particularly if set -e is in effect.

It may be useful to preserve the old value of $? in the dot script but this
must not be implemented in such a way that it would break this test.
2011-03-07 23:52:23 +00:00
David Schultz
2dc9da4376 Add some tests for cexp() and cexpf(). (I need to clean up all of
these tests some day, but in the mean time, they're a useful sanity
check for future changes.)
2011-03-07 03:15:49 +00:00
Adrian Chadd
799caf55bb Add support for printing out the open-loop TX power control EEPROM fields. 2011-03-06 23:15:24 +00:00
Edward Tomasz Napierala
62089c2843 One more fix. Now all ACL tests pass again. 2011-03-04 18:46:19 +00:00
Edward Tomasz Napierala
aa25dc0272 Adapt tools-crossfs.test to the new semantics. 2011-03-04 18:37:26 +00:00
Edward Tomasz Napierala
6b2094d83c Adapt NFSv4 ACL regression test to the fact that the new ZFS uses
new semantics.
2011-03-04 17:10:39 +00:00
Edward Tomasz Napierala
b5b5b80711 Make ACL tests slightly easier to run. 2011-03-04 17:07:02 +00:00
Xin LI
eaea8924ce Accept == as an alias of = which is a popular GNU extension.
This is intentionally undocumented for now since it's not part
of any standard.

MFC after:	1 month
2011-02-27 12:28:06 +00:00
Dimitry Andric
d0e4e96dc1 Vendor import of llvm trunk r126547:
http://llvm.org/svn/llvm-project/llvm/trunk@126547
2011-02-26 22:03:50 +00:00
Gabor Kovesdan
bcf205e1ee - Add two more iconv-related files, which were left out from previous commit
Approved by:	delphij (mentor)
2011-02-25 00:10:26 +00:00
Gabor Kovesdan
ad30f8e79b Add the BSD-licensed Citrus iconv to the base system with default off
setting. It can be built by setting the WITH_ICONV knob. While this
knob is unset, the library part, the binaries, the header file and
the metadata files will not be built or installed so it makes no impact
on the system if left turned off.

This work is based on the iconv implementation in NetBSD but a great
number of improvements and feature additions have been included:

- Some utilities have been added. There is a conversion table generator,
  which can compare conversion tables to reference data generated by
  GNU libiconv. This helps ensuring conversion compatibility.
- UTF-16 surrogate support and some endianness issues have been fixed.
- The rather chaotic Makefiles to build metadata have been refactored
  and cleaned up, now it is easy to read and it is also easier to add
  support for new encodings.
- A bunch of new encodings and encoding aliases have been added.
- Support for 1->2, 1->3 and 1->4 mappings, which is needed for
  transliterating with flying accents as GNU does, like "u.
- Lots of warnings have been fixed, the major part of the code is
  now WARNS=6 clean.
- New section 1 and section 5 manual pages have been added.
- Some GNU-specific calls have been implemented:
  iconvlist(), iconvctl(), iconv_canonicalize(), iconv_open_into()
- Support for GNU's //IGNORE suffix has been added.
- The "-" argument for stdin is now recognized in iconv(1) as per POSIX.
- The Big5 conversion module has been fixed.
- The iconv.h header files is supposed to be compatible with the
  GNU version, i.e. sources should build with base iconv.h and
  GNU libiconv. It also includes a macro magic to deal with the
  char ** and const char ** incompatibility.
- GNU compatibility: "" or "char" means the current local
  encoding in use
- Various cleanups and style(9) fixes.

Approved by:	delphij (mentor)
Obtained from:	The NetBSD Project
Sponsored by:	Google Summer of Code 2009
2011-02-25 00:04:39 +00:00
Ulrich Spörlein
705669adda The default for FDT has changed, rename the flag/options file. 2011-02-22 08:20:12 +00:00
Ulrich Spörlein
423102c6fa Flesh out WITHOUT_GROFF support to DTRT.
A full featured groff is required during buildworld, so build it always
and don't rely on it being present on the host system.

vgrind(1) is tightly coupled to a roff processor and will not be
built/installed when groff is disabled. Also much of the roff'ed
documentation under share/doc will not be built/installed when
WITHOUT_GROFF is defined.

Reviewed by:	ru (partial)
2011-02-22 08:13:49 +00:00
Ulrich Spörlein
3dfe8ce942 Teach tools/install.sh the -d directory mode.
Sync up with flags understood by install(1) [1], and make install(1)'s
usage output not hide the clearly documented -M flag.

PR:		misc/154739 [1]
Submitted by:	arundel
2011-02-22 08:07:17 +00:00
Martin Wilke
dd41c1d72e - Fix QA issues
PR:		misc/146687
Submitted by:	Garrett Cooper <gcooper@FreeBSD.org>
Approved by:	rwatson (mentor)
2011-02-22 05:13:26 +00:00
Jilles Tjoelker
553870e83b sh: Add some tests for omitting whitespace whereever possible. 2011-02-20 17:28:58 +00:00
Jilles Tjoelker
a9942298fe sh: Split off some special behaviour into separate tests.
This allows some other shells to pass the tests for basic behaviour.
2011-02-20 14:18:58 +00:00
Dimitry Andric
cf099d1121 Vendor import of llvm trunk r126079:
http://llvm.org/svn/llvm-project/llvm/trunk@126079
2011-02-20 12:57:14 +00:00
Jilles Tjoelker
9d59796db7 sh: Do not use "local" in the test runner as POSIX and ksh93 do not have it. 2011-02-19 13:23:13 +00:00
Jilles Tjoelker
3d9394a391 sh: Make execution/fork1.0 work even if the basename of ${SH} is not "sh". 2011-02-19 13:22:18 +00:00
Jilles Tjoelker
e8d17ee524 sh: Test that the read builtin passes through all byte values
except NUL, newline and backslash.

This also passes on stable/8.
2011-02-18 20:51:13 +00:00
Jilles Tjoelker
cfd69ae791 sh: Unset some more locale vars in two tests that may cause them to break. 2011-02-18 20:37:09 +00:00
Xin LI
f6ac113d5e Add a helper script that detects which partition we are on and update the
other.

MFC after:	1 month
Obtained from:	FreeNAS
Sponsored by:	iXsystems, Inc.
2011-02-18 19:07:16 +00:00
Poul-Henning Kamp
8c8d5abcb3 Improve the check for ports which have gone missing, and just ignore
them.  We want a run to perform as much work as possible before it
gives up.
2011-02-17 08:54:22 +00:00
Adrian Chadd
ba277b0892 * add in new EEPROM fields from later revisions
* add in printing futureBase
2011-02-13 13:11:00 +00:00
Jilles Tjoelker
e9749129ad sh: Detect dividing the smallest integer by -1.
This overflows and on some architectures such as amd64 it generates SIGFPE.
Generate an error on all architectures.
2011-02-12 23:44:05 +00:00
Warner Losh
ed34bfa8f1 Add 'generic' flash images. This is for projects producing generic
images that are of a certain size.  The geometery is bogus, but that
doesn't matter since the new packet mode onviates the need to get the
geometry right.
2011-02-10 23:36:39 +00:00
Jilles Tjoelker
f01be3fe53 sh: Add tests for new features in arithmetic. 2011-02-08 23:23:55 +00:00
Jilles Tjoelker
e029e397f3 sh: Weaken some tests to allow /rescue/sh to pass everything.
/rescue/sh has a different _PATH_STDPATH which affects command -p.
2011-02-05 23:00:24 +00:00
Jilles Tjoelker
b15e9aa322 sh: Fix two things about {(...)} <redir:
* In {(...) <redir1;} <redir2, do not drop redir1.
* Maintain the difference between (...) <redir and {(...)} <redir:
  In (...) <redir, the redirection is performed in the child, while in
  {(...)} <redir it should be performed in the parent (like {(...); :;}
  <redir)
2011-02-05 15:02:19 +00:00
Jilles Tjoelker
ef0cb80dd4 sh: Forget all cached command locations on any PATH change.
POSIX requires this and it is simpler than the previous code that remembered
command locations when appending directories to PATH.

In particular,
  PATH=$PATH
is no longer a no-op but discards all cached command locations.
2011-02-05 14:01:46 +00:00
Jilles Tjoelker
604e8224f8 sh: Do not try to execute binary files as scripts.
If execve() returns an [ENOEXEC] error, check if the file is binary before
trying to execute it using sh. A file is considered binary if at least one
of the first 256 bytes is '\0'.

In particular, trying to execute ELF binaries for the wrong architecture now
fails with an "Exec format error" message instead of syntax errors and
potentially strange results.
2011-02-05 12:54:59 +00:00
Jilles Tjoelker
0df2165c11 sh: Add test for shell script without '#!'. 2011-02-02 22:03:18 +00:00
Jilles Tjoelker
b9f696953d sh: Send messages about signals to stderr.
This is required by POSIX and seems to make more sense.

See also r217557.
2011-01-30 22:57:52 +00:00
Adrian Chadd
b2691d144a Keep this in sync with the ar5212 power rate table size.
This doesn't yet know about the 802.11n radios or rates.
2011-01-29 04:34:30 +00:00
Jilles Tjoelker
8c3afde82c sh: Add test for EXIT trap in command substitution.
This is not really realistic but is an opposition to $(trap).
2011-01-27 23:08:20 +00:00
Adrian Chadd
65824341e7 Fix this tool to use the updated (corrected) v4k eeprom definition introduced in a previous commit. 2011-01-25 05:35:43 +00:00
Adrian Chadd
a9c52f70eb Add a simple tool to print the contents of a v4k EEPROM dump. 2011-01-24 06:46:03 +00:00
Adrian Chadd
24edeee241 Add a new tool which takes a text hexdump of the current EEPROM contents. 2011-01-22 23:44:56 +00:00
Adrian Chadd
8363d9c421 Patch the athstats code/Makefile to cross-compile correctly. 2011-01-22 23:37:42 +00:00
Adrian Chadd
eefbdb2a6e Add in a new tool which prints a formatted v14 eeprom from an eeprom
hexdump.

This is a part replacement of the old athprom code, which tries
to both fetch and print the contents of an eeprom dump.

A tool to generate hexdumps from a running system will follow shortly.
2011-01-21 03:14:08 +00:00
Adrian Chadd
3a85395536 Remove an un-needed trailing / after OBJDIR.
Nitpicked by: juli
2011-01-21 02:56:59 +00:00
Adrian Chadd
1045db19f5 Make the existing ath tools build again.
* add missing includes to quieten warnings
* fix an inline function decl to have a return type
* since .h files are created during the build (opt_ah.h, ah_osdep.h)
  which modify the behaviour of the HAL include/source files,
  include OBJDIR in the path so the #include's work.

The tools should now build when the directory is added to LOCAL_DIRS
during a make buildworld.
2011-01-21 02:53:32 +00:00
Poul-Henning Kamp
cb2e9eede4 Make sure the PKGDIR exists before we move stuff into it. 2011-01-18 21:36:51 +00:00
Jilles Tjoelker
0d5ccb45d8 sh: Fix signal messages being sent to the wrong file sometimes.
When a foreground job exits on a signal, a message is printed to stdout
about this. The buffer was not flushed after this which could result in the
message being written to the wrong file if the next command was a builtin
and had stdout redirected.

Example:
  sh -c 'kill -9 $$'; : > foo; echo FOO:; cat foo

Reported by:	gcooper
MFC after:	1 week
2011-01-18 21:18:31 +00:00
Jilles Tjoelker
ebdfd6dc4d sh: If exit is used without args from a trap action, exit on the signal.
This is useful so that it is easier to exit on a signal than to reset the
trap to default and resend the signal. It matches ksh93. POSIX says that
'exit' without args from a trap action uses the exit status from the last
command before the trap, which is different from 'exit $?' and matches this
if the previous command is assumed to have exited on the signal.

If the signal is SIGSTOP, SIGTSTP, SIGTTIN or SIGTTOU, or if the default
action for the signal is to ignore it, a normal _exit(2) is done with exit
status 128+signal_number.
2011-01-16 13:56:41 +00:00
Jilles Tjoelker
a043cc4c68 sh: Fix some things about -- in trap:
* Make 'trap --' do the same as 'trap' instead of nothing.
* Make '--' stop option processing (note that '-' action is not an option).

Side effect: The error message for an unknown option is different.
2011-01-15 21:09:00 +00:00
Giorgos Keramidas
50ffd2d643 regression/date: unset all LC_xxx vars and set LANG/LC_ALL
When running with a custom locale setup, it's easy to confuse the
date regression tests and cause them to fail, e.g. when LANG='C'
but LC_ALL='el_GR.UTF-8'.  Set LC_ALL to 'C', which overrides all
other LC_xxx options, to avoid this sort of problem.

Reviewed by:	uqs, edwin
2011-01-09 22:05:09 +00:00
Jilles Tjoelker
4b45b49a70 sh: Remove special %builtin PATH entry.
All builtins are now always found before a PATH search.

Most ash derivatives have an undocumented feature where the presence of an
entry "%builtin" in $PATH will cause builtins to be checked at that point of
the PATH search, rather than before looking at any directories as documented
in the man page (very old versions do document this feature).

I am removing this feature from sh, as it complicates the code, may violate
expectations (for example, /usr/bin/alias is very close to a forkbomb with
PATH=/usr/bin:%builtin, only /usr/bin/builtin not being another link saves
it) and appears to be unused (all the %builtin google code search finds is
in some sort of ash source code).

Note that aliases and functions took and take precedence above builtins.
Because aliases work on a lexical level they can only ever be overridden on
a lexical level (quoting or preceding 'builtin' or 'command'). Allowing
override of functions via PATH does not really fit in the model of sh and it
would work differently from %builtin if implemented.

Note: POSIX says special builtins are found before functions. We comply to
this because we do not allow functions with the same name as a special
builtin.

Silence from:	freebsd-hackers@ (message sent 20101225)
Discussed with:	dougb
2011-01-09 21:07:30 +00:00
Jilles Tjoelker
70df11eaad sh: Make exit without parameters from EXIT trap POSIX-compliant.
It should use the original exit status, just like falling off the
end of the trap handler.

Outside an EXIT trap, 'exit' is still equivalent to 'exit $?'.
2011-01-08 23:08:13 +00:00
Jilles Tjoelker
02edd492b4 sh: Add simple test for 'exit' without parameters. 2011-01-08 23:00:38 +00:00
Jilles Tjoelker
e916b99243 sed: Add test for r217133 (-i race).
PR:		bin/153261
MFC after:	2 weeks
2011-01-08 00:06:22 +00:00
Giorgos Keramidas
574fe75809 tests: sort & fix includes, remove -include from CFLAGS of acct tests
- Sort the includes of pack.c, moving sys/*.h files near the top.
- Add a couple of missing #include lines, and remove the need for
  custom -include options in the CFLAGS of the test Makefile.
- Remove the ad-hoc 'all' target, but keep its 'regress' bits for
  testing.
- Convert the ad-hoc 'clean' target to proper CLEANFILES stuff,
  so that the normal bsd.prog.mk machinery can clean up.
- Use `make -V .OBJDIR' to detect the place where 'pack' lives,
  so that regress.t works both with and without 'make obj'.

Reviewed by:	uqs
MFC after:	1 week
2011-01-06 20:05:24 +00:00
Jilles Tjoelker
e23a66ac83 sh: Do not call exitshell() from evalcommand() unless evalcommand() forked
itself.

This ensures that certain traps caused by builtins are executed.
2011-01-05 23:17:29 +00:00
Warner Losh
72e8d583cd Update gateworks exclusion list to match latest tree. 2011-01-03 20:32:08 +00:00
Warner Losh
3664e10e59 Bump the media size from approx 600MB to approx 750MB. The great
hob-nailed tennis shoe of progress demands it!

Submitted by:	phk
2011-01-03 19:32:54 +00:00
Warner Losh
1e430919eb Put in the other half of the SRCCONF patch.
Submitted by:	phk
2011-01-03 19:30:47 +00:00
Jilles Tjoelker
be25acf4a5 sh: Test that exit $? replaces the original exit status in an EXIT trap. 2011-01-01 15:25:15 +00:00
Jilles Tjoelker
850460c0f1 sh: Check readonly status for assignments on regular builtins.
An error message is written, the builtin is not executed, nonzero exit
status is returned but the shell does not abort.

This was already checked for special builtins and external commands, with
the same consequences except that the shell aborts for special builtins.

Obtained from:	NetBSD
2011-01-01 13:26:18 +00:00
Jilles Tjoelker
09683f46b9 sh: Check if dup2 for redirection from/to a file succeeds.
A failure (e.g. caused by ulimit -n being set very low) is a redirection
error.

Example:
  ulimit -n 9; exec 9<.
2010-12-31 18:20:17 +00:00
Jilles Tjoelker
11535bdf04 sh: Avoid side effects from builtins in optimized command substitution.
Change the criterion for builtins to be safe to execute in the same process
in optimized command substitution from a blacklist of only cd, . and eval to
a whitelist.

This avoids clobbering the main shell environment such as by $(exit 4) and
$(set -x).

The builtins jobid, jobs, times and trap can still show information not
available in a child process; this is deliberately permitted. (Changing
traps is not.)

For some builtins, whether they are safe depends on the arguments passed to
them. Some of these are always considered unsafe to keep things simple; this
only harms efficiency a little in the rare case they are used alone in a
command substitution.
2010-12-30 22:33:55 +00:00
Jilles Tjoelker
b0aecb3d03 sh: Add two tests for special cases in command substitution that already
work in stable/8.
2010-12-30 15:04:59 +00:00
Jilles Tjoelker
acd7984f96 sh: Don't do optimized command substitution if expansions have side effects.
Before considering to execute a command substitution in the same process,
check if any of the expansions may have a side effect; if so, execute it in
a new process just like happens if it is not a single simple command.

Although the check happens at run time, it is a static check that does not
depend on current state. It is triggered by:
- expanding $! (which may cause the job to be remembered)
- ${var=value} default value assignment
- assignment operators in arithmetic
- parameter substitutions in arithmetic except ${#param}, $$, $# and $?
- command substitutions in arithmetic

This means that $((v+1)) does not prevent optimized command substitution,
whereas $(($v+1)) does, because $v might expand to something containing
assignment operators.

Scripts should not depend on these exact details for correctness. It is also
imaginable to have the shell fork if and when a side effect is encountered
or to create a new temporary namespace for variables.

Due to the $! change, the construct $(jobs $!) no longer works. The value of
$! should be stored in a variable outside command substitution first.
2010-12-28 21:27:08 +00:00
Jilles Tjoelker
f3c2011efb sh: Add test for optimized command substitution.
This test verifies that certain expansions without side effects do not
cause the command substitution to be executed in a child process.

This is not a correctness requirement, but it involves a nontrivial amount
of code and it would be unfortunate if it stopped working.
2010-12-28 14:58:08 +00:00
Jilles Tjoelker
45b71cd16e sh: Make expansion errors in optimized command substitution non-fatal.
Command substitutions consisting of a single simple command are executed in
the main shell process but this should be invisible apart from performance
and very few exceptions such as $(trap).
2010-12-28 13:28:24 +00:00
Jilles Tjoelker
a355eb9e1a sh: Add a testcase for cmdsubst errors that already works properly.
If a command substitution consists of one special builtin and there is a
redirection error, this should not abort the outer shell.
It was fixed in r201366 by ignoring special builtin properties for command
substitutions consisting of one builtin.
2010-12-27 23:56:03 +00:00
Ed Maste
f8e809686a Restore two commented-out tests from plus-minus1.0 to a new file.
These two cases pass on -CURRENT but fail on stable/8.

Reviewed by:	jilles
2010-12-27 15:57:41 +00:00
Ed Maste
65db095da0 Remove commented-out test that's covered in plus-minus2.0 anyway.
Discussed with: jilles
2010-12-26 23:19:16 +00:00
Jilles Tjoelker
6a6760db7f sh: Make warnings in the printf builtin non-fatal, like in the program.
The #define for warnx now behaves much like the libc function (except that
it uses sh command name and output).

Also, it now uses C99 __VA_ARGS__ so there is no need for three different
macros for 0, 1 or 2 parameters.
2010-12-20 23:06:57 +00:00
Jilles Tjoelker
79357531c8 sh: arith: Disallow decimal constants starting with 0 (containing 8 or 9).
Constants in arithmetic starting with 0 should be octal only.

This avoids the following highly puzzling result:
  $ echo $((018-017))
  3
by making it an error instead.
2010-12-18 23:03:51 +00:00
Jilles Tjoelker
fa0951d63a sh: Fix corruption of command substitutions with special chars after newline
The CTLESC byte to protect a special character was output before instead of
after a newline directly preceding the special character.

The special handling of newlines is because command substitutions discard
all trailing newlines.
2010-12-16 23:28:20 +00:00
Edward Tomasz Napierala
ccbd595076 Recognize NFSv4 ACL semantics and run proper regression test. 2010-12-13 18:59:55 +00:00
Jilles Tjoelker
2a3de776bf sh: Fix some tests that used sh instead of ${SH}
so they tested the wrong sh.

This was caused because these tests were committed after the sh -> ${SH}
change but were created before.
2010-12-12 21:18:16 +00:00
Jilles Tjoelker
63f6e7ba56 sh: Add a test for r216387 (long arithmetic expression in here document). 2010-12-12 16:56:16 +00:00
Edward Tomasz Napierala
552c039da9 Add regression test for new NFSv4 ACL semantics, verified with ZFSv28.
Note that to run it, you need not only ZFSv28, but also a modified setfacl(1),
which is not in the tree yet.
2010-12-12 13:04:30 +00:00
Pawel Jakub Dawidek
76423e6e3c Allow to specify path to a file we want to test with sendfile(2).
This allows to specify selected file system and not only /tmp/.
2010-12-11 16:06:52 +00:00
Jilles Tjoelker
1c95cbaf9b printf: Test that the "--" option terminator works. 2010-12-08 22:54:18 +00:00
David Schultz
443a48f0a1 Work around gcc constant folding bugs. 2010-12-06 00:19:56 +00:00
David Schultz
cf37ce3724 signbit() returns nonzero for negative arguments, but we shouldn't assume
that it always returns the same nonzero value.
2010-12-06 00:02:49 +00:00
David Schultz
4a09b0df94 Fix some warnings. 2010-12-05 23:50:49 +00:00
David Schultz
18c5bc2279 Add regression tests for logarithmic functions in the math library. 2010-12-05 22:18:35 +00:00
Ulrich Spörlein
d180d7efa2 Document two more ways to find duplicates in the obsolete file list.
Remove the only duplicate found by the optional files check. Fix typos,
while here.

Suggested by:	netchild
2010-12-04 11:40:40 +00:00
Konstantin Belousov
b010326013 Extend the unix gc regression test to cover the case of r216150.
Requested and reviewed by:	rwatson
MFC after:	1 week
2010-12-03 16:17:53 +00:00
Warner Losh
6daeae43a6 o Mount the device async when we're doing the copy.
o Create a sparse file instead of a fully zerod one.  This trades the
  possibiltiy of running out of space during the build for the speed
  gain not having do write all those zeros...

Submitted by:	n_hibma
2010-12-03 07:39:29 +00:00
Warner Losh
62a49e2109 _WITHOUT_SRCCONF has too much baggage. Instead, use the simpler
SRCCONF=/dev/null.
2010-12-03 07:33:43 +00:00
David Schultz
ee7d7a769c Add some basic regression tests for nearbyint(). 2010-12-03 00:44:31 +00:00
Jilles Tjoelker
95787f5dc0 sh: Make the test for cd/pwd with long pathnames more useful:
* Use $(getconf PATH_MAX /) to make sure we actually exercise the hard part
* Delete our test area even if the test fails
2010-11-28 22:49:58 +00:00
Poul-Henning Kamp
6c7e719d84 Don't checksum distfiles twice if they match the first time. 2010-11-23 21:21:56 +00:00
Poul-Henning Kamp
f095bbd631 Optimize the ports recurser a bit more. 2010-11-23 20:47:39 +00:00
Poul-Henning Kamp
c4779c39ab Improve the ports-dependency resolver by truncating the recursion if
we already did the target port, and by leaving behind a /tmp/_.plist.dot
which documents which ports pulled in what other ports.
2010-11-23 20:28:21 +00:00
Jilles Tjoelker
4fadeef03f sh: Add a test that manipulates various long strings.
It is quite effective at detecting mistakes in memalloc.c and code using it.

It is somewhat slow, but some of the patches in my queue improve it.
2010-11-19 22:25:32 +00:00
Jilles Tjoelker
440bbebcc9 sh: Add another simple test for the wait builtin. 2010-11-19 21:15:06 +00:00
George V. Neville-Neil
b751664f7f Fix an error in our results printing. 2010-11-16 20:39:52 +00:00
Oleksandr Tymoshenko
fe5ddba7a9 Add optional files controlled by WITH_GPIO knob
Submitted by:	Alexander Best <arundel@freebsd.org>
2010-11-14 22:14:36 +00:00
Rebecca Cran
97f9dcf763 lib32 is installed on powerpc64 too. 2010-11-14 19:37:07 +00:00
Rebecca Cran
60db6c3233 libatm_p.a, libkeycap_p.a and libmytinfo_p.a are already in ObsoleteFiles.inc.
liblwres.so.10 has been replaced by liblwres.so.50.

Reported by: arundel
2010-11-14 17:24:15 +00:00
George V. Neville-Neil
e162ea60d4 Add a queue to hold packets while we await an ARP reply.
When a fast machine first brings up some non TCP networking program
it is quite possible that we will drop packets due to the fact that
only one packet can be held per ARP entry.  This leads to packets
being missed when a program starts or restarts if the ARP data is
not currently in the ARP cache.

This code adds a new sysctl, net.link.ether.inet.maxhold, which defines
a system wide maximum number of packets to be held in each ARP entry.
Up to maxhold packets are queued until an ARP reply is received or
the ARP times out.  The default setting is the old value of 1
which has been part of the BSD networking code since time
immemorial.

Expose the time we hold an incomplete ARP entry by adding
the sysctl net.link.ether.inet.wait, which defaults to 20
seconds, the value used when the new ARP code was added..

Reviewed by:	bz, rpaulo
MFC after: 3 weeks
2010-11-12 22:03:02 +00:00
Warner Losh
fe5c39573b Insulate the nanobsd build from the current system by opting out of
the SRCCONF processing.

Noted by: gcopper@
2010-11-10 06:24:16 +00:00
Warner Losh
7d0b395d1a Build make.conf when the world is not selected to build, but the
kernel is.

PR:		151696
Submitted by:	lev@
2010-11-10 00:56:44 +00:00
Warner Losh
4a8a8af722 Document NANO_CFGDIR and NANO_DATADIR
Submitted by:	n_hibma@
2010-11-10 00:39:42 +00:00
Xin LI
65a1c46588 Hide 460.chkportsum in MK_PKGTOOLS != no case.
Submitted by:	Alex Kozlov <spam rm-rf kiev ua>
MFC after:	2 weeks
2010-11-09 18:46:44 +00:00
Jilles Tjoelker
47fdf870a7 test: Move tests to tools/regression/bin/test.
Convert the tests to the perl prove format.
Remove obsolete TEST.README (results of an old TEST.sh for some old Unices)
and TEST.csh (old tests without correct values, far less complete than
TEST.sh).

MFC after:	1 week
2010-11-08 23:15:10 +00:00
Nick Hibma
bb595df94d - Set -x flag when executing customisation scripts to aid in debugging them.
- Use KERNCONFDIR with KERNCONF instead of copying the kernel config into the source tree
  so included kernel configs work.
- Put more stuff in the _.bk/_.ik log file, not just make statements.
- Add the kernel config name to the pprint during kernel installation.
- Add NANO_MODULES providing a list of modules to build and install.

Reviewed by:	imp
MFC after:	2 weeks
2010-11-07 21:57:57 +00:00
Edward Tomasz Napierala
43b838f75c Remove useless comment. 2010-11-07 17:33:04 +00:00
Jilles Tjoelker
5aa39e6a7e sh: Add simple tests for printf.
These are not meant as a replacement for tools/regression/usr.bin/printf/*
but to detect errors specific to making it a shell builtin.
2010-11-05 21:47:58 +00:00
Jilles Tjoelker
135ff4b5b0 sh: Fix some issues with aliases and case, by importing dash checkkwd code.
This moves the function of the noaliases variable into the checkkwd
variable. This way it is properly reset on errors and aliases can be used
normally in the commands for each case (the case labels recognize the
keyword esac but no aliases).

The new code is clearer as well.

Obtained from:	dash
2010-11-02 23:44:29 +00:00
Jilles Tjoelker
e20776d503 sh: Detect various additional errors in the parser.
Apart from detecting breakage earlier or at all, this also fixes a segfault
in the testsuite. The "handling" of the breakage left an invalid internal
representation in some cases.

Examples:
  echo a; do echo b
  echo `) echo a`
  echo `date; do do do`

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-29 21:06:57 +00:00
Jilles Tjoelker
60f7eec450 sh: Fix some issues with CTL* bytes and ${var#pat}.
subevalvar() incorrectly assumed that CTLESC bytes were present iff the
expansion was quoted. However, they are present iff various processing such
as word splitting is to be done later on.

Example:
  v=@$e@$e@$e@
  y="${v##*"$e"}"
  echo "$y"
failed if $e contained the magic CTLESC byte.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-29 19:34:57 +00:00
Jilles Tjoelker
048f26671a sh: Do IFS splitting on word in ${v+word} and ${v-word}.
The code is inspired by NetBSD sh somewhat, but different because we
preserve the old Almquist/Bourne/Korn ability to have an unquoted part in a
quoted ${v+word}. For example, "${v-"*"}" expands to $v as a single field if
v is set, but generates filenames otherwise.

Note that this is the only place where we split text literally from the
script (the similar ${v=word} assigns to v and then expands $v). The parser
must now add additional markers to allow the expansion code to know whether
arbitrary characters in substitutions are quoted.

Example:
  for i in ${$+a b c}; do echo $i; done

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-29 13:42:18 +00:00
Jilles Tjoelker
6c38071288 sh: Only accept a '}' inside ${v+-=?...} if double-quote state matches.
If double-quote state does not match, treat the '}' literally.

This ensures double-quote state remains the same before and after a
${v+-=?...} which helps with expand.c.

It makes things like
  ${foo+"\${bar}"}
which I have seen in the wild work as expected.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-28 22:34:49 +00:00
Jilles Tjoelker
9cec947f3f sh: Make double-quotes quote a '}' inside ${v#...} and ${v%...}.
Exp-run done by:	pav (with some other sh(1) changes)
PR:			bin/57554
2010-10-28 21:51:14 +00:00
Jilles Tjoelker
67e109adbe sh: Do not allow overriding a special builtin with a function.
This is a syntax error.

POSIX does not say explicitly whether defining a function with the same name
as a special builtin is allowed, but it does say that it is impossible to
call such a function.

A special builtin can still be overridden with an alias.

This commit is part of a set of changes that will ensure that when
something looks like a special builtin to the parser, it is one. (Not the
other way around, as it remains possible to call a special builtin named
by a variable or other substitution.)

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-24 22:03:21 +00:00
Jilles Tjoelker
074e83b14e sh: Make sure defined functions can actually be called.
Add some conservative checks on function names:
- Disallow expansions or quoting characters; these can only be called via
  strange control characters
- Disallow '/'; these functions cannot be called anyway, as exec.c assumes
  they are pathnames
- Make the CTL* bytes work properly in function names.

These are syntax errors.

POSIX does not require us to support more than names (letters, digits and
underscores, not starting with a digit), but I do not want to restrict it
that much at this time.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-24 20:45:13 +00:00
Jilles Tjoelker
3dec7d0c15 sh: Check whether dup2 was successful for >&FD and <&FD.
A failure (usually caused by FD not being open) is a redirection error.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-24 20:09:49 +00:00
Jilles Tjoelker
7aaae32724 sh: Add a test trying to close a descriptor that is not open.
In stable/8 and older, this fails. Some of the redirection changes in head
have fixed it.
2010-10-24 19:56:34 +00:00
Jilles Tjoelker
ba08f69b5c sh: Change ! within a pipeline to start a new pipeline instead.
This is how ksh93 treats ! within a pipeline and makes the ! in
  a | ! b | c
negate the exit status of the pipeline, as if it were
  a | { ! b | c; }

Side effect: something like
  f() ! a
is now a syntax error, because a function definition takes a command,
not a pipeline.

Exp-run done by:	pav (with some other sh(1) changes)
2010-10-24 17:06:49 +00:00
Jilles Tjoelker
281fb05e83 sh: Add some testcases for alias expansion. 2010-10-24 16:55:17 +00:00
Robert Watson
6e4d736661 Add microbenchmark for create/unlink of a zero-byte file.
Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-24 09:14:21 +00:00
Robert Watson
1c2b97e084 Validate syscall_timing test names before starting to provide earlier
feedback regarding user error.

Provide default loop and timing settings.

Add a new test that just times pread() without the open()/close().

Mark tests requiring a path argument so we can provide better feedback
to the user than EFAULT on (null).

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-22 11:22:19 +00:00
Robert Watson
73e5f76349 Universally use uintmax_t in syscall_timing; rearrange arithmetic to
suffer fewer rounding errors with smaller numbers; fix argc validation
so multiple tests run on a single command line.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 21:08:12 +00:00
Robert Watson
4e20912ad8 Add Cambridge/Google tag since the copyright has been updated.
MFC after:	2 weeks
2010-10-21 19:03:24 +00:00
Robert Watson
c4cc2fbf5c Further syscall_timing improvements: allow an arbitrary "path" string
argument to be passed on the command line, allowing file-related tests
to be pointed at wherever desired.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 19:01:59 +00:00
Robert Watson
3e36aa656e Fix bug in recent syscall_timing change: measure the number of iterations
each loop, rather than once up front.  The distinction is unimportant
when doing a fix iteration count, but when using a timer, it should vary.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 17:35:08 +00:00
Robert Watson
1dca6a2844 Further enhancements to syscall_timing:
- Use getopt rather than hand-parsed arguments
- Allow iterations to be specified and/or a new number of seconds bound
  on the number of iterations
- Fix printout of timer resolution
- Add new tests, such as TCP and UDP socket creation, and open/read/close
  of /dev/zero and /dev/null.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 17:27:39 +00:00
Robert Watson
37931439fd Improve the structure and implementation of the syscall_timing
microbenchmark suite:

- Use common benchmark_start/benchmark_stop routines to simplify
  individual benchmarks.
- Add a central table of tests with names, where new tests can be
  hooked in easily.
- Add new benchmarks for dup, shm_open, shm_open + fstat, fork,
  vfork, vfork + exec, chroot, setuid.
- Accept a number of loops, not just a number of iterations.
- Report results more usefully in a table.

Sponsored by:	Google, Inc.
MFC after:	2 weeks
2010-10-21 16:08:31 +00:00
Jilles Tjoelker
f1bb5f6a87 sh: Allow running 'prove' from tools/regression/bin/sh again
without needing to set special environment variables, testing the 'sh' from
PATH.
2010-10-15 20:01:35 +00:00
David E. O'Brien
7c7a210ab8 Embellish this testcase a little bit to be more clear what the output is
and why.  The first case is correct usage which has but one correct output.
The 2nd and 3rd cases are incorrect usage in which the exact output is
not standardized and various shells give various allowable output.
2010-10-14 23:28:31 +00:00
David E. O'Brien
7cfe69417c Do not assume in growstackstr() that a "precious" character will be
immediately written into the stack after the call.  Instead let the caller
manage the "space left".

Previously, growstackstr()'s assumption causes problems with STACKSTRNUL()
where we want to be able to turn a stack into a C string, and later
pretend the NUL is not there.

This fixes a bug in STACKSTRNUL() (that grew the stack) where:
1. STADJUST() called after a STACKSTRNUL() results in an improper adjust.
   This can be seen in ${var%pattern} and ${var%%pattern} evaluation.
2. Memory leak in STPUTC() called after a STACKSTRNUL().

Reviewed by:	jilles
2010-10-13 23:29:09 +00:00
David E. O'Brien
f3bf9b7a16 Allow one to regression test 'sh' changes without having to install
a potentially bad /bin/sh first.
2010-10-12 18:20:38 +00:00
David E. O'Brien
5f7f699749 Correct regression test to not show a false positive when run as root. 2010-10-11 23:24:57 +00:00
Mark Murray
60e6ef07e0 Don't blow away /bin/rmail symlink if we are keeping mailwrapper.
Mailwrapper can provide a perfectly good rmail with other
mailers.
2010-10-08 17:42:09 +00:00
Sergey Kandaurov
cd94bb1e54 Clean up tools in tools/tools/netrate.
- tcpconnect incorrectly uses err() in usage() with errx() semantics [1]
  That produces dirty error message:
  tcpconnect: usage: tcpconnect [ip]: Unknown error: 0
- 64-bit aware fixes in printf() usage [2]
o   netrate/juggle: time_t has arch-dependent size
o   netrate/tcpconnect: don't assume %ll has always 64bit.

PR:		146088 [1], 146086 [2] (modified)
Approved by:	kib (mentor)
MFC after:	1 week
2010-10-08 14:31:49 +00:00
Alexander Leidinger
916d70039a Add some missing files to optionally delete.
Submitted by:	Paul B Mahol <onemda@gmail.com>
2010-10-06 07:49:28 +00:00
Oleksandr Tymoshenko
923974ab03 - Add WITH_GPIO entry to src.conf(5) man page 2010-10-05 22:26:01 +00:00
George V. Neville-Neil
d329352945 Change the output of mctest to give a summary of the results instead
of printing a long list.

Add a default base port, and default mulitcast address to the
runner script.

Add support for specifying a different local and remote interface
in the runner script.

MFC after:	1 week
2010-10-01 14:36:36 +00:00
Michael Reifenberger
a15cc72e0c - simplify by using one build script
- use label for mounting
- use GENERIC kernel
- create empty Pkg directory
2010-10-01 10:34:35 +00:00
Jilles Tjoelker
88deede54a tr: Fix '[=]=]' equivalence class.
A closing bracket immediately after '[=' should not be treated as special.

Different from the submitted patch, a string ending with '[=' does not cause
access beyond the terminating '\0'.

PR:		bin/150384
Submitted by:	Richard Lowe
MFC after:	2 weeks
2010-09-29 22:24:18 +00:00
Pawel Jakub Dawidek
332bbedddd Correct message.
Pointed out by:	jhb
MFC after:	2 weeks
2010-09-27 21:10:37 +00:00
Pawel Jakub Dawidek
9eecfa1c33 Add some regression tests for newly added -J and -j options.
MFC after:	2 weeks
2010-09-25 17:41:02 +00:00
Pawel Jakub Dawidek
5c181adf40 Don't hardcode md0 in message, use $md instead.
Reported by:	Ronald Klop <ronald-freebsd8@klop.yi.org>
2010-09-25 15:37:41 +00:00
Edward Tomasz Napierala
5b098ddce2 Don't leave zombies behind. 2010-09-25 14:54:31 +00:00
Edward Tomasz Napierala
9e294983e9 Add a shell script to generate a test script for trivial ACLs. 2010-09-25 14:33:35 +00:00
Pawel Jakub Dawidek
d3937ea915 Update regression tests after AES-XTS addition.
MFC after:	2 weeks
2010-09-25 10:34:42 +00:00
Pawel Jakub Dawidek
e5fa43590a - Use $md instead of md0, which fixes tests when md(4) device is already
present.
- Correct message - we create GPT, not MBR.

MFC after:	2 weeks
2010-09-25 10:34:11 +00:00
David Xu
e04b953e48 Add test cases for stack unwinding. 2010-09-25 04:26:40 +00:00
Warner Losh
12d455a6b1 Make the labels match the device name that's mounted, not just the
slice they are on.  When NANO_LABEL is not defined, the fstab
generates entries that specify /dev/ad0s1a.  When NANO_LABEL is
defined, it generates /dev/usb/${NANO_LABEL}s1a.  The prior code
created the file system with a label of ${NANO_LABEL}s1, leading to
problems on boot.

Pointy hat to: imp@
2010-09-22 04:48:39 +00:00
Andriy Gapon
928405318d tools/umastat: more cleanups
PR:		misc/146119
Submitted by:	pluknet <pluknet@gmail.com>
MFC after:	1 week
2010-09-21 05:36:30 +00:00
Warner Losh
eba842f9d8 Support new variable NANO_LABEL. When set to a non-null string,
nanobsd will build a system that uses this label (via
/dev/ufs/${NANO_LABEL}sX) in preference to NANO_DRIVE (well, it forces
NANO_DRIVE to be ufs/${NANO_LABEL}).  This allows images that will
boot off usb stick or CF card easily well.

There is no change if you don't set this variable.
2010-09-20 23:36:54 +00:00
Brian Somers
044bf69fd5 Add a geli resize subcommand to resize encrypted filesystems prior
to growing the filesystem.

Refuse to attach providers where the metadata provider size is
wrong.  This makes post-boot attaches behave consistently with
pre-boot attaches.  Also refuse to restore metadata to a provider
of the wrong size without the new -f switch.  The new -f switch
forces the metadata restoration despite the provider size, and
updates the provider size in the restored metadata to the correct
value.

Helped by:	pjd
Reviewed by:	pjd
2010-09-20 22:04:59 +00:00
Andriy Gapon
4b5ccbf768 tools/umastat: fix build on amd64
And perhaps other 64-bit platforms.

Submitted by:	Fabian Keil <freebsd-listen@fabiankeil.de>
MFC after:	1 week
2010-09-20 21:22:15 +00:00
Brian Somers
1ad5f80fac Revise r197763 which fixes filesystem corruption when extending
into un-zeroed storage.

The original patch was questioned by Kirk as it forces the filesystem
to do excessive work initialising inodes on first use, and was never
MFC'd.  This change mimics the newfs(8) approach of zeroing two
blocks of inodes for each new cylinder group.

Reviewed by:	mckusick
MFC after:	3 weeks
2010-09-19 08:18:56 +00:00
Dimitry Andric
d39c594d39 Vendor import of llvm r114020 (from the release_28 branch):
http://llvm.org/svn/llvm-project/llvm/branches/release_28@114020

Approved by:	rpaulo (mentor)
2010-09-17 15:48:55 +00:00
Jilles Tjoelker
8f2dc7de67 sh: Fix exit status if return is used within a loop condition. 2010-09-11 15:07:40 +00:00
Jilles Tjoelker
011d162dd3 sh: Apply variable assignments left-to-right in bltinlookup().
Example:
  HOME=foo HOME=bar cd
2010-09-11 14:15:50 +00:00
Jilles Tjoelker
917fdfb106 sh: Fix 'read' if all chars before the first IFS char are backslash-escaped.
Backslash-escaped characters did not set the flag for a non-IFS character.

MFC after:	2 weeks
2010-09-08 20:35:43 +00:00
Jilles Tjoelker
ad931dfdcb sh: Add simple tests for backslashes in the read builtin. 2010-09-08 18:32:23 +00:00
Jilles Tjoelker
10ea2923a9 sh: Add a test that 'read' leaves the file pointer at the correct place.
Naive buffering would break the common while read x... construct, which did
not appear to be tested yet.
2010-09-03 21:17:33 +00:00
Poul-Henning Kamp
9f5b45662f We need to copy the ports config files before we launch the prefetch 2010-09-03 09:34:15 +00:00
Warner Losh
42908e80e6 Allow / in the NANO_DEVICE
PR:		149729
Submitted by:	Thomas Quinot <thomas@cuivre.fr.eu.org>
2010-09-03 03:48:06 +00:00
Jilles Tjoelker
83866607fb sh: Weaken builtins/command4 test to only require a nonzero exit status.
This matches what is in POSIX; various other shells use different exit
statuses.

Note that it is still required that there be no output.
2010-08-29 20:53:24 +00:00
Brian Somers
25fdbebeb2 Add a Makefile for tools/regression/bin and support 'all' in
pax/Makefile.

MFC after:	3 weeks
2010-08-29 12:14:53 +00:00
Brian Somers
cd14b45756 Correct an out-by-one error when earlying out ustar filenames that
are too long.  Filenames escaping this test are caught later on,
so the bug doesn't cause any breakage.

Document the correct ustar limitations in pax.  As I have no access
to the IEEE 1003.2 spec, I can only assume that the limitations
imposed are in fact correct.

Add regression tests for the filename limitations imposed by pax.

MFC after:	3 weeks
2010-08-29 11:56:56 +00:00
Konstantin Belousov
42992a3a9c Test the poll(2) return value.
MFC after:	2 weeks
2010-08-28 17:38:40 +00:00
Gabor Kovesdan
6608cc579e - Change default grep back to GNU version. BSD grep can be built with the
WITH_BSD_GREP knob.
- Bump __FreeBSD_version

Requested by:   dougb
Approved by:    delphij (mentor)
2010-08-23 10:04:26 +00:00
Jilles Tjoelker
8fdbdb5d50 sh: Remove remnants of '!!' to negate pattern.
This Almquist extension was disabled long ago.

In pathname generation, components starting with '!!' were treated as
containing wildcards, causing unnecessary readdir (which could fail, causing
pathname generation to fail while it should not).
2010-08-22 21:18:21 +00:00
Jilles Tjoelker
394357b2b6 sh: Test that all bytes from 128 to 255 can be used in IFS.
To avoid multibyte issues, this test forces ISO8859-1 charset.

This also passes on stable/8.
2010-08-22 13:09:12 +00:00
Jilles Tjoelker
193da04bd8 sh: Add a test for breaking from a loop outside the current function.
It is unwise to rely on this but I'd like to know if this would break.
2010-08-22 11:04:30 +00:00
Rui Paulo
7d924a46c2 Update for the new tests.
Sponsored by:	The FreeBSD Foundation
2010-08-21 14:14:24 +00:00
Pawel Jakub Dawidek
af8ec89da4 More tests. 2010-08-18 22:06:43 +00:00
Jilles Tjoelker
44510b41ff sh: Add a test for break from a trap action. 2010-08-18 20:26:50 +00:00
Konstantin Belousov
7ac7ad63d8 Add simple test to check the functioning of retrieval of
pagesize()/pagesizes() after change to use aux vector. Note that
public function getosreldate() is different from libc-internal
__getosreldate() and does not use aux to fetch osreldate value.

MFC after:	1 month
2010-08-17 09:42:50 +00:00
Pawel Jakub Dawidek
385cae0f8e More tests, especially for lchown(2). 2010-08-17 06:08:09 +00:00
Jilles Tjoelker
7ba25e6e69 sh: Reduce unnecessary testsuite failures with other shells. 2010-08-16 22:23:19 +00:00
Jilles Tjoelker
2070b57f64 sh: Split off a more dubious test from parser/heredoc2.0. 2010-08-16 21:14:49 +00:00
Jilles Tjoelker
c06336d428 sh: Get rid of unnecessary non-standard empty lists.
POSIX does not allow constructs like:
  if cmd; then fi
  { }
Add a colon dummy command, except in a test that verifies that such empty
lists do not cause crashes when used as a function definition.
2010-08-16 17:18:08 +00:00
Pawel Jakub Dawidek
3618f38566 Finish renaming fstest to pjdfstest. 2010-08-15 21:29:03 +00:00
Pawel Jakub Dawidek
5a31155215 Give fstest a more unique name: pjdfstest.
It is released from time to time and used outside FreeBSD, so it is good to
have a name one can google.
2010-08-15 21:24:17 +00:00
Pawel Jakub Dawidek
c6d1bc95b8 Update copyright years. 2010-08-15 21:20:40 +00:00
Pawel Jakub Dawidek
af2ec7ee6b More tests. 2010-08-15 21:19:42 +00:00
Jilles Tjoelker
ae7c0700dc sh: Fix break/continue/return sometimes not skipping the rest of dot script.
In our implementation and most others, a break or continue in a dot script
can break or continue a loop outside the dot script. This should cause all
further commands in the dot script to be skipped. However, cmdloop() did not
know about this and continued to parse and execute commands from the dot
script.

As described in the man page, a return in a dot script in a function returns
from the function, not only from the dot script. There was a similar issue
as with break and continue. In various other shells, the return appears to
return from the dot script, but POSIX seems not very clear about this.
2010-08-15 21:06:53 +00:00
Jilles Tjoelker
a129ce0167 sh: Test that all bytes from 1 to 127 can be used in IFS.
This also passes on stable/8.
2010-08-15 17:14:05 +00:00
Pawel Jakub Dawidek
6d4317a1e4 More tests (especially for lchmod(2)), less code duplication. 2010-08-15 14:44:48 +00:00
Pawel Jakub Dawidek
ea9ba9fe93 - Use loops to avoid code duplication.
- More tests.
2010-08-13 21:17:59 +00:00
Pawel Jakub Dawidek
5b2bae575b More tests. 2010-08-12 20:35:14 +00:00
Pawel Jakub Dawidek
af7198501c Portable Makefile. 2010-08-12 19:45:27 +00:00
Pawel Jakub Dawidek
d4f106bd86 Fix copy&pasted code - we want to create character device here. 2010-08-12 19:43:40 +00:00
Pawel Jakub Dawidek
d999d7ae4f - Use loops where possible to avoid code duplication.
- Don't pass uid and gid to create_file() if not needed.
- More tests.
2010-08-11 17:34:58 +00:00
Pawel Jakub Dawidek
8db93ae7d4 Allow to specify uid, gid and mode for create_file(). 2010-08-11 17:33:32 +00:00
Matt Jacob
288f3fd63a Consistently set us to be SPC3 for our inquiry data.
For mptest, add delays to I/O that simulate real disks better. This
also allows us to simulate what happens when a device goes away
with active transactions. It's pretty spectacular.

Sponsored by:	Panasas
MFC after:	1 month
2010-08-11 17:25:14 +00:00
Pawel Jakub Dawidek
0cc88f266d More and more tests. 2010-08-11 16:34:44 +00:00
Pawel Jakub Dawidek
35f540a74b Move create_file() to misc.sh, as it is going to be used in more places. 2010-08-11 16:34:26 +00:00
Pawel Jakub Dawidek
5ad80c5727 Make use of recently added dirgen_max() and namegen_max() to implement
ENAMETOOLONG checks.
2010-08-11 16:33:17 +00:00
Pawel Jakub Dawidek
1d6b6a46d7 Instead of hardcoding {NAME_MAX} as 255 and {PATH_MAX} as 1024 obtain those from
pathconf(2) and properly generate too long file names.
This should fix ENAMETOOLONG checks on Linux.
2010-08-11 16:29:12 +00:00
Pawel Jakub Dawidek
828160e93c More tests, mostly related to devices and sockets. 2010-08-10 22:57:43 +00:00
Jilles Tjoelker
c8a3d81f34 sh: Fix heap-based buffer overflow in pathname generation.
The buffer for generated pathnames could be too small in some cases. It
happened to be always at least PATH_MAX long, so there was never an overflow
if the resulting pathnames would be usable.

This bug may be abused if a script subjects input from an untrusted source
to pathname generation, which a bad idea anyhow. Most shell scripts do not
work on untrusted data. secteam@ says no advisory is necessary.

PR:		bin/148733
Reported by:	Changming Sun snnn119 at gmail com
MFC after:	10 days
2010-08-10 22:45:59 +00:00
Pawel Jakub Dawidek
6a4e10db54 Linux has no strlcpy(). 2010-08-09 20:16:52 +00:00