[PATCH v2] tests: enhance run.sh usage error diagnostics

Dmitry V. Levin ldv at altlinux.org
Mon Dec 25 12:49:34 UTC 2017


On Sun, Dec 24, 2017 at 12:31:36PM +0530, Harsha Sharma wrote:
> * tests/run.sh: execute timeout command only when invoked with an
> argument else print an error message
> 
> Changes in v2:
> * Change commit and log message
> * Print error to stderr and exit with 1
> 
> Signed-off-by: Harsha Sharma <harshasharmaiitr at gmail.com>
> ---
>  tests/run.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/run.sh b/tests/run.sh
> index d1b796ca..9a98c563 100755
> --- a/tests/run.sh
> +++ b/tests/run.sh
> @@ -9,4 +9,9 @@ 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" 1>&2
> +	exit 1
> +else
> +	exec $TIMEOUT "$@"
> +fi

Applied with very minor tweaks, thanks.


-- 
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/20171225/734b6536/attachment.bin>


More information about the Strace-devel mailing list