Skip to content

Commit

Permalink
gnugrep: enable tests on x64 darwin
Browse files Browse the repository at this point in the history
disable one test, stack-overflow, which fails on rosetta2 and enable
the rest.
  • Loading branch information
paparodeo committed Nov 25, 2024
1 parent 38eefea commit 4e5f61b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkgs/tools/text/gnugrep/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ stdenv.mkDerivation {
hash = "sha256-HbKu3eidDepCsW2VKPiUyNFdrk4ZC1muzHj1qVEnbqs=";
};

postPatch = let
isX64Darwin = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64;
in
# Some gnulib tests fail
# - on Musl: https://github.com/NixOS/nixpkgs/pull/228714
# - on x86_64-darwin: https://github.com/NixOS/nixpkgs/pull/228714#issuecomment-1576826330
postPatch = if stdenv.hostPlatform.isMusl || (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) then ''
lib.optionalString (stdenv.hostPlatform.isMusl || isX64Darwin) ''
sed -i 's:gnulib-tests::g' Makefile.in
'' else null;
''
# x86_64-darwin: fails 'stack-overflow' tests on Rosetta 2 emulator
+ lib.optionalString isX64Darwin ''
sed -i 1a'exit 0' tests/stack-overflow
'';

nativeCheckInputs = [ perl glibcLocales ];
outputs = [ "out" "info" ]; # the man pages are rather small
Expand All @@ -31,8 +38,9 @@ stdenv.mkDerivation {

# cygwin: FAIL: multibyte-white-space
# freebsd: FAIL mb-non-UTF8-performance
# x86_64-darwin: fails 'stack-overflow' tests on Rosetta 2 emulator
doCheck = !stdenv.hostPlatform.isCygwin && !stdenv.hostPlatform.isFreeBSD && !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) && !stdenv.buildPlatform.isRiscV64;
doCheck = !stdenv.hostPlatform.isCygwin
&& !stdenv.hostPlatform.isFreeBSD
&& !stdenv.buildPlatform.isRiscV64;

# On macOS, force use of mkdir -p, since Grep's fallback
# (./install-sh) is broken.
Expand Down

0 comments on commit 4e5f61b

Please sign in to comment.