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

test-utilities: version test #121896

Merged
merged 1 commit into from
May 7, 2021

Conversation

raboof
Copy link
Member

@raboof raboof commented May 6, 2021

Motivation for this change

Make adding version tests more likely by making it easier, as
discussed in #119636 (comment)

Long-term I hope 'upstreaming' the tests could replace the functionality
in nixpkgs-update as discussed in
nix-community/nixpkgs-update#260

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@raboof raboof force-pushed the extract-version-test-to-utility branch from 88dbc60 to 95a5897 Compare May 6, 2021 08:20
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels May 6, 2021
@raboof raboof force-pushed the extract-version-test-to-utility branch from 95a5897 to ea2d1cb Compare May 6, 2021 08:49
@raboof raboof requested a review from roberth May 6, 2021 08:49
pkgs/build-support/test-utilities.nix Outdated Show resolved Hide resolved
pkgs/top-level/stage.nix Outdated Show resolved Hide resolved
pkgs/top-level/stage.nix Outdated Show resolved Hide resolved
@raboof raboof force-pushed the extract-version-test-to-utility branch from ea2d1cb to d374a01 Compare May 6, 2021 10:41
@raboof raboof requested a review from roberth May 6, 2021 10:41
{ package,
command ? "${package.pname or package.name} --version",
version ? package.version,
}: runCommand "test-version" { buildInputs = [ package ]; meta.timeout = 60; } ''
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
}: runCommand "test-version" { buildInputs = [ package ]; meta.timeout = 60; } ''
}: runCommand "test-version" { nativeBuildInputs = [ package ]; meta.timeout = 60; } ''

buildInputs is for components (linking etc) and not for running. With cross compilation and in the future with strictDeps, these components will not be added to PATH.

@Ericson2314 do you think it's feasible to send this to a remote builder in case of cross compilation? Do we an attribute à la pkgs.buildPackages for this purpose? (I've tried hostP{ackages,*}, remoteP*, testP*)

You'd need a remote builder, but that's better than not being able to run this at all.

@raboof raboof force-pushed the extract-version-test-to-utility branch from d374a01 to e195ed2 Compare May 6, 2021 12:28
@raboof raboof requested a review from roberth May 6, 2021 12:30
@raboof raboof force-pushed the extract-version-test-to-utility branch from e195ed2 to a22412f Compare May 6, 2021 13:59
@raboof raboof requested a review from OPNA2608 May 6, 2021 14:09
Extract 'version test' to a reusable test utility as discussed in
NixOS#119636 (comment) and
@raboof raboof force-pushed the extract-version-test-to-utility branch from a22412f to b68130f Compare May 7, 2021 07:54
@raboof raboof requested a review from roberth May 7, 2021 07:54
@davidak
Copy link
Member

davidak commented May 3, 2022

Haven't seen this until now. This is awesome. Thank you very much! ✨

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/improve-the-jdk-infrastructure-on-nixpkgs/45678/33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants