tests: README: updates README

This commit is contained in:
Emma Tebibyte 2024-08-07 22:03:32 -06:00
parent eb821715f7
commit 8e5090d13d
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -1,57 +1,33 @@
The testing suite contains two main trees (plus translations for strings used in The testing suite contains two trees: the Bonsai tree and the POSIX tree:
the shell scripts): the Bonsai tree and the POSIX tree:
. .
├── bonsai
│   ├── test_env
│   ├── dj.sh
│   ├── false.sh
│   ├── fop.sh
│   ├── hru.sh
│   ├── intcmp.sh
│   ├── mm.sh
│   ├── strcmp.sh
│   └── true.sh
├── locales
│   ├── en_US.UTF-8
│   └── tok
├── posix
│   ├── bin
│   │   ├── cat
│   │   ├── false
│   │   └── true
│   └── posix_env
├── README ├── README
└── test.sh ├── bonsai/
│   ├── dj.mk
│   ├── false.mk
│   ├── fop.mk
│   └── ...
├── posix/
└── tests.mk
The Bonsai tree tests the functionality of Harakit utilities for regressions and The Bonsai tree tests the functionality of Harakit utilities for regressions and
other issues relating to compliance to our standards of practice. other issues relating to compliance to our standards of practice.
The POSIX tree tests the use of Harakit utilities in place of the standard usage The POSIX tests are currently a work-in-progress. Their status in this
of POSIX utilities. These scripts test the ability of Harakit to comply to POSIX repository is uncertain.
standards using its native utilities in shell scripts as a compatibility shim.
Each shell script in the top directory should contain a set of tests for each
POSIX utility and be named for that utility. The bin directory should contain
a set of shim scripts which will be imported into the path as POSIX utilities.
Each test will compare the behavior of the shim script to the real utility on
the system.
Currently, due to the limitations of POSIX shell quoting, a subset of argument Both sets of tests also inherit the environment set by the top-level Makefile,
parsing is supported: arguments containing characters from POSIXs Portable which sets the BIN variable to the build/bin directory at the root of the
Filename Character Set [0]. project; therefore, each binary is located at $(BIN)/tool for idiomatic access.
The bonsai/test_env and posix/posix_env files contain prerequisite shared Each test contains a set of PHONY targets which are prefixed with the name of
environments for each of the tests. These scripts both contain lines which set the tool being tested and an underscore. The first target is tests, which
the shell to write all commands run in them (-x) and to fail if any command depends on all the other targets in the test file. These test files are each
fails (-e). See set(1p) for more information. included in the top Makefile, so they can be called from the root of the
repository. This also means that BIN can be set manually so that tests can be
run using make(1) inside of the tests directory:
Both sets of tests also inherit the environment set by the test.sh script, which $ make -f tests.mk BIN=../build/bin dj_tests
sets the $BIN environment variable to the bin directory at the root of the
project for easy and idiomatic access to the built Harakit binaries. When
calling the POSIX test scripts, test.sh also sets the variable $realutil to be
the absolute path to the currently tested utilitys counterpart on the system.
[0] <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282>
-- --
Copyright © 2024 Emma Tebibyte <emma@tebibyte.media> Copyright © 2024 Emma Tebibyte <emma@tebibyte.media>