From 576367ff1021a79f22c7a50cbcc1bb01e690595e Mon Sep 17 00:00:00 2001 From: kn Date: Sun, 16 Oct 2022 08:49:03 +0000 Subject: [PATCH] Always pass the test program as PROG env var, fix synopsis The ./th perl script always runs -p prog (KSH in Makefile) as the shell, but cannot signal it other than the optional SIGKILL after `time-limit'. Implementing time-related signal handling in ./th seems overkill, so always pass the program as PROG in the environment so it can wrap itself, e.g. description: simluate interrupting a script stdin: timeout --signal SIGINT --preserve-status -- 1s $PROG -c ' actual test script getting ^C after one second... ' Avoiding hard-coded programs in tests with PROG allows testing different shells through `make KSH=/path/to/sh' without changing or adding shell specific tests. While here, make -p and -s as mandatory in usage as ./th `die's if they're not passed (allowing to always just pass -p's argument as PROG). --- regress/bin/ksh/th | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/regress/bin/ksh/th b/regress/bin/ksh/th index 682503d5345..2185007cc0d 100644 --- a/regress/bin/ksh/th +++ b/regress/bin/ksh/th @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $OpenBSD: th,v 1.3 2021/09/02 07:14:15 jasper Exp $ +# $OpenBSD: th,v 1.4 2022/10/16 08:49:03 kn Exp $ # @@ -56,9 +56,11 @@ # missing, NAME is removed from the # environment. Programs are run with # the following minimal environment: -# USER, LOGNAME, HOME, PATH, SHELL +# USER, LOGNAME, HOME, PATH, SHELL, +# PROG # (values from the current environment # takes higher precedence). +# PROG always contains the -p argument. # file-setup mps Used to create files, directories # and symlinks. First word is either # file, dir or symlink; second word is @@ -139,7 +141,7 @@ $os = defined $^O ? $^O : 'unknown'; ($prog = $0) =~ s#.*/##; $Usage = <