Skip to content

curl: run tests in passthru#178869

Merged
Artturin merged 4 commits intoNixOS:stagingfrom
Artturin:curlies
Jul 6, 2022
Merged

curl: run tests in passthru#178869
Artturin merged 4 commits intoNixOS:stagingfrom
Artturin:curlies

Conversation

@Artturin
Copy link
Member

@Artturin Artturin commented Jun 24, 2022

curl is built many times during a stdenv rebuild

they are a bottleneck

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • 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/)
  • 22.11 Release Notes (or backporting 22.05 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
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@Artturin Artturin requested a review from roberth June 24, 2022 14:37
@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 Jun 24, 2022
allows using the correct package in passthru

remove unneeded replaceStrings in urls
@Artturin Artturin requested a review from SuperSandro2000 June 24, 2022 16:26
@Artturin Artturin force-pushed the curlies branch 2 times, most recently from e73468f to 11a8dd3 Compare June 24, 2022 16:48
@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. and removed 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 Jun 24, 2022
Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

Awesome!

Copy link
Member

Choose a reason for hiding this comment

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

In the future (#176557), nixosTests.nginx-http3.extend { defaults = { /* NixOS module */ }; }

(fyi)

Copy link
Member

Choose a reason for hiding this comment

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

      fetchpatch = tests.fetchpatch.simple.override { fetchpatch = fetchpatch.override { fetchurl = useThisCurl fetchurl; }; };

where tests is pkgs.tests.

Haven't tried this, but would be pretty great to have something like this.
Also would be nice to have a direct fetchurl test. 🤷

Copy link
Member

Choose a reason for hiding this comment

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

I didn't actually want to repeat .simple here, but I don't think we have an overridePackages to complement callPackages yet. That could use recurseForDerivations to do the right thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

As rigorous as it is to ensure all these test-packages are built with this curl, I question slightly how relevant it is - most of these packages are only ever built with one curl, and may not actually build with esoteric/minimal curl builds. How is the tester to know what's supposed to build and what isn't?

It also slightly raises the question whether we're going to do this with all the reverse-dependency passthru.tests we've added. Strictly we should, but in reality it would end up with testers building all kinds of package variants that aren't usually expected.

@Artturin Artturin changed the title curl: use finalAttrs curl: run tests in passthru Jun 25, 2022
@SuperSandro2000
Copy link
Member

ofborg is failing for some reason but I cannot look it up because the log is not loading.

curl is built many times during a stdenv rebuild

they are a bottleneck
@Mindavi
Copy link
Contributor

Mindavi commented Jun 29, 2022

I knew someone would come in and change running the tests again.

See #170828 for some previous discussion and why they were enabled.

cc @risicle

ocaml-curly = ocamlPackages.curly;
php-curl = phpExtensions.curl;
pycurl = python3.pkgs.pycurl;
withCheck = finalAttrs.finalPackage.overrideAttrs (_: { doCheck = true; });
Copy link
Member

Choose a reason for hiding this comment

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

This one should be a channel blocker if it fails. It should be added to release.nix for the nixpkgs and nixos jobs.

Copy link
Member Author

Choose a reason for hiding this comment

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

not sure i did it correctly

Copy link
Member Author

Choose a reason for hiding this comment

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

error: attribute 'tests' missing

       at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/ofborg-evaluator-4/pkgs/top-level/release.nix:100:15:

           99|               jobs.stdenv.x86_64-linux
          100|               jobs.curl.tests.withCheck.x86_64-linux
             |               ^
          101|               jobs.cargo.x86_64-linux

are passthru attributes stripped?

Copy link
Member

Choose a reason for hiding this comment

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

yeah release.nix is kind of a mess (or maybe I'm unfamiliar) and it strips all packages down using hydraJobs. It's supposed to help that evaluator release memory.
If you add the passthru tests as "normal" packages somewhere in pkgs, you won't have to deal with the release.nix code as much.

Maybe do something like this in pkgs/test/default.nix?

corePackageTests = recurseIntoAttrs {
  curl = recurseIntoAttrs pkgs.curl.tests;
};

That should give you pkgs.tests.corePackageTests, which you can use in the release files.

@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Jun 29, 2022
@risicle
Copy link
Contributor

risicle commented Jun 29, 2022

Notionally approve, haven't tested.

Comment on lines 27 to 28
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
# we can't add 'nixpkgs.curl.tests' to hydra jobs due to 'passthru' being stripped
passthruTestsForChannelBlockers = recurseIntoAttrs {
# we can't add 'nixpkgs.curl.tests' to hydra jobs due to 'tests' (and 'passthru') being stripped
packageTestsForChannelBlockers = recurseIntoAttrs {

The fact that they're on a package is more significant than passthru, which is just an implementation detail of mkDerivation.

passthru was introduced in 1014ca2 (2006) and only exposed the attrs inside of it. The behavior passthru.passthru = passthru was only added later for inspection 84fba68:

to distinguish after the fact which attributes were part of the derivation and which came from passthru.

However, the root cause of any such ambiguity comes from the mistake that mkDerivation exposes all its argument attributes in the returned package attrset.

Since RFC 92, not all packages will be defined through mkDerivation anymore, so we should try not to perpetuate its jargon and keep things simple.

@SuperSandro2000
Copy link
Member

@ofborg eval

@Artturin
Copy link
Member Author

Artturin commented Jul 1, 2022

the hydra jobs for tests.packageTestsForChannelBlockers look like this

$ ./maintainers/scripts/rebuild-amount.sh  --print HEAD~1
Estimating rebuild amount by counting changed Hydra jobs (parallel=unset).
      5 x86_64-darwin
     11 x86_64-linux

nixos-install-tools.x86_64-linux                                                      /nix/store/mddaircl7p6ka6v30sl3hnbkp30xp22n-nixos-install-tools-22.11pre-git
tests.nixos-functions.nixos-test.x86_64-linux                                         /nix/store/g5wq3p43akl3c0zszp676q4nq5nyh5vv-nixos-system-nixos-test
tests.packageTestsForChannelBlockers.curl.coeurl.x86_64-darwin                        /nix/store/x3x1mq7bfd6rb8hi2r84g5n1mfafpf4h-coeurl-0.2.0
tests.packageTestsForChannelBlockers.curl.coeurl.x86_64-linux                         /nix/store/ja1wpybr47p53il1hrqnajmiisrg56si-coeurl-0.2.0
tests.packageTestsForChannelBlockers.curl.curlpp.x86_64-linux                         /nix/store/mlqrdavazq0pkfvaxz9ksr540pfy7bdb-curlpp-0.8.1
tests.packageTestsForChannelBlockers.curl.fetchpatch.x86_64-linux                     /nix/store/gh62y23d9xjx38xn4mkwfmy6gmpplyw2-source-salted-z09f6i1ny721
tests.packageTestsForChannelBlockers.curl.haskell-curl.x86_64-darwin                  doc=/nix/store/iv8lyrn13x472gxfiv4bbfx2fp007bmi-curl-1.3.8-doc;/nix/store/k2q9dm1sd7pc16ydn3xkn02h700vmkpd-curl-1.3.8
tests.packageTestsForChannelBlockers.curl.haskell-curl.x86_64-linux                   doc=/nix/store/i26k3nsqm5i4w29ywizngkmnyvd9rydd-curl-1.3.8-doc;/nix/store/8id3zbivfiiy856w24675v2i7vrsa7v7-curl-1.3.8
tests.packageTestsForChannelBlockers.curl.nginx-http3.x86_64-linux                    /nix/store/isd4bnd78js04zm4mhhxlbfbdlczf01j-vm-test-run-nginx-http3
tests.packageTestsForChannelBlockers.curl.ocaml-curly.x86_64-darwin                   /nix/store/vs7zsly4b9ynkmky48hipbvrmdamxnxa-ocaml4.13.1-curly-0.2.0
tests.packageTestsForChannelBlockers.curl.ocaml-curly.x86_64-linux                    /nix/store/pr8128y509li57qqzf6misk0a7h18ci4-ocaml4.13.1-curly-0.2.0
tests.packageTestsForChannelBlockers.curl.php-curl.x86_64-linux                       dev=/nix/store/f7pa423hkdpzqvii0xdbk7s3r0ljqczw-php-curl-8.1.7-dev;/nix/store/aijj4f0f6iskri7j0i955f6rvg7f43ls-php-curl-8.1.7
tests.packageTestsForChannelBlockers.curl.pycurl.x86_64-darwin                        /nix/store/8rim82j9akdcq55jrnaj9ggwsz6400bg-python3.10-pycurl-7.45.1
tests.packageTestsForChannelBlockers.curl.pycurl.x86_64-linux                         /nix/store/dyr6m5ac757jvgpvj72w4k6fi3i6r9n6-python3.10-pycurl-7.45.1
tests.packageTestsForChannelBlockers.curl.withCheck.x86_64-darwin                     bin=/nix/store/bc5z41yg99n8f58hjfvrcpp552n872qs-curl-7.83.1-bin;dev=/nix/store/ly0q61iaf2gfssf9aab4mqb3qrgbkil1-curl-7.83.1-dev;devdoc=/nix/store/wik2qchahxksfmdcrgamc5pmdpzhz811-curl-7.83.1-devdoc;man=/nix/store/ccrjr4z4p7l9b5c2h465xbyiwna80w6h-curl-7.83.1-man;/nix/store/81axcdapacnw0dxjrw0f00brqh2x3b9c-curl-7.83.1
tests.packageTestsForChannelBlockers.curl.withCheck.x86_64-linux                      bin=/nix/store/8w50x3ygiymlxmy36gj7y6xsg9kqvnjv-curl-7.83.1-bin;debug=/nix/store/zpf9j93lc3br13wg9adh2la9ksay0npz-curl-7.83.1-debug;dev=/nix/store/zv467z7cq9yl23igax527z64krp4vr4r-curl-7.83.1-dev;devdoc=/nix/store/qfa4ifwbm6sq11qz1q2b924nb986k2q0-curl-7.83.1-devdoc;man=/nix/store/03kkz40l7yc4qgdaf3kp4b86z6zjzzx3-curl-7.83.1-man;/nix/store/qz9lczmn7h5l9gz7yw57kjl1q7msy275-curl-7.83.1

… channel blocker

we can't add 'nixpkgs.curl.tests' to hydra jobs due to 'tests' (and 'passthru') being stripped

TODO: add a function in lib-release.nix to get derivations and add `.x86_64-linux` to them
then we can just point release files to nixpkgs.tests.packageTestsForChannelBlockers instead of
nixpkgs.tests.packageTestsForChannelBlockers.curl.withCheck
@ofborg ofborg bot added the 8.has: package (new) This PR adds a new package label Jul 2, 2022
@Artturin Artturin merged commit fb6816e into NixOS:staging Jul 6, 2022
@Artturin Artturin deleted the curlies branch July 6, 2022 14:30
@vcunat
Copy link
Member

vcunat commented Jul 11, 2022

@vcunat
Copy link
Member

vcunat commented Jul 11, 2022

BTW, this is in staging-next now, PR #181133

@Artturin
Copy link
Member Author

Artturin commented Jul 12, 2022

reverted the release tests for now in #181220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants