Unverified Commit caaf0ad3 authored by Wolfgang Walther's avatar Wolfgang Walther Committed by GitHub
Browse files

postgresql{,TestHook}: avoid running postgresql during builds on darwin (#392430)

parents fa1261dc 98d6d2a7
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
{ callPackage, makeSetupHook }:
{
  callPackage,
  makeSetupHook,
  stdenv,
}:

makeSetupHook {
  name = "postgresql-test-hook";
  passthru.tests = {
    simple = callPackage ./test.nix { };
  };
  # See comment in postgresql's generic.nix doInstallCheck section.
  meta.broken = stdenv.hostPlatform.isDarwin;
} ./postgresql-test-hook.sh
+4 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ buildPythonPackage rec {
  };

  # sandboxing issues on aarch64-darwin, see https://github.com/NixOS/nixpkgs/issues/198495
  doCheck = postgresql.doCheck;
  doCheck = postgresql.doInstallCheck;

  # required for compatibility with Python versions older than 3.11
  # see https://github.com/MagicStack/asyncpg/blob/v0.29.0/asyncpg/_asyncio_compat.py#L13
@@ -42,6 +42,9 @@ buildPythonPackage rec {
    rm -rf asyncpg/
  '';

  # https://github.com/MagicStack/asyncpg/issues/1236
  disabledTests = [ "test_connect_params" ];

  pythonImportsCheck = [ "asyncpg" ];

  meta = with lib; {
+8 −5
Original line number Diff line number Diff line
@@ -395,12 +395,15 @@ let
      doInstallCheck =
        !(stdenv'.hostPlatform.isStatic)
        &&
          # Tests just get stuck on macOS 14.x for v13 and v14
          !(stdenv'.hostPlatform.isDarwin && olderThan "15")
        &&
          # x86: Likely due to rosetta emulation:
          # Tests currently can't be run on darwin, because of a Nix bug:
          # https://github.com/NixOS/nix/issues/12548
          # https://git.lix.systems/lix-project/lix/issues/691
          # The error appears as this in the initdb logs:
          #   FATAL:  could not create shared memory segment: Cannot allocate memory
          # aarch64: not sure why, e.g. https://hydra.nixos.org/build/292573408/nixlog/7
          # Don't let yourself be fooled when trying to remove this condition: Running
          # the tests works fine most of the time. But once the tests (or any package using
          # postgresqlTestHook) fails on the same machine for a few times, enough IPC objects
          # will be stuck around, and any future builds with the tests enabled *will* fail.
          !(stdenv'.hostPlatform.isDarwin);
      installCheckTarget = "check-world";

+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ pythonPackages.buildPythonApplication rec {
  ];

  # sandboxing issues on aarch64-darwin, see https://github.com/NixOS/nixpkgs/issues/198495
  doCheck = postgresql.doCheck;
  doCheck = !postgresqlTestHook.meta.broken;

  checkPhase = ''
    runHook preCheck