--- weight: 20 title: Development description: How zash is tested, benchmarked and kept warning-free. --- zash is one C23 source directory with a flat `.POSIX` makefile, and the tests are shell scripts compared against expected output. ## The suite ```sh make check # behavioural tests against ./zash make asan # ASan + UBSan build, whole suite make valgrind # whole suite under Valgrind, leaks included make bench # CPU time against dash, bash, ksh, zsh, oksh make format tidy # clang-format, clang-tidy ``` The tests are at several levels: - Behavioural tests for every feature. Portable ones also run under dash, and the outputs are compared, so a disagreement with an existing ash-family shell is always visible - either a bug or a deliberate difference. - Sanitizer and Valgrind runs of the whole suite on Linux. - Process accounting tests that assert the exact process count of a construct, so `$(echo x)` creating a process fails the suite instead of quietly costing a `fork()`. - Security tests for what a shell must never do: create a file more permissive than the umask allows, find a command in the current directory, or run what an expansion or a file name produced. - Interactive tests that drive the shell through a pseudo-terminal: editor keys in emacs and vi modes, completion, history, prompts, job control. They need python3 and are skipped without it. On z/OS the same behavioural and process-accounting tests run in either character mode, plus a z/OS-only group. There is no ASan or Valgrind there; Language Environment's heap checker does that job instead. ## Benchmarks as tests `bench/run.sh` compares each shell's output with the reference shell's, so a wrong answer fails the run instead of being timed and forgotten. `bench/ report.sh` and `bench/deploy.sh` are the two scripts that look most like what the shell is for.