summaryrefslogtreecommitdiff
path: root/regress/bin
AgeCommit message (Collapse)Author
2023-01-09Sanitize the inherited environment by removing LC_ALL, missed in previous.Anton Lindqvist
2023-01-08cope with recent thread name changesAnton Lindqvist
2022-10-16Add new failing read/signal testKlemens Nanni
^C does not abort `read < /dev/zero', instead it read(2)s indefinitely, one null byte at a time; bash and ksh93 from ports abort as expected. Use the new timeout(1) $PROG trick to send ^C after 0.1s, but also rely on it's -k for the final SIGKILL to stop the busy-looping process. ./th's `time-limit: 1' prints "test timed out (limit of 1 seconds)" but leaves the process running.
2022-10-16Add new trap/errexit/signal test simulating interactive usageKlemens Nanni
First try add capturing use cases like the bin/ksh/main.c r1.52 one: "[...] we would not run the signal trap if, for example, ^C was pressed and -e was set." With so many different factors (errexit?, receiving (special) signals, traps themselves failing/returing non-zero, running child processes?, etc.) it is very easy to miss subtle behaviour changes during scripting...
2022-10-16move/rename usr1 test to new signal block, tweak other nameKlemens Nanni
2022-10-16Always pass the test program as PROG env var, fix synopsisKlemens Nanni
The ./th perl script always runs -p prog (KSH in Makefile) as the shell, but cannot signal it other than the optional SIGKILL after `time-limit'. Implementing time-related signal handling in ./th seems overkill, so always pass the program as PROG in the environment so it can wrap itself, e.g. description: simluate interrupting a script stdin: timeout --signal SIGINT --preserve-status -- 1s $PROG -c ' actual test script getting ^C after one second... ' Avoiding hard-coded programs in tests with PROG allows testing different shells through `make KSH=/path/to/sh' without changing or adding shell specific tests. While here, make -p and -s as mandatory in usage as ./th `die's if they're not passed (allowing to always just pass -p's argument as PROG).
2022-10-15fix comments wrt. pending ksh fixesKlemens Nanni
2022-10-14add two new errexit/trap tests, tweak wordingKlemens Nanni
both pass in bash and ksh93 from ports. our ksh fails for now, so mark them as expected fail.
2022-10-14add two new errexit/trap testsKlemens Nanni
both behave the same with our ksh, bash and ksh93 from ports.
2022-10-10Trigger ERR trap on permanent I/O redirection failureKlemens Nanni
The following three cases behave identical in bash(1), but our ksh (ksh93 also) fails to run the trap in the last case: (non-zero exit code is trigger, no redirection) $ ksh -c 'trap "echo ERR" ERR ; false' ERR (failed redirection is trigger, 'echo' was not executed) $ ksh -c 'trap "echo ERR" ERR ; echo >/' ksh: cannot create /: Is a directory ERR (failed redirection, no execution, trap was NOT triggered) $ ksh -c 'trap "echo ERR" ERR ; exec >/' ksh: cannot create /: Is a directory bash(1) prints "ERR" in all three cases, as expected. ksh93 behaves like our ksh(1). In ksh `exec' is a builtin (CSHELL), but also special (SPEC_BI): $ type alias alias is a shell builtin $ type exec exec is a special shell builtin Without command and redirection alone, `exec' permanently redirects I/O for the shell itself, not executing anything; it is the only (special) builtin with such a special use-case, implemented as c_sh.c:c_exec(). This corner-case is overlooked in exec.c:execute() which handles iosetup() failure for all commands, incl. builtins. Exclude c_exec() from the rest of special builtins to ensure it runs the ERR trap as expected: $ ./obj/ksh -c 'trap "echo ERR" ERR ; exec >/' ksh: cannot create /: Is a directory ERR Also add three new regress cases covering this; rest keep passing. OK millert
2021-09-02regress tests shouldn't set or modify MALLOC_OPTIONS unless they're actually ↵Jasper Lievisse Adriaanse
very specific behaviour document this accordingly in the guidelines section of the manpage ok bluhm@
2021-07-10minor nits:anton
* compile the edit utility once * emit a warning during timeout
2021-07-06Make test more verbose to see commands and error messages in output.Alexander Bluhm
This makes it easier to debug if something fails. Add some ${SUDO} in a way that this tests runs as root or regular user with and without SUDO set.
2021-07-06Make use of the existing bsd.regress.mk logic to flag root only targets,anton
allowing the actual tests to become less repetitive. ok bluhm@
2021-07-01Just in case another developer besides anton@ and myself even wants toIngo Schwarze
look at these tests: add a comment providing a high-level picture of what is going on here, such that everyday maintenance can be performed without going down the rabbit hole of subr.sh and edit.c.
2021-07-01We already tested all corner cases for two-byte and three-byte UTF-8Ingo Schwarze
sequences, but coverage of four-byte sequences was incomplete, which contributed to the recently fixed ksh(1) emacs.c bug not being found for some time. Consequently, add some tests covering + valid sequences starting with \0360, \0361, and \0363; + incomplete sequences starting with \0360 and \0361; + invalid (too low) sequences starting with \0360. OK anton@
2021-06-30The byte \0363 is not invalid in UTF-8.Ingo Schwarze
The incorrectness of this test was exposed by the bugfix in /usr/src/bin/ksh/emacs.c rev. 1.88 and reported to me by bluhm@. This is a minimal fix replacing the incorrect test line with two correct tests involving the same byte. OK anton@
2021-03-05Test case for read-only array being not that read-only in ksh.Vadim Zhukov
okay tb@
2020-12-25Fix test after change of wmesg.Visa Hankala
2020-12-18Use regress framework.Alexander Bluhm
2020-12-17Remove echo headlines.Alexander Bluhm
2020-09-20As in emacs.sh -r1.11 by jca, don't test the behavior of ^L. WithTheo Buehler
millert's clear-screen change in vi.c -r1.57 it now depends on $TERM
2020-09-13Adapt regress to IFS splitting correction (eval.c -r1.66)Theo Buehler
From Martijn Dekker
2020-07-07Add support for set -o pipefailJeremie Courreges-Anglas
With the pipefail option set, the exit status of a pipeline is 0 if all commands succeed, or the return status of the rightmost command that fails. This can help stronger error checking, but is not a silver bullet. For example, commands will exhibit a non-zero exit status if they're killed by a SIGPIPE when writing to a pipe. Yet pipefail was considered useful enough to be included in the next POSIX standard. This implementation remembers the value of the pipefail option when a pipeline is started, as described as option 1) in https://www.austingroupbugs.net/view.php?id=789#c4102 Requested by ajacoutot@, ok millert@
2020-05-22Add test covering revision 1.64 of c_sh, fix exit code of compound listsanton
while using option e.
2020-01-09All ed(1) tests which were disabled before, have been inspected andAlexander Bluhm
fixed. Some tests fail due to missing POSIX compliance as documented in the readme. Mark them as expected failures.
2018-01-14Run the tests provided in /usr/src/bin/ed/test with the regressAlexander Bluhm
framework. Three ed tests are currently failing for unknown reasons. They are marked as disabled for now. from Sergey Bronnikov
2019-04-03Don't test the behavior of ^L as it depends on $TERMJeremie Courreges-Anglas
Suggested by anton@
2019-02-21a handful of new tests related to expr.c rev. 1.34Ingo Schwarze
2018-12-08Fix kill [-SIGNAME | -s SIGNAME] and simplifyJeremie Courreges-Anglas
While the code intended to support both -s NAME and -s SIGNAME, the tests performed were wrong. Replace convoluted code with less cryptic conditionals. ok anton@
2018-12-08Basic regress test for kill -s SIG[NAME] (now failing)Jeremie Courreges-Anglas
Prodded by anton@
2018-09-29test that PWD and OLDPWD are exportedanton
2018-07-09Add a test related to variable expansion that used to trigger the segfault seenanton
in the installer. from tb@
2018-07-08Add test covering variable expansion referencing multiple read-only variables.anton
2018-05-09After the fix to kvm_getargv(3)/kvm_getenv(3) on May 3,Ingo Schwarze
the command name is printed in a more logical way for -e without -c. Adjust the tests accordingly. Requested by bluhm@.
2018-04-24Add test for proper stack reallocation in time commandkn
OK jca
2018-04-09Support 64 bit integers on 32 bit architectures.Tobias Stoeckmann
No binary change on amd64 and there should be no differences on any other 64 bit architecture either (because long = int64_t). ok cheloha, tb
2018-04-02Support integers of arbitrary length.Tobias Stoeckmann
Previously it was possible to overflow integers while parsing. With this diff, we support any kind of POSIX-compatible integers for comparisons. with input by and ok schwarze, ok tb
2018-03-31a few more edge case tests, aiming for complete coverageIngo Schwarze
2018-03-31Fix overflows while handling 64 bit integers.Tobias Stoeckmann
Based on FreeBSD's expr and NetBSD's old regression test suite. with input by and ok schwarze
2018-01-14Link ed regress to build.Alexander Bluhm
2018-01-14Run the tests provided in /usr/src/bin/ed/test with the regressAlexander Bluhm
framework. Three ed tests are currently failing for unknown reasons. They are marked as disabled for now. from Sergey Bronnikov
2018-01-12Fix tyopsJeremie Courreges-Anglas
2018-01-12Add tests for [[:foo:]] character classes in globsJeremie Courreges-Anglas
2018-01-12Add basic tests for octal and hex notation in arithmetic expansionsJeremie Courreges-Anglas
POSIX requires only decimal, octal and hex, tests for the $((x#number)) notation could be useful too.
2017-12-18Add tests for the environment related commands in csh. While here, print aanton
descriptive header before each test, inspired by the many others in regress.
2017-11-21Add tests for emacs editing mode in ksh. While here, improve the output on testanton
failure.
2017-11-21Do not exit 0 if the program was terminated due to receipt of a signal otheranton
than SIGHUP.
2017-11-16Add a variable referencing the csh binary to test.anton
2017-10-23Add tests for history load from file.anton