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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 5 Jul 2023 at 21:53, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Martin Ågren <martin.agren@xxxxxxxxx> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux