Re: [PATCH 00/15] tests: don't ignore "git" exit codes
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Mar 4, 2022, 06:57 UTC
- Message-ID
- <220304.86zgm6fbk3.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <xmqqlexq4et6.fsf@gitster.g>
On Thu, Mar 03 2022, Junio C Hamano wrote:
Show 15 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> Yes, it returns the correct status code, but that doesn't help with
>> (pseudo)code like:
>>
>> if (run_command("foo")) /* exits with e.g. 123 */
>> die("oh no, foo failed"); /* exits with 128 */
>>
>> I should have said "code using run-command.c does not do that...",
>> sorry.
>
> Yeah, but even if callers of run_command() can tell "foo"
> segfaulted, I do not think it is sensible to exit as if we
> segfaulted (or, we _could_ actually die by segfaulting ourselves,
> which is worse).I should have made it clear that I'm thinking about this as a test-only mode, so hidden behind some GIT_TEST_* variable, i.e. as a means to an end in getting the test suite to spot the failure in the sub-process.
It's not the only way to do it, but it's the simplest and most reliable given how our tests are run.