Table of Contents
The command line
main wraps run for scripts and CI.
(main &optional arguments)
It parses a list of strings, runs, prints, and calls sb-ext:exit with 0
when everything passed, 1 when it did not, and 2 for a usage error
(unknown flag, unknown test). arguments defaults to the program arguments
after --end-toplevel-options or --, or after the program name when neither
is present. It does not change debugger settings; run scripts under
sbcl --non-interactive or --script.
Flags
| Argument | Meaning |
|---|---|
pkg, pkg/name, pkg::name, a glob with * |
which tests to run (package and test names are case-insensitive) |
-v, --verbose |
a line per test, not only failures |
--fail-fast |
stop after the first failure |
--parallel, --parallel=N, --serial |
parallelism |
--shuffle, --seed N |
random order, or reproduce one |
--tags a,b, --exclude a,b |
tag filters (case-insensitive keywords) |
--no-capture |
let test output through instead of capturing it |
--no-color |
do not colorize |
--ascii |
use ASCII marks (ok, FAIL, ERR, skip) instead of Unicode |
--help |
usage on standard output, exit 0 |
With no selector, every test runs.
A shell entry point
sbcl --non-interactive \
--eval '(asdf:load-system "my-project/test")' \
--eval '(assay:main)' \
--end-toplevel-options my-project/test --parallel
The names after --end-toplevel-options become main's arguments.
ASDF test-op
Wire test-op to assay so asdf:test-system runs the suite and fails the
build when a test does. The system definition assay ships, and the one you copy
into your own project with the names substituted:
(defsystem "assay"
:description "Zero-dependency test framework for SBCL."
:license "MIT"
:serial t
:components ((:file "assay") (:file "mock"))
:in-order-to ((test-op (test-op "assay/test"))))
(defsystem "assay/test"
:depends-on ("assay")
:components ((:module "tests" :components ((:file "assay-test"))))
:perform (test-op (o c) (symbol-call :assay :run :assay/test :signal-on-failure t)))
:signal-on-failure t makes run signal tests-failed — an exported error
carrying the summary — after reporting, which test-op turns into a failed
build.
sbcl --non-interactive --eval '(asdf:test-system "my-project")'
Next: Parallel.