diff --git a/README.md b/README.md index 2589095a6..664ea3380 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,11 @@ Many other commands in this repo self-document via the `--help`, `--man` and ### Test After compiling, you can run the regression tests. +To run the default test sets for ksh and the build system, use: +```sh +bin/package test +``` +For ksh, use the `shtests` command direclty to control the regression test runs. Start by reading the information printed by: ```sh bin/shtests --man diff --git a/bin/package b/bin/package index f8f692edb..c2e04b26b 100755 --- a/bin/package +++ b/bin/package @@ -109,7 +109,7 @@ command=${0##*/} case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in 0123) USAGE=$' [-? -@(#)$Id: '$command$' (ksh 93u+m) 2022-01-02 $ +@(#)$Id: '$command$' (ksh 93u+m) 2022-02-24 $ ] [-author?Glenn Fowler ] [-author?Contributors to https://github.com/ksh93/ksh] @@ -215,11 +215,14 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in must contain an \begrep\b(1) expression of result lines to be ignored. \bfailed\b lists failures only and \bpath\b lists the results file path name only.] - [+test\b [ \aargument\a ... ]]?Run the regression tests for - \bksh\b. If the standard output is a terminal then the + [+test\b [ \b\adir\a\b ]]\b?Run all available default regression tests. + If the optional \adir\a argument (such as \bsrc/cmd/ksh93\b) is given, + only the tests in that directory are run. + If the standard output is a terminal then the output is also captured in \b$INSTALLROOT/lib/package/gen/test.out\b. - \bksh\b must be made before it can be tested. - All \aargument\as following \atest\a are passed to \bbin/shtests\b. + Programs must be made before they can be tested. + For \bksh\b, a separate \bshtests\b command is available that allows + passing arguments to select and tune the regression tests. See \bbin/shtests --man\b for more information.] [+use\b [ \auid\a | \apackage\a | . [ 32 | 64 ]] | 32 | 64 | - ]] [ command ...]]?Run \acommand\a, or an interactive shell if \acommand\a is omitted, @@ -471,12 +474,15 @@ DESCRIPTION $HOME/.pkgresults, if it exists, must contain an egrep(1) expression of result lines to be ignored. failed lists failures only and path lists the results file path name only. - test [ argument ... ] - Run the regression tests for ksh. If the standard output is a - terminal then the output is also captured in - $INSTALLROOT/lib/package/gen/test.out. ksh must be made before it can - be tested. All arguments following test are passed to bin/shtests. - See bin/shtests --man for more information. + test [ dir ] + Run all available default regression tests. If the optional dir + argument (such as src/cmd/ksh93) is given, only the tests in that + directory are run. If the standard output is a terminal then the + output is also captured in $INSTALLROOT/lib/package/gen/test.out. + Programs must be made before they can be tested. For ksh, a separate + shtests command is available that allows passing arguments to select + and tune the regression tests. See bin/shtests --man for more + information. use [ uid | package | . [ 32 | 64 ] | 32 | 64 | - ] [ command ...] Run command, or an interactive shell if command is omitted, with the environment initialized for using the package (can you say shared @@ -532,7 +538,7 @@ SEE ALSO mamake(1), pax(1), pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3) IMPLEMENTATION - version package (ksh 93u+m) 2022-01-02 + version package (ksh 93u+m) 2022-02-24 author Glenn Fowler author Contributors to https://github.com/ksh93/ksh copyright (c) 1994-2012 AT&T Intellectual Property @@ -3522,8 +3528,12 @@ results)set '' $target esac ;; -test) # pass control to ksh 93u+m test script - capture "$SHELL" "$PACKAGEROOT/bin/shtests" $args +test) # run all available default regression tests + cd "$INSTALLROOT" || err_out "run '$0 make' first" + set -f + set -- ${args:-src} + cd "$1" || exit + capture mamake test ;; use) # finalize the environment diff --git a/src/Mamfile b/src/Mamfile index fdf8ec6f0..371669a00 100644 --- a/src/Mamfile +++ b/src/Mamfile @@ -9,8 +9,10 @@ note * documented in Glenn Fowler's paper "A Make Abstract Machine": note * http://web.archive.org/web/20041227143022/http://www2.research.att.com/~gsf/mam/mam.html note * note source level :MAKE: equivalent -make install - make all - exec - ${MAMAKE} -r '*/*' ${MAMAKEARGS} - done all virtual -done install virtual +make test + make install + make all + exec - ${MAMAKE} -r '*/*' ${MAMAKEARGS} + done all virtual + done install virtual +done test virtual diff --git a/src/cmd/INIT/package.sh b/src/cmd/INIT/package.sh index f8f692edb..c2e04b26b 100644 --- a/src/cmd/INIT/package.sh +++ b/src/cmd/INIT/package.sh @@ -109,7 +109,7 @@ command=${0##*/} case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in 0123) USAGE=$' [-? -@(#)$Id: '$command$' (ksh 93u+m) 2022-01-02 $ +@(#)$Id: '$command$' (ksh 93u+m) 2022-02-24 $ ] [-author?Glenn Fowler ] [-author?Contributors to https://github.com/ksh93/ksh] @@ -215,11 +215,14 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in must contain an \begrep\b(1) expression of result lines to be ignored. \bfailed\b lists failures only and \bpath\b lists the results file path name only.] - [+test\b [ \aargument\a ... ]]?Run the regression tests for - \bksh\b. If the standard output is a terminal then the + [+test\b [ \b\adir\a\b ]]\b?Run all available default regression tests. + If the optional \adir\a argument (such as \bsrc/cmd/ksh93\b) is given, + only the tests in that directory are run. + If the standard output is a terminal then the output is also captured in \b$INSTALLROOT/lib/package/gen/test.out\b. - \bksh\b must be made before it can be tested. - All \aargument\as following \atest\a are passed to \bbin/shtests\b. + Programs must be made before they can be tested. + For \bksh\b, a separate \bshtests\b command is available that allows + passing arguments to select and tune the regression tests. See \bbin/shtests --man\b for more information.] [+use\b [ \auid\a | \apackage\a | . [ 32 | 64 ]] | 32 | 64 | - ]] [ command ...]]?Run \acommand\a, or an interactive shell if \acommand\a is omitted, @@ -471,12 +474,15 @@ DESCRIPTION $HOME/.pkgresults, if it exists, must contain an egrep(1) expression of result lines to be ignored. failed lists failures only and path lists the results file path name only. - test [ argument ... ] - Run the regression tests for ksh. If the standard output is a - terminal then the output is also captured in - $INSTALLROOT/lib/package/gen/test.out. ksh must be made before it can - be tested. All arguments following test are passed to bin/shtests. - See bin/shtests --man for more information. + test [ dir ] + Run all available default regression tests. If the optional dir + argument (such as src/cmd/ksh93) is given, only the tests in that + directory are run. If the standard output is a terminal then the + output is also captured in $INSTALLROOT/lib/package/gen/test.out. + Programs must be made before they can be tested. For ksh, a separate + shtests command is available that allows passing arguments to select + and tune the regression tests. See bin/shtests --man for more + information. use [ uid | package | . [ 32 | 64 ] | 32 | 64 | - ] [ command ...] Run command, or an interactive shell if command is omitted, with the environment initialized for using the package (can you say shared @@ -532,7 +538,7 @@ SEE ALSO mamake(1), pax(1), pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3) IMPLEMENTATION - version package (ksh 93u+m) 2022-01-02 + version package (ksh 93u+m) 2022-02-24 author Glenn Fowler author Contributors to https://github.com/ksh93/ksh copyright (c) 1994-2012 AT&T Intellectual Property @@ -3522,8 +3528,12 @@ results)set '' $target esac ;; -test) # pass control to ksh 93u+m test script - capture "$SHELL" "$PACKAGEROOT/bin/shtests" $args +test) # run all available default regression tests + cd "$INSTALLROOT" || err_out "run '$0 make' first" + set -f + set -- ${args:-src} + cd "$1" || exit + capture mamake test ;; use) # finalize the environment diff --git a/src/cmd/Mamfile b/src/cmd/Mamfile index 3d2449604..d0d408ce8 100644 --- a/src/cmd/Mamfile +++ b/src/cmd/Mamfile @@ -9,8 +9,10 @@ note * documented in Glenn Fowler's paper "A Make Abstract Machine": note * http://web.archive.org/web/20041227143022/http://www2.research.att.com/~gsf/mam/mam.html note * note component level :MAKE: equivalent -make install - make all - exec - ${MAMAKE} -r '*' ${MAMAKEARGS} - done all virtual -done install virtual +make test + make install + make all + exec - ${MAMAKE} -r '*' ${MAMAKEARGS} + done all virtual + done install virtual +done test virtual diff --git a/src/cmd/builtin/Mamfile b/src/cmd/builtin/Mamfile index 4f2993ed2..16974ae54 100644 --- a/src/cmd/builtin/Mamfile +++ b/src/cmd/builtin/Mamfile @@ -67,3 +67,5 @@ make install exec - fi done ${INSTALLROOT}/bin virtual done install virtual +make test +done test dontcare virtual diff --git a/src/cmd/ksh93/Mamfile b/src/cmd/ksh93/Mamfile index 80f7132d1..f92531274 100644 --- a/src/cmd/ksh93/Mamfile +++ b/src/cmd/ksh93/Mamfile @@ -1556,9 +1556,7 @@ make test prev ksh make tests/shtests done tests/shtests - exec - silent cmp 2>/dev/null -s ${INSTALLROOT}/bin/ksh ksh 2>/dev/null || - exec - echo "make install to run the tests on the latest ksh" >&2 - exec - cd - exec - SHELL=${INSTALLROOT}/bin/ksh ${INSTALLROOT}/bin/ksh shtests + exec - cd "$PACKAGEROOT/src/cmd/ksh93/tests" + exec - SHELL=$INSTALLROOT/bin/ksh "$INSTALLROOT/bin/ksh" ./shtests done test.ksh virtual done test dontcare virtual diff --git a/src/lib/Mamfile b/src/lib/Mamfile index 3d2449604..d0d408ce8 100644 --- a/src/lib/Mamfile +++ b/src/lib/Mamfile @@ -9,8 +9,10 @@ note * documented in Glenn Fowler's paper "A Make Abstract Machine": note * http://web.archive.org/web/20041227143022/http://www2.research.att.com/~gsf/mam/mam.html note * note component level :MAKE: equivalent -make install - make all - exec - ${MAMAKE} -r '*' ${MAMAKEARGS} - done all virtual -done install virtual +make test + make install + make all + exec - ${MAMAKE} -r '*' ${MAMAKEARGS} + done all virtual + done install virtual +done test virtual