threads / discuss / 54832

Perf lib sanity tests fail on OSX

Subject: Perf lib sanity tests fail on OSX

## tl;dr

4 messages between Dec 15, 2020 and Dec 22, 2020.

replies: 3people: 3as markdown or json

Sangeeta· Dec 15, 2020, 19:08 UTC · lore
Hey everyone,

The performance test, p0000-perf-lib-sanity.sh[1], is failing on my local OSX machine due to an error in the test_export of the foo variable. I think the test is failing because it is not able to export the `foo` variable using `test_export`. [1] https://github.com/git/git/blob/master/t/perf/p0000-perf-lib-sanity.sh#L26

There is also a mail[2] from Lars mentioning this that dates back to
2016. Is there someone else who has encountered this issue or knows
how to fix this?
[2] https://public-inbox.org/git/9A11C3D1-3DAC-489F-BDF9-F4D409E8D3F7@gmail.com/

Thanks and Regards, Sangeeta

Philippe Blain· Dec 16, 2020, 02:18 UTC · re: Sangeeta · lore

Re: Perf lib sanity tests fail on OSX

Hi Sangeeta,
Le 2020-12-15 à 14:08, Sangeeta a écrit :
Show 7 quoted lines
> Hey everyone,
>
> The performance test, p0000-perf-lib-sanity.sh[1], is failing on my
> local OSX machine due to an error in the test_export of the foo
> variable. I think the test is failing because it is not able to export
> the `foo` variable using `test_export`.
> [1] https://github.com/git/git/blob/master/t/perf/p0000-perf-lib-sanity.sh#L26

It is not the export per se that fails (that would be very bad news indeed), it is the shell magic in the 'test_run_perf_' function in 'perf-lib.sh' that uses a non-portable sed(1) invocation:

      set | sed -n "s'"/'/'\\\\''/g"';s/^\\($test_export_\\)/export 
'"'&'"'/p" >test_vars

As you might already know, since macOS has some BSD background/ancestry, most POSIX utilities are closer to the OpenBSD/FreeBSD versions than to their GNU/Linux counterparts.

I successfully ran p0000-perf-lib-sanity.sh on my Mac after installing the GNU version of sed using Homebrew and making sure to follow the indications in the 'Caveats' so that the sed from Homebrew is first in PATH:

      brew install gnu-sed
      export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
      ./p0000-perf-lib-sanity.sh

I do not know sed syntax enough to fix the invocation to make it portable (nor do I know if it's possible).

I've CC-ed Johannes and Lars since they were involved in the thread you mentioned.

> Thanks and Regards,
> Sangeeta
Cheers,
Philippe.

P.S. my usual email setup is broken at the moment so I'm sorry if this email is formatted wrong. P.P.S. and sorry for the re-send.

Eric Sunshine· Dec 16, 2020, 07:44 UTC · re: Philippe Blain · lore

Re: Perf lib sanity tests fail on OSX

On Tue, Dec 15, 2020 at 9:19 PM Philippe Blain <levraiphilippeblain@gmail.com> wrote:

Show 15 quoted lines
> Le 2020-12-15 à 14:08, Sangeeta a écrit :
> > The performance test, p0000-perf-lib-sanity.sh[1], is failing on my
> > local OSX machine due to an error in the test_export of the foo
> > variable. [...]
>
> It is not the export per se that fails (that would be very bad news
> indeed), it is the shell magic in the 'test_run_perf_' function in
> 'perf-lib.sh' that uses a non-portable sed(1) invocation:
>
> As you might already know, since macOS has some BSD background/ancestry,
> most POSIX utilities are closer to the OpenBSD/FreeBSD versions than to
> their GNU/Linux counterparts.
>
> I do not know sed syntax enough to fix the invocation to make it
> portable (nor do I know if it's possible).

A patch fixing the problem (correctly diagnosed by Philippe as non-portable `sed` usage) has been posted[1].

[1]: https://lore.kernel.org/git/20201216073907.62591-1-sunshine@sunshineco.com/
Sangeeta· Dec 22, 2020, 05:23 UTC · re: Eric Sunshine · lore

Re: Perf lib sanity tests fail on OSX

Hey Philippe and Eric,
Thanks for the workaround and the patch. The perf tests are now passing.

Thanks and regards, Sangeeta

On Wed, Dec 16, 2020 at 1:14 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 23 quoted lines
>
> On Tue, Dec 15, 2020 at 9:19 PM Philippe Blain
> <levraiphilippeblain@gmail.com> wrote:
> > Le 2020-12-15 à 14:08, Sangeeta a écrit :
> > > The performance test, p0000-perf-lib-sanity.sh[1], is failing on my
> > > local OSX machine due to an error in the test_export of the foo
> > > variable. [...]
> >
> > It is not the export per se that fails (that would be very bad news
> > indeed), it is the shell magic in the 'test_run_perf_' function in
> > 'perf-lib.sh' that uses a non-portable sed(1) invocation:
> >
> > As you might already know, since macOS has some BSD background/ancestry,
> > most POSIX utilities are closer to the OpenBSD/FreeBSD versions than to
> > their GNU/Linux counterparts.
> >
> > I do not know sed syntax enough to fix the invocation to make it
> > portable (nor do I know if it's possible).
>
> A patch fixing the problem (correctly diagnosed by Philippe as
> non-portable `sed` usage) has been posted[1].
>
> [1]: https://lore.kernel.org/git/20201216073907.62591-1-sunshine@sunshineco.com/

← back to recent threads