# Perf lib sanity tests fail on OSX

4 messages from 2020-12-15 to 2020-12-22. Participants: Sangeeta, Philippe Blain, Eric Sunshine.
Thread: https://gitlist.dev/t/54832

## Sangeeta, 2020-12-15 19:08

Subject: Perf lib sanity tests fail on OSX
Message-ID: <CAHjREB6QrR-FQzwOphgw1z1Rba=o7gNvEwomHc60aNH3EkQg5A@mail.gmail.com>
URL: https://gitlist.dev/e/CAHjREB6QrR-FQzwOphgw1z1Rba%3Do7gNvEwomHc60aNH3EkQg5A%40mail.gmail.com

```
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, 2020-12-16 02:18

Subject: Re: Perf lib sanity tests fail on OSX
Message-ID: <fde32488-97e7-55f3-86d5-25f525492844@gmail.com>
URL: https://gitlist.dev/e/fde32488-97e7-55f3-86d5-25f525492844%40gmail.com
In-Reply-To: <CAHjREB6QrR-FQzwOphgw1z1Rba=o7gNvEwomHc60aNH3EkQg5A@mail.gmail.com>

```
Hi Sangeeta,

Le 2020-12-15 à 14:08, Sangeeta a écrit :

> 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, 2020-12-16 07:44

Subject: Re: Perf lib sanity tests fail on OSX
Message-ID: <CAPig+cSh0L3RniJpEs3oddkzPGUyw5Ud39SAbYFoxwtBowLiaQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcSh0L3RniJpEs3oddkzPGUyw5Ud39SAbYFoxwtBowLiaQ%40mail.gmail.com
In-Reply-To: <fde32488-97e7-55f3-86d5-25f525492844@gmail.com>

```
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/

```

## Sangeeta, 2020-12-22 05:23

Subject: Re: Perf lib sanity tests fail on OSX
Message-ID: <CAHjREB6y_zr-TrEsQu5MpwegpSHg_5XxWLf0O_HFRrSg+sFvQg@mail.gmail.com>
URL: https://gitlist.dev/e/CAHjREB6y_zr-TrEsQu5MpwegpSHg_5XxWLf0O_HFRrSg%2BsFvQg%40mail.gmail.com
In-Reply-To: <CAPig+cSh0L3RniJpEs3oddkzPGUyw5Ud39SAbYFoxwtBowLiaQ@mail.gmail.com>

```
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:
>
> 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/

```
