commit a38e689f6f85c396053e34caa82b6e4f215a0ef1 from: Sven M. Hallberg date: Sun Aug 10 13:32:28 2025 UTC add apt-tst(1) manpage commit - 7fee41a2f1cb1e5c4d3fe35b899a34767944b8aa commit + a38e689f6f85c396053e34caa82b6e4f215a0ef1 blob - 3642126b52b9dfec0da5d7ad4c46bc33cd506e6c blob + 37a2e63ad6d9960d6ab7c9f9ec11408f44fcbd0d --- TODO +++ TODO @@ -1,8 +1,6 @@ -- add man/adapt-tst.1 - add option -f to read a list of paths from a file (possibly stdin) - add option -l to list the test files found - move tests/helpers to the top level? -- organize tests/lang/c into directories - add test(s) for -j? - add test.sh that closely follows test.h (TST for shell scripts) - extend qputs to color down into further quote levels? (". . . >") blob - bbda8637d0af82035218f27d0d6ea0a8ff9454ec blob + bbacafa7764e6ada17d940084e8b62bfa6cfca8b --- man/exercise.1 +++ man/exercise.1 @@ -1,4 +1,4 @@ -.Dd July 23, 2025 +.Dd August 10, 2025 .Dt EXERCISE 1 .Os . @@ -280,8 +280,8 @@ Note the use of (shell) single quotes to embed the nec double quotes. . .Sh SEE ALSO -.Xr sh 1 , -.Xr test.h 3 +.Xr adapt-tst 1 , +.Xr test.h 5 . .Sh AUTHORS .An Sven M. Hallberg Aq Mt pesco@khjk.org blob - /dev/null blob + 80f5438430821ac9afe41bdb081f52ec9bcfddaa (mode 644) --- /dev/null +++ man/adapt-tst.1 @@ -0,0 +1,84 @@ +.Dd August 10, 2025 +.Dt ADAPT-TST 1 +.Os +. +.Sh NAME +.Nm adapt-tst +.Nd using terribly simple test suites with exercise +. +.Sh SYNOPSIS +.Nm adapt-tst +.Ar command +.Op Fl knvx +.Op Ar argument ... +. +.Sh DESCRIPTION +The +.Nm +script executes +.Ar command +and interprets its standard output in the simple format used by +.Xr test.h 5 . +It then produces status report lines as expected by +.Xr exercise 1 . +Thus it allows +.Dq terribly simple test +programs to be called as test suites from +.Cm exercise . +.Pp +The options match their +.Xr exercise 1 +counterparts and are as follows: +.Bl -tag -width Ds +.It Fl k +Keep going after a failed test. +This sets the +.Ev K +environment variable for +.Ar command . +.It Fl n +Dry run. +Do not run tests, only report their number. +.It Fl v +Verbose. +If used with +.Fl n , +also print the names of the tests. +If given twice, this sets the +.Ev V +environment variable for +.Ar command . +.It Fl x +Exit after a failed test; +this is the default. +If given twice, this sets the +.Ev X +environment variable for +.Ar command +to cause an exit immediately after any non-fatal failure. +.El +. +.Sh EXIT STATUS +The +.Nm +utility exits 0 if all tests succeed, and 1 otherwise. +. +.Sh EXAMPLES +Given a test executable +.Pa foo.tst +(built from +.Pa foo.tst.c , +say) +and assuming +.Pa adapt-tst +is in the same directory, +create the following script as +.Pa foo.ts : +.Bd -literal -offset Ds +#!/bin/sh +exec ./adapt-tst ./foo.tst "$@" +.Ed +. +.Sh SEE ALSO +.Xr exercise 1 , +.Xr test.h 5 blob - e85cc8b73d9e95efa8244bafc513506040ebc61b blob + 1c04ffdd981fcae7c868716ab47e014c5a330951 --- support/adapt-tst +++ support/adapt-tst @@ -2,15 +2,6 @@ # # This script adapts a test suite that exposes the simple report protocol of # test.h for use with exercise. -# -# Usage: adapt-tst cmd [-nv] [arg ...] -# -# Example: Given a test suite in 'foo.tst.c' that is built into an executable -# 'foo.tst', create the script 'foo.ts' containing the following: -# -# #!/bin/sh -# exec ./adapt-tst ./foo.tst "$@" -# cmd="$1" shift