CH-TEST(1) | Charliecloud | CH-TEST(1) |
ch-test - Run some or all of the Charliecloud test suite
$ ch-test [PHASE] [--scope SCOPE] [--pack-fmt FMT] [ARGS]
Charliecloud comes with a comprehensive test suite that exercises the container workflow itself as well as a few example applications. ch-test coordinates running the test suite.
While the CLI has lots of options, the defaults are reasonable, and bare ch-test will give useful results in a few minutes on single-node, internet-connected systems with a few GB available in /var/tmp.
The test suite requires a few GB (standard scope) or tens of GB (full scope) of storage for test fixtures:
The first three are created when needed if they don’t exist, while the filesystem permissions fixtures must be created manually, in order to accommodate configurations where sudo is not available via the same login path used for running tests.
The packed and unpacked image directories specified for testing are volatile. The contents of these directories are deleted before the build and run phases, respectively.
In all four cases, when creating directories, only the final path component is created. Parent directories must already exist, i.e., ch-test uses the behavior of mkdir rather than mkdir -p.
Some of the tests exercise parallel functionality. If ch-test is run on a single node, multiple cores will be used; if in a Slurm allocation, multiple nodes too.
The subset of tests to run mostly splits along two key dimensions. The phase is which parts of the workflow to run. Different parts of the workflow can be tested on different systems by copying the necessary artifacts between them, e.g. by building images on one system and running them on another. The scope allows trading off thoroughness versus time.
PHASE must be one of the following:
If TEST is also given, then run only tests with name containing that string, skipping the others. The separator is a literal colon. If the string contains shell metacharacters such as space, you’ll need to quote the argument to protect it from the shell.
Scope is specified with:
Image format is specified with:
Default: $CH_TEST_PACK_FMT if set. Otherwise, if mksquashfs(1) is available and ch-run was built with libsquashfuse support, then squash-mount, else tar-unpack.
Additional arguments:
The tests will create, populate, and delete a new subdirectory under DIR, leaving everything else in DIR untouched.
If yes and sudo seems to be available, implies --sudo.
Implies --sudo. Default: CH_TEST_PERMDIRS if set; otherwise skip the filesystem permissions tests.
Zero if all tests passed; non-zero if any failed. For setup and teardown phases, zero if everything was created or deleted correctly, non-zero otherwise.
Bats will wait until all descendant processes finish before exiting, so if you get into a failure mode where a test sequence doesn’t clean up all its processes, ch-test will hang.
Many systems can simply use the defaults. To run the build, run, and examples phases on a single system, without the filesystem permissions tests:
$ ch-test ch-test version 0.12 ch-run: 0.12 /usr/local/bin/ch-run bats: 0.4.0 /usr/bin/bats tests: /usr/local/libexec/charliecloud/test phase: build run examples scope: standard (default) builder: docker (default) use generic sudo: no (default) unpacked images dir: /var/tmp/img (default) packed images dir: /var/tmp/tar (default) fs permissions dirs: skip (default) checking namespaces ... ok checking builder ... found: /usr/bin/docker 19.03.2 bats build.bats build_auto.bats build_post.bats
✓ documentation seems sane
✓ version number seems sane [...] All tests passed.
The next example is for a more complex setup like you might find in HPC centers:
Output has been omitted.
(mybox)$ ssh hpc-admin (hpc-admin)$ ch-test mk-perm-dirs --perm-dir /scratch/$USER/perms \
--perm-dir /home/$USER/perms (hpc-admin)$ exit (mybox)$ ch-test build --scope full (mybox)$ scp -r /var/tmp/pack hpc:/scratch/$USER/pack (mybox)$ ssh hpc (hpc)$ salloc -N2 (cn001)$ export CH_TEST_TARDIR=/scratch/$USER/pack (cn001)$ export CH_TEST_IMGDIR=/local/tmp (cn001)$ export CH_TEST_PERMDIRS="/scratch/$USER/perms /home/$USER/perms" (cn001)$ export CH_TEST_SCOPE=full (cn001)$ ch-test run (cn001)$ ch-test examples
If Charliecloud was obtained from your Linux distribution, use your distribution’s bug reporting procedures.
Otherwise, report bugs to: https://github.com/hpc/charliecloud/issues
Full documentation at: <https://hpc.github.io/charliecloud>
2014–2022, Triad National Security, LLC and others
2023-01-29 12:36 UTC | 0.31 |