t: remove inappropriate uses of test_must_fail(), was Re: [PATCH v5 26/26] t7700: stop losing return codes of git commands
- From
Denton Liu <liu.denton@gmail.com>
- Date
- Dec 4, 2019, 12:59 UTC
- Message-ID
- <20191204125937.GA798672@generichostname>
- In-Reply-To
- <xmqqv9r12tbb.fsf@gitster-ct.c.googlers.com>
Hi all,
On Sat, Nov 30, 2019 at 09:00:08AM -0800, Junio C Hamano wrote:
Show 19 quoted lines
> * Or perhaps we can detect its use on anything that is not "git"
> automatically? This is merely to illustrate the idea (the
> exemption of "env" shown here is too broad for production use)
>
> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
> index b299ecc326..7ab113cd50 100644
> --- a/t/test-lib-functions.sh
> +++ b/t/test-lib-functions.sh
> @@ -828,6 +828,10 @@ test_must_fail () {
> _test_ok=
> ;;
> esac
> + case "$1" in
> + git|test-tool|env) ;;
> + *) echo >&7 "warning: test_must_fail $*???" ;;
> + esac
> "$@" 2>&7
> exit_code=$?
> if test $exit_code -eq 0 && ! list_contains "$_test_ok" successI've been cooking a series that gets rid of inappropriate uses test_must_fail() for a while now. As a finishing touch, I implemented the idea Junio suggested above and it seems to be working well.
It's a pretty hefty series, weighing in at 46 patches. After the dust settles on 'dl/test-cleanup' (once it gets merged to master), I'll probably start sending out this test_must_fail() series around 10 patches at a time.
An advanced preview can be found here[1]. Or, if you'd like me to privately mail you the series, I can do that too. Early comments would be very appreciated.
Thanks,
Denton
[1]: https://github.com/Denton-L/git/commits/ready/cleanup-test-must-fail