summaryrefslogtreecommitdiffstats
path: root/tools/regression
Commit message (Collapse)AuthorAgeFilesLines
* sh: Add a test for a fairly obscure case with aliases.jilles2011-07-161-0/+6
| | | | This also passes on stable/8.
* posix_spawn: If an error is detected in the child process, reap the zombie.jilles2011-07-102-1/+91
| | | | | | | | | | Formerly, in this case an error was returned but the pid was also returned to the application, requiring the application to use unspecified behaviour (the returned pid in error situations) to avoid zombies. Now, reap the zombie and do not return the pid. MFC after: 2 weeks
* Clarify the meaning of a test.jonathan2011-07-082-4/+4
| | | | | | | | | | | | Rather than using err() if either of two failure conditions fires (which can produce spurious error messages), just use errx() if the one condition that really matters fires. In practice, this single test is enough to detect the failure mode we're looking for (kqueue being inherited across fork). Approved by: mentor (rwatson), re (Capsicum blanket) Sponsored by: Google Inc
* Ensure that kqueue is not inherited across fork().jonathan2011-07-073-6/+21
| | | | | | | | | | | | | | | Modify the existing unit test (from libkqueue) which already exercises process events via fork() and kill(). Now, the child process simply checks that the 'kqfd' descriptor is invalid. Some minor modifications were required to make err() work correctly. It seems that this test was imported using the output of a configure script, but config.h was not included in key places, nor was its syntax correct (need '#define HAVE_FOO 1' rather than '#define HAVE_FOO'). Finally, change main() to run the "proc" suite by default, but widened the '#if TODO' in proc.c to include the non-functioning test event_trigger(). Approved by: mentor (rwatson), re (Capsicum blanket) Sponsored by: Google Inc
* sh: Test that '!' is literal if quoted and first char of bracket expressionjilles2011-06-251-0/+16
| | | | This also works on stable/8.
* sh: Add test for r223282.jilles2011-06-191-0/+6
|
* sh: Add case statement fallthrough (with ';&' instead of ';;').jilles2011-06-171-0/+39
| | | | | | | | | | | | Replacing ;; with the new control operator ;& will cause the next list to be executed as well without checking its pattern, continuing until a list ends with ;; or until the end of the case statement. This is like omitting "break" in a C "switch" statement. The sequence ;& was formerly invalid. This feature is proposed for the next POSIX issue in Austin Group issue #449.
* sh: Skip variables with invalid names in "set", "export -p", "readonly -p".jilles2011-06-172-0/+6
| | | | This ensures the output of these commands is valid shell input.
* sh: Reduce unnecessary forks with eval.jilles2011-06-161-0/+5
| | | | | | | | | | The eval special builtin now runs the code with EV_EXIT if it was run with EV_EXIT itself. In particular, this eliminates one fork when a command substitution contains an eval command that ends with an external program or a subshell. This is similar to what r220978 did for functions.
* sh: Add support for named character classes in bracket expressions.jilles2011-06-151-0/+32
| | | | | Example: case x in [[:alpha:]]) echo yes ;; esac
* sh: Add test for LC_COLLATE-based character ranges in case.jilles2011-06-121-0/+24
|
* sh: Add test for case pattern matching with iso-8859-1 charset.jilles2011-06-121-0/+52
| | | | This also passes on stable/8.
* sh: Do parameter expansion on ENV before using it.jilles2011-06-101-0/+11
| | | | | | This is required by POSIX, and allows things like ENV=\$HOME/.shrc. Note that tilde expansion is explicitly not performed.
* sh: Do parameter expansion before printing PS4 (set -x).jilles2011-06-091-0/+9
| | | | | | | | | | | | | | | | The function name expandstr() and the general idea of doing this kind of expansion by treating the text as a here document without end marker is from dash. All variants of parameter expansion and arithmetic expansion also work (the latter is not required by POSIX but it does not take extra code and many other shells also allow it). Command substitution is prevented because I think it causes too much code to be re-entered (for example creating an unbounded recursion of trace lines). Unfortunately, our LINENO is somewhat crude, otherwise PS4='$LINENO+ ' would be quite useful.
* sh: Add simple tests for set -x and PS4.jilles2011-06-082-0/+17
|
* sh: Fix $? in heredocs on simple commands.jilles2011-06-051-0/+15
| | | | PR: bin/41410
* sh: Add already working testcases for $? in here-document.jilles2011-06-051-0/+25
| | | | | | | | | If the here-document is attached to a compound command or subshell, $? already works properly. This is both a workaround for bin/41410 and a requirement for a true fix for bin/41410. PR: bin/41410 MFC after: 1 week
* Add a very simple IPDIVERT test, which creates IP divert sockets andrwatson2011-06-042-0/+177
| | | | | | | | | | | | checks for collision/non-collision properties in binding them. This test would have identified a bug recently reported on current@ involding my disaggregation of the pcbinfo lock. It would be nice if this test also exercised packet diversion and injection, but that is for another day. MFC after: 3 days Sponsored by: Juniper Networks, Inc.
* sh: Reduce more needless differences between error messages.jilles2011-06-041-1/+1
|
* sh: Honour -n while processing -c string.jilles2011-06-041-0/+3
|
* sh: Add tests for -n flag. These already pass.jilles2011-06-033-0/+16
|
* sh: Add tests for some somewhat obscure aspects of function definitions.jilles2011-05-302-0/+12
|
* Upgrade jail(2) to latest jail(2) API to make the regression test workbz2011-05-301-2/+9
| | | | | | | again. Eventually should switch to jail_set(2). Reported by: rwatson MFC after: 10 days
* Rework TIMEWAIT regression test so that kernel-allocated port numbers arerwatson2011-05-301-39/+84
| | | | | | | | used rather than a fixed userspace one, avoiding conflicts between the two test runs. MFC after: 3 days Sponsored by: Juniper Networks, Inc.
* Add missing include of stdio.h.rwatson2011-05-301-0/+1
| | | | | MFC after: 3 days Sponsored by: Juniper Networks, Inc.
* In the tcpdrop regression test, allow the kernel to allocate us a portrwatson2011-05-301-37/+44
| | | | | | | | | rather than using a fixed port number. This means that the regression test can be run many times in a row without waiting on TIMEWAIT to release a hard-coded port number. MFC after: 3 days Sponsored by: Juniper Networks, Inc.
* Add missing #include of err.h.rwatson2011-05-301-0/+1
| | | | | MFC after: 3 days Sponsored by: Juniper Networks, Inc.
* sh: Add test for 'set +o'.jilles2011-05-291-0/+32
|
* printf: Allow multibyte characters for '<char> form, avoid negative codes.jilles2011-05-283-1/+5
| | | | | | | | | | | | | Examples: LC_ALL=en_US.UTF-8 printf '%d\n' $(printf \'\\303\\244) LC_ALL=en_US.ISO8859-1 printf '%d\n' $(printf \'\\344) Both of these should print 228. Like some other shells, incomplete or invalid multibyte characters yield the value of the first byte without a warning. Note that there is no general way to go back from the character code to the character.
* sh: Correct criterion for using CDPATH in cd.jilles2011-05-272-0/+25
| | | | | | | CDPATH should be ignored not only for pathnames starting with '/' but also for pathnames whose first component is '.' or '..'. The man page already describes this behaviour.
* sh: Add simple CDPATH test.jilles2011-05-271-0/+23
|
* sh: Fix unquoted $@/$* if IFS=''.jilles2011-05-271-0/+39
| | | | | | If IFS is null, unquoted $@/$* should still expand to separate words. This differs from quoted $@ (which does not depend on IFS) in that pathname generation is performed and empty words are removed.
* sh: Add test for r222173.jilles2011-05-221-0/+12
|
* sh: Expand aliases after assignments and redirections.jilles2011-05-212-0/+10
|
* sh: Add test for positional parameters with more than one digit.jilles2011-05-211-0/+13
| | | | This also passes on stable/8.
* sh: Implement the cd -e flag proposed for the next POSIX issue.jilles2011-05-202-0/+59
| | | | | | | | | This reflects failure to determine the pathname of the new directory in the exit status (1). Normally, cd returns successfully if it did chdir() and the call was successful. In POSIX, -e only has meaning with -P; because our -L is not entirely compliant and may fall back to -P mode, -e has some effect with -L as well.
* sh: Allow terminating a heredoc with a terminator at EOF without a newline.jilles2011-05-201-0/+26
| | | | | | | | | | | | | | | | | | | | | | This is sometimes used with eval or old-style command substitution, and most shells other than ash derivatives allow it. It can also be used with scripts that violate POSIX's requirement on the application that they end in a newline (scripts must be text files except that line length is unlimited). Example: v=`cat <<EOF foo EOF` echo $v This commit does not add support for the similar construct with new-style command substitution, like v=$(cat <<EOF foo EOF) This continues to require a newline after the terminator.
* sh: Add tests for lines that look like heredoc delimiters but are not.jilles2011-05-142-0/+107
|
* sh: Add \u/\U support (in $'...') for UTF-8.jilles2011-05-082-0/+18
| | | | | | | | | | 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.
* sh: Add UTF-8 support to pattern matching.jilles2011-05-082-0/+132
| | | | | | | | | | ?, [...] 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).)
* sh: Add UTF-8 support to ${#var}.jilles2011-05-072-0/+28
| | | | | If the current locale uses UTF-8, ${#var} counts codepoints (more precisely, bytes b with (b & 0xc0) != 0x80).
* sh: Add $'quoting' (C-style escape sequences).jilles2011-05-059-0/+100
| | | | | | | | | | | | | | | | | | | | | | | | 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)
* sh: Apply set -u to variables in arithmetic.jilles2011-05-041-0/+6
| | | | | | | 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)
* sh: Detect an error for ${#var<GARBAGE>}.jilles2011-05-042-0/+3
| | | | | | | | | 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)
* Regression tests for Capsicum capability mode.jonathan2011-05-045-0/+587
| | | | | | | 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.
* sh: Set $? to 0 for background commands.jilles2011-04-253-0/+13
| | | | | | | | | | 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.
* sh: Allow EV_EXIT through function calls, make {...} <redir more consistent.jilles2011-04-233-0/+46
| | | | | | | | | | | | | | | | | | | | | 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.
* Expand / correct newsyslog regression tests:simon2011-04-211-9/+120
| | | | | | | | - 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.
* sh: Do not word split "${#parameter}".jilles2011-04-201-0/+8
| | | | | | | | | | | | | 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
* sh: Add test for bin/12137.jilles2011-04-151-0/+27
|
OpenPOWER on IntegriCloud