git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] [RFC] tests: add test_todo() to mark known breakages

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 7, 2022, 12:08 UTC
Message-ID
<221207.86cz8v9zsl.gmgdl@evledraar.gmail.com>
In-Reply-To
<07d963f0-45f2-ed8e-ea08-bcea14386a4d@github.com>
On Tue, Dec 06 2022, Victoria Dye wrote:
Show 52 quoted lines
> Phillip Wood via GitGitGadget wrote:
>> From: Phillip Wood <phillip.wood@dunelm.org.uk>
>> 
>> test_todo() is intended as a fine grained replacement for
>> test_expect_failure(). Rather than marking the whole test as failing
>> test_todo() is used to mark individual failing commands within a
>> test. This approach to writing failing tests allows us to detect
>> unexpected failures that are hidden by test_expect_failure().
>
> I love this idea! I've nearly been burned a couple of times by the wrong
> line in a 'test_expect_failure' triggering the error (e.g., due to bad
> syntax earlier in the test). The added specificity of 'test_todo' will help
> both reviewers and people fixing the underlying issues demonstrated by
> expected-failing tests.
>
>> 
>> Failing commands are reported by the test harness in the same way as
>> test_expect_failure() so there is no change in output when migrating
>> from test_expect_failure() to test_todo(). If a command marked with
>> test_todo() succeeds then the test will fail. This is designed to make
>> it easier to see when a command starts succeeding in our CI compared
>> to using test_expect_failure() where it is easy to fix a failing test
>> case and not realize it.
>> 
>> test_todo() is built upon test_expect_failure() but accepts commands
>> starting with test_* in addition to git. As our test_* assertions use
>> BUG() to signal usage errors any such error will not be hidden by
>> test_todo().
>
> Should this be so restrictive? I think 'test_todo' would need to handle any
> arbitrary command (mostly because of custom functions like
> 'ensure_not_expanded' in 't1092') to be an easy-to-use drop-in replacement
> for 'test_expect_failure'. 
>
> I see there's some related discussion in another subthread [1], but I don't
> necessarily think removing restrictions (i.e. that the tested command must
> be 'git', 'test_*', etc.) on 'test_todo' requires doing the same for
> 'test_must_fail' et al. to be internally consistent. On one hand,
> 'test_todo' could be interpreted as an assertion (like 'test_must_fail'),
> where we only want to assert on our code - hence the restrictions. From that
> perspective, it would make sense to ease restrictions uniformly on all of
> our assertion helpers. 
>
> On the other hand, I'm interpreting 'test_todo' as
> 'test_expect_failure_on_line_N' - more of a "post-test result interpreter"
> than an assertion helper. So because 'test_expect_failure' doesn't require
> the failing line to come from a particular command, I don't think
> 'test_todo' needs to either. That leaves assertion helpers like
> 'test_must_fail' out of the scope of this change, avoiding any hairiness of
> allowing them to assert on arbitrary code.
>
> What do you think?

Are you saying that for the "test_todo" we shouldn't care whether it exits with a "normal" non-zero or a segfault, abort() (e.g. BUG()) etc? That's what the "test_must_fail" v.s. "!" is about.

Even if we erased tat distinction I think such a thing would be a marginal improvement on "test_expect_failure", as we'd at least mark what line fails, but like "test_expect_failure" we'd accept segfaults as failures.

but as noted in the upthread discussions I think we should do better and still check for segfaults etc. I think we have a couple of "test_expect_failure" now where we expect a segfault, but for the rest we'd like to know if they start segfaulting.

Previous: Victoria DyeNext: Phillip Wood
Message 7 of 20 in “[RFC] tests: add test_todo() for known failures”
  1. 0/3 [RFC] tests: add test_todo() for known failuresPhillip Wood via GitGitGadget, Oct 6, 2022
  2. 1/3 [RFC] tests: add test_todo() to mark known breakagesPhillip Wood via GitGitGadget, Oct 6, 2022
  3. Ævar Arnfjörð BjarmasonOct 6, 2022
  4. Phillip WoodOct 6, 2022
  5. Ævar Arnfjörð BjarmasonOct 6, 2022
  6. Victoria DyeDec 6, 2022
  7. Ævar Arnfjörð BjarmasonDec 7, 2022
  8. Phillip WoodDec 8, 2022
  9. Junio C HamanoDec 9, 2022
  10. Phillip WoodDec 9, 2022
  11. 2/3 [RFC] test_todo: allow [!] grep as the commandPhillip Wood via GitGitGadget, Oct 6, 2022
  12. Ævar Arnfjörð BjarmasonOct 6, 2022
  13. Phillip WoodOct 6, 2022
  14. Ævar Arnfjörð BjarmasonOct 6, 2022
  15. 3/3 [RFC] test_todo: allow [verbose] test as the commandPhillip Wood via GitGitGadget, Oct 6, 2022
  16. Ævar Arnfjörð BjarmasonOct 6, 2022
  17. Junio C HamanoOct 6, 2022
  18. Ævar Arnfjörð BjarmasonOct 6, 2022
  19. Phillip WoodOct 7, 2022
  20. Junio C HamanoOct 7, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.