Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow output changes in installCheckPhase #303361

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

roberth
Copy link
Member

@roberth roberth commented Apr 11, 2024

Description of changes

  • Spot installation script problems and avoid tests polluting the installation.
  • Add tests.setup which runs quicker than tests.stdenv. cc @Artturin

This will indicate errors in the install script fixed up by the installed software, or software or configuration that relies on a writable installation directory.

NOTE: this only works for derivations which use the installCheck phase as intended. Some language integrations, like pythonPackages, need to call the new functions on their own.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

This will indicate errors in the install script fixed up by the
installed software, or software or configuration that relies on
a writable installation directory.
@roberth roberth requested review from Artturin and removed request for Ericson2314 April 11, 2024 13:29
@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Apr 11, 2024
@roberth roberth changed the title Disallow output changes in install check Disallow output changes in installCheckPhase Apr 11, 2024
@roberth roberth added 0.kind: enhancement 6.topic: testing Tooling for automated testing of packages and modules labels Apr 11, 2024
Comment on lines 91 to 109
# NB: ^^^^^^
# `import` and not `callPackage`, because we manipulate the whole `pkgs`
# so that we can unit test without rebuilding everything; see setup/default.nix.
basePkgs =
if ! pkgs.config?baseCommit then pkgs
else import ../.. {
inherit (pkgs.stdenv.hostPlatform) system;
config = {
setupScript = "${
let oldPkgsStr = builtins.fetchGit { url = ../..; ref = pkgs.config.baseCommit; };
oldPkgsPath = /. + builtins.unsafeDiscardStringContext (oldPkgsStr);
in oldPkgsPath + "/pkgs/stdenv/generic/setup.sh"
}";
};
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine other tests might start using this at some point :)

Since the previous commit is already a mass-rebuild, I've taken the
opportunity to add important documentation to setup.sh.
@infinisil infinisil force-pushed the disallow-output-changes-in-installCheck branch from 4829c07 to 07e3b36 Compare May 25, 2024 16:40
@github-actions github-actions bot removed the 6.topic: testing Tooling for automated testing of packages and modules label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants