NetBSD/tests
kre 9817a5b1e5 Paranoia: add a new test case testing that $(( )) results get split
by IFS just the same as any other expansion (split when they should be,
and not when they shouldn't).

Good thing I did ... this discovered a regression in the new expand
code (from an hour or three ago) where quoted arith expansions are
being split, and shouldn't be.  (on the other hand, when they should
be split, they are being split correctly, so that's good...)

No need to worry too much about this, in real life (as opposed to
torture tests) no-one ever puts digits in IFS, and a $(( )) expansion
only ever contains digits, so in practice, splitting never happens,
whether because it is quoted, or just becaue there is nothing to split.

The FreeBSD shell does it correctly (they do word splitting using a
totally different mechanism than we do) - I will find where I missed
testing for quoted expansions later tonight.  Until that happens,
expect a test failure from t_fsplit:split_arith

While here add more comments in the other test casess (one had a comment
already) that our shell parses incorrectly (this is a parsing problem,
not an expansion problem, and the bug has existed forever .. and is
shared by bash).

That is, in an expression like "${var:-word}" the whole thing (including
word) is quoted by the double quotes, and in "${var:-"word"}" the
expansion is quoted, but 'word' is not, the 2nd " (the one before 'w')
ends the opening quote, and the third (before }) turns quoting on
again (it is required that there be an even number of unquoted quotes inside
a ${} expression, so things like "${var:-"word} are simply invalid.)
Another way of saying this, is that if the { is quoted (for which the
only way is using " to get to this kind of expansion at all) the }
must also be quoted (" quoted).  There is no quote nesting here.

This also means that in "${var:-'word'}" the single quotes are just
characters, they are quoted by the "" that surround them, just as in
"a 'string' containing quotes", but "${var:-"'word'"}} is valid and
contains a single quoted word.

Note that this is different than the patetrn-match/trim expansions
( ${var%pattern} etc) where any surrounding quotes do not affect the
pattern, and all forms of quoting can be used in it - but it always
parses as a pattern, and is never subject to filename expansion, so
a '*' in it that is to mean "match any string" does not need special
quoting to avoid it expanding to file names, regardless of whether
the ${var%*} is quoted or not, but a * that is to be matched as a
character literally does need to be quoted.

I will probably file a PR about this bug sometime, but as it is
very old, and doesn't every seem to bother anyone (and is shared by
bash) there isn't any big hurry to open yet another verry messy can
of excrement to fix it...

This does mean that the FreeBSD shell "fails" some of our tests.
(The test is wrong, their shell is correct.)
2017-06-03 15:15:49 +00:00
..
bin Paranoia: add a new test case testing that $(( )) results get split 2017-06-03 15:15:49 +00:00
crypto Remove MKCRYPTO option. 2017-05-21 15:28:36 +00:00
dev Remove MKCRYPTO option. 2017-05-21 15:28:36 +00:00
fs give it more time. 2017-05-24 15:29:51 +00:00
games Do this more cleanly - put the do-we-have-crypto check inside the actual 2016-06-27 05:29:32 +00:00
include Don't play with "../.." in includes for h_macros.h; deal with it centrally. 2017-01-13 21:30:39 +00:00
ipf Remove the "expected failure" from test n12, and change it not to use 2015-12-26 08:01:58 +00:00
kernel Stress rump hyperentropy a little harder. 2017-04-16 18:24:23 +00:00
lib Add tests for btowc(3)/wctob(3) and enable compilation of the test for 2017-06-01 15:45:02 +00:00
libexec Don't play with "../.." in includes for h_macros.h; deal with it centrally. 2017-01-13 21:30:39 +00:00
modules Don't play with "../.." in includes for h_macros.h; deal with it centrally. 2017-01-13 21:30:39 +00:00
net Add IPSEC_KEY_DEBUG 2017-06-02 01:18:51 +00:00
rump Fix detection of expected results. The rump kernel code apparently 2017-05-03 12:09:41 +00:00
sbin Skip the "migrate" test on architectures not natively using MBR, it 2017-03-22 19:13:40 +00:00
share When no gcc but clang can be found, fallback to the latter instead of 2016-03-12 08:55:54 +00:00
sys convention about function names for predicate checking: 2016-12-22 08:15:20 +00:00
usr.bin In the -m32 test, additionally test profiled binaries. 2017-05-31 11:08:35 +00:00
usr.sbin PR/51876: Ngie Cooper: kyua 0.11 $TMPDIR fixes 2017-01-14 20:45:16 +00:00
Makefile Remove MKCRYPTO option. 2017-05-21 15:28:36 +00:00
Makefile.inc better name 2017-01-14 01:33:32 +00:00
README Clarify this a little. 2012-05-18 15:36:21 +00:00
h_macros.h provide an RL variant that prints an extra argument 2016-08-20 15:49:08 +00:00

README

$NetBSD: README,v 1.4 2012/05/18 15:36:21 jruoho Exp $

When adding new tests, please try to follow the following conventions.

1. For library routines, including system calls, the directory structure of
   the tests should follow the directory structure of the real source tree.
   For instance, interfaces available via the C library should follow:

	src/lib/libc/gen -> src/tests/lib/libc/gen
	src/lib/libc/sys -> src/tests/lib/libc/sys
	...

2. Equivalently, all tests for userland utilities should try to follow their
   location in the source tree. If this can not be satisfied, the tests for
   a utility should be located under the directory to which the utility is
   installed. Thus, a test for env(1) should go to src/tests/usr.bin/env.
   Likewise, a test for tcpdump(8) should be in src/tests/usr.sbin/tcpdump,
   even though the source code for the program is located under src/external.

3. Otherwise use your own discretion.