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

Re: [PATCH v3] t0091-bugreport.sh: actually verify some content of report

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
Jul 7, 2023, 12:26 UTC
Message-ID
<CAN0heSpY-vYVFznq9YLtjj0Enmf957ASCLdN_Eyz0ZLKd82FWg@mail.gmail.com>
In-Reply-To
<xmqqv8eyyw2g.fsf@gitster.g>
On Wed, 5 Jul 2023 at 21:53, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
>
> Martin Ågren <martin.agren@gmail.com> writes:
>
> > +test_expect_success 'sanity check "System Info" section' '
> > +     test_when_finished rm -f git-bugreport-format.txt &&
> > +
> > +     sed -ne "/^\[System Info\]$/,/^$/p" <git-bugreport-format.txt >system &&
> > +
> > +     # The beginning should match "git version --build-info" verbatim,
> > +     # but rather than checking bit-for-bit equality, just test some basics.
> > +     grep "git version [0-9]." system &&
> > +     grep "shell-path: ." system &&
> > +
> > +     # After the version, there should be some more info.
>
> Do you want to assert the "after" part?  "grep" alone does not do
> anything of that sort.

Right, I remember thinking this 'after' could be useful to a human being reading along, but that the test isn't enforcing it, as you point out. If it's just misleading though, maybe we're better off either dropping the "After" or enforcing it.

Show 15 quoted lines
> > +     # This is bound to differ from environment to environment,
> > +     # so we just do some rather high-level checks.
> > +     grep "uname: ." system &&
> > +     grep "compiler info: ." system
> >  '
>
> Don't we at least want to anchor all these patterns with "^" or
> something?
>
> Alternatively, since we do not expect the values of the fields are useful
> at all, perhaps doing something like this
>
>     sed -n -e '/^\[System Info\]/,/\[Enabled Hooks]/s/^\([^:]*):.*/\1/p' >names
>
> to ensure that we have the fields we expect in the output makes more sense?

The latter would make sense, yes. I could amend the patch to do something like that, but I see you've already merged it to next. I'll look into doing it as a patch on top during the weekend.

> I notice that "git version:" does not have its value on its line.
> Isn't it a bug we would rather fix before writing this "sanity check"
> test, I have to wonder.
Yeah, I noticed this. In my case, there's this:
 git version:
 git version 2.41.0.428.gbd0ef4c9fd
 cpu: x86_64
 built from commit: bd0ef4c9fd591e9c2ea1310dae92fe07a51438c7
 sizeof-long: 8
 sizeof-size_t: 8
 shell-path: /bin/sh
 uname: [...]
 [...]

IMHO, "git version: git version 2.41.0.428.gbd0ef4c9fd" would look sort of weird. I tend to think "git version:" is more of a header for the first several lines. It could perhaps be something like this, after adding "--build-options" and indenting its output:

 git version --build-options:
   git version 2.41.0.428.gbd0ef4c9fd
   cpu: x86_64
   built from commit: bd0ef4c9fd591e9c2ea1310dae92fe07a51438c7
   sizeof-long: 8
   sizeof-size_t: 8
   shell-path: /bin/sh
 uname: [...]
 [...]

That's how I think of the contents. Actually changing the format would be out-of-scope for the test updates, of course. I also wonder if there are scripts out there trying to parse these reports and how they would cope with such a tweak to the format.

Martin
Previous: Junio C Hamano
Message 5 of 5 in “t0091-bugreport.sh: actually verify some content of report”
  1. t0091-bugreport.sh: actually verify some content of reportMartin Ågren, Jul 5, 2023
  2. Martin ÅgrenJul 5, 2023
  3. Junio C HamanoJul 5, 2023
  4. Junio C HamanoJul 5, 2023
  5. Martin ÅgrenJul 7, 2023

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.