Re: [PATCH v5 26/26] t7700: stop losing return codes of git commands
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Nov 30, 2019, 11:31 UTC
- Message-ID
- <CAPig+cQ38J_0wHLw0CuhSdWBBEP-RuAchgG014GPHiSp6QOpsQ@mail.gmail.com>
- In-Reply-To
- <20191130104812.GA18401@danh.dev>
On Sat, Nov 30, 2019 at 5:48 AM Danh Doan <congdanhqx@gmail.com> wrote:
> On 2019-11-27 11:54:04-0800, Denton Liu <liu.denton@gmail.com> wrote: > > + ! grep "^$coid " packlist && > > I think we want to use test_must_fail instead of !
test_must_fail() is intended only for use with 'git' commands; "!" should be used otherwise. Quoting from t/README:
Don't use '! git cmd' when you want to make sure the git command
exits with failure in a controlled way by calling "die()". Instead,
use 'test_must_fail git cmd'. This will signal a failure if git
dies in an unexpected way (e.g. segfault). On the other hand, don't use test_must_fail for running regular
platform commands; just use '! cmd'. We are not in the business
of verifying that the world given to us sanely works.So, Denton's use of "!" here is correct.