All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Phillip Wood" <phillip.wood123@gmail.com>,
	"Emily Shaffer" <emilyshaffer@google.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: Re: [PATCH v3] t0091-bugreport.sh: actually verify some content of report
Date: Fri, 7 Jul 2023 14:26:33 +0200	[thread overview]
Message-ID: <CAN0heSpY-vYVFznq9YLtjj0Enmf957ASCLdN_Eyz0ZLKd82FWg@mail.gmail.com> (raw)
In-Reply-To: <xmqqv8eyyw2g.fsf@gitster.g>

On Wed, 5 Jul 2023 at 21:53, Junio C Hamano <gitster@pobox.com> wrote:
>
> 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.

> > +     # 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

  parent reply	other threads:[~2023-07-07 12:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AN0heSrMCnygWUC5Sh1UA9v2JGtjcxYDKPFE0xUPddGEW29c3w@mail.gmail.com>
2023-07-05 18:35 ` [PATCH v3] t0091-bugreport.sh: actually verify some content of report Martin Ågren
2023-07-05 18:43   ` Martin Ågren
2023-07-05 19:53   ` Junio C Hamano
2023-07-05 19:54     ` Junio C Hamano
2023-07-07 12:26     ` Martin Ågren [this message]
2023-07-05 18:31 [PATCH v2] " Martin Ågren
2023-07-05 18:40 ` [PATCH v3] " Martin Ågren
2023-07-05 19:46   ` Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN0heSpY-vYVFznq9YLtjj0Enmf957ASCLdN_Eyz0ZLKd82FWg@mail.gmail.com \
    --to=martin.agren@gmail.com \
    --cc=avarab@gmail.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood123@gmail.com \
    --cc=szeder.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.