Re: [PATCH 2/2] tests: make test_must_fail fail on missing commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> The point of it is to run a command that produces failure. A
> missing command is more likely an error in the test script
> (e.g., using 'test_must_fail "command with arguments"', or
> relying on a missing command).
>
> Signed-off-by: Jeff King <peff@xxxxxxxx>
> ---
>  t/test-lib.sh |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 285bfd8..dbb13af 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -598,6 +598,9 @@ test_must_fail () {
>  	elif test $exit_code -gt 129 -a $exit_code -le 192; then
>  		echo >&2 "test_must_fail: died by signal: $*"
>  		return 1
> +	elif test $exit_code = 127; then
> +		echo >&2 "test_must_fail: command not found: $*"
> +		return 1
>  	fi

Hmm.  One worry is that if we ever exit(127) ourselves this would be
confused, but hopefully we are not that clueless.



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]