Skip to content

Commit

Permalink
openssh: put tests into passthru
Browse files Browse the repository at this point in the history
openssh tests are very slow (they take ~30 mins because they are not
parallelized). This makes rebuilding (esp. after changes e.g. to
systemd) painful. Putting the tests into a separate derivation solves
this without losing any testing capability.

Debian does the same: https://packages.debian.org/sid/openssh-tests
  • Loading branch information
nikstur committed Jun 14, 2024
1 parent 50cb799 commit 8677517
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions nixos/release-small.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ in rec {
nginx
nodejs
openssh
opensshTest
php
postgresql
python
Expand Down Expand Up @@ -139,6 +140,7 @@ in rec {
"nixos.tests.simple"
"nixpkgs.jdk"
"nixpkgs.tests-stdenv-gcc-stageCompare"
"nixpkgs.opensshTest"
])
];
};
Expand Down
12 changes: 8 additions & 4 deletions pkgs/tools/networking/openssh/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
, isNixos ? stdenv.hostPlatform.isLinux
}:

stdenv.mkDerivation {
stdenv.mkDerivation (finalAttrs: {
inherit pname version src;

patches = [
Expand Down Expand Up @@ -111,7 +111,7 @@ stdenv.mkDerivation {

hardeningEnable = [ "pie" ];

doCheck = true;
doCheck = false;
enableParallelChecking = false;
nativeCheckInputs = [ openssl ] ++ lib.optional (!stdenv.isDarwin) hostname;
preCheck = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
Expand Down Expand Up @@ -181,7 +181,11 @@ stdenv.mkDerivation {
inherit withKerberos;
tests = {
borgbackup-integration = nixosTests.borgbackup;
openssh = nixosTests.openssh;
nixosTest = nixosTests.openssh;
openssh = finalAttrs.finalPackage.overrideAttrs (previousAttrs: {
pname = previousAttrs.pname + "-test";
doCheck = true;
});
};
};

Expand All @@ -194,4 +198,4 @@ stdenv.mkDerivation {
maintainers = (extraMeta.maintainers or []) ++ (with maintainers; [ eelco aneeshusa ]);
mainProgram = "ssh";
} // extraMeta;
}
})
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11328,6 +11328,8 @@ with pkgs;
etcDir = "/etc/ssh";
};

opensshTest = openssh.tests.openssh;

opensshWithKerberos = openssh.override {
withKerberos = true;
};
Expand Down

0 comments on commit 8677517

Please sign in to comment.