[PATCH] tests: enhance error diagostics
Dmitry V. Levin
ldv at altlinux.org
Sat Dec 23 23:12:39 UTC 2017
On Sun, Dec 24, 2017 at 01:31:49AM +0530, Harsha Sharma wrote:
> On Sat, Dec 23, 2017 at 4:12 AM, Dmitry V. Levin <ldv at altlinux.org> wrote:
[...]
> > Why do you think this change is useful?
> >
> Executing this script without any argument gives 'Try 'timeout --help'
> for more information.' which should not be the case.
So the error diagnostics of tests/run.sh itself is misleading.
> > tests/run.sh is a part of test infrastructure,
> > is it natural to invoke this script without arguments?
> >
> No, but can help someone using it for first time.
OK.
> This patch can be dropped if change doesn't seem to be useful.
> Thanks for your review.
No, there hasn't been a review yet, I was just curious about the purpose
of this patch. The review follows.
> Subject: [PATCH] tests: enhance error diagostics
s/diagostics/diagnostics/
let's be more specific, e.g.
tests: enhance run.sh usage error diagnostics
> * tests/init.sh: execute timeout command only when run with argument
s/run with argument/invoked with an argument/
> else print error "No command or test file specified"
No need to duplicate the change in the commit message,
in particular, no need to cite the text of error diagnostics.
> Signed-off-by: Harsha Sharma <harshasharmaiitr at gmail.com>
> ---
> tests/run.sh | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tests/run.sh b/tests/run.sh
> index d1b796ca..6ff69b4d 100755
> --- a/tests/run.sh
> +++ b/tests/run.sh
> @@ -9,4 +9,8 @@ TIMEOUT="timeout -k 5 -s XCPU $TIMEOUT_DURATION"
> $TIMEOUT true > /dev/null 2>&1 ||
> TIMEOUT=
>
> -exec $TIMEOUT "$@"
> +if [ $# -eq 0 ]; then
> + echo "No command or test file specified"
Error diagnostics should be printed to stderr.
If it's an error condition, the program should exit with a non-zero
status.
> +else
> + exec $TIMEOUT "$@"
> +fi
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20171224/cbef0c7d/attachment.bin>
More information about the Strace-devel
mailing list