1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# Tests
```sh
make check # Linux: functional tests against ./zash
make asan # Linux: the same tests against an ASan + UBSan build
make valgrind # Linux: the same tests under Valgrind
make zos-check # z/OS: functional tests only (no sanitizers there)
make zos-heapcheck # z/OS: the same tests with LE heap check zones on
sh tests/run.sh -v ./zash pipes # one group or name pattern, verbose
```
| Directory | Contents | Expected output comes from |
|---|---|---|
| `posix/` | behaviour every POSIX shell agrees on | dash: `sh tests/regen.sh posix dash` |
| `zash/` | behaviour specific to zash | zash, reviewed by hand |
| `proc/` | how many spawns and forks a script costs | zash, reviewed by hand |
| `linux/` | Linux-only (`/dev/full`, error text) | zash on Linux |
| `zos/` | z/OS-only (`spawn()`, BPX variables, address spaces) | written by hand |
Each test is a script run in an empty scratch directory. Its stdout and
stderr followed by `[status N]` must equal the `.exp` file beside it.
`$TSH` is the shell under test, for tests that start another copy.
Conventions:
- Only POSIX utilities (`awk`, `sed`, `tr`, `wc`, `sort`, `grep`), so the
suite runs unchanged on z/OS. No `seq`, `od`, `mktemp` or GNU options.
- Nothing that depends on error-message text from the C library, except
under `linux/`.
- A test that depends on ASCII code points or collation is named
`*.ascii.sh`; the runner skips it for an EBCDIC build.
- On z/OS in an ASCII build the scripts must be tagged ISO8859-1 (the
`.gitattributes` does this on checkout).
After changing behaviour on purpose, regenerate the affected group and
read the diff before committing it: an `.exp` file is a claim about what
is correct.
## Skipping
A test that cannot run on the system exits with status 77 and is counted
as skipped, not failed.
## Interactive tests
`tests/linux/i-*.sh` run the shell on a pseudo-terminal with
`tests/tools/ptydrive.py` (python3). The driver types a script of `send`,
`wait` and `expect` steps and prints what the terminal showed, with
control sequences removed and each redrawn row reduced to its final
state. `$TESTS` is the path of this directory.
These tests cover the built-in editor (emacs and vi modes), completion,
history and `fc`, prompts, and job control. They do not run on z/OS.
|