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

Run check phase by default #33599

Closed
Ericson2314 opened this issue Jan 8, 2018 · 18 comments
Closed

Run check phase by default #33599

Ericson2314 opened this issue Jan 8, 2018 · 18 comments

Comments

@Ericson2314
Copy link
Member

Ericson2314 commented Jan 8, 2018

Not sure what other distributions do, but skipping check phases by default seems to me to be slightly unseemly to me. I rather be assuming upstream tests are valid/useful than not.

Also, this makes a better solution for #30437. We can make the default doCheck ? hostPlatform == buildPlatform so that one someone rights doCheck = true; they indeed test in all cases as requested, but when they leave out doCheck altogether, only native builds get their tests run.

CC @grahamc @vcunat @globin @fpletz @dezgeg

@edolstra
Copy link
Member

edolstra commented Jan 8, 2018

👎 on this. Checks are typically very unreliable and non-deterministic. So expect massive breakage and perpetually broken channels if we enable checks by default. Also, of course, build times will increase massively.

Ericson2314 added a commit to obsidiansystems/nixpkgs that referenced this issue Jan 9, 2018
…cross compiling

I hope this will be a temporary measure. If there is consensus around
issue NixOS#33599, then we can follow an explicit `dontCheck`, but default to
not checking during cross builds when none is given.
Ericson2314 added a commit to obsidiansystems/nixpkgs that referenced this issue Jan 9, 2018
In anticipation of what I outline in NixOS#33599, I only simplify exactly those
`doCheck`s which are equal to `hostPlatform != buildPlatform`. I also stick a
comment next to them so I can grep for them later.
@oxij
Copy link
Member

oxij commented Apr 25, 2018

@Ericson2314 check out #39463.

@matthewbauer
Copy link
Member

matthewbauer commented Apr 25, 2018

In theory, this sounds good but in practice I agree that this will break a lot of things. Especially because most devs intend "make check" to only be run by them in their own environments. Maybe it would be nice to experiment with as an overlay/jobset or something.

If you think about it, each dependency listed in Nixpkgs is weird kind of integration test in its own right (if its actually used of course). I would be interested in seeing whether big distros like Debian or Arch do testing in an automatic way at all. I would bet our build farm runs more tests right now than most (of course a large userbase is the ultimate integration test).

@oxij
Copy link
Member

oxij commented Apr 25, 2018

My implementation breaks nothing, it just makes broken things explicit. If you look at #39463, then, firstly, it's enormous, and, secondly, there are at least a couple cases where there's clearly a bug in nixpkgs expression that the testing found (but I wasn't able to fix it, things that I did fix will go into a separate PR).

I wanted to implement this for a while, then I saw this issue and @edolstra's comment several months ago and though to myself "well, maybe @edolstra's right, but what if its not 'massive', surely, nobody actually tried" and decided to bite the bullet and actually run the experiment. And running the experiment turned out to be useful. Firstly, I fixed a bunch of bugs, and secondly the blowup turned out not to be really "massive", it's less that 2x for my system, which hurts, I agree, but not "massively" :)

My implementation just adds an option config.doCheckByDefault which I would now keep set when I'm not doing experiments that require long sequences of mass rebuilds.

@wmertens
Copy link
Contributor

wmertens commented Apr 25, 2018 via email

@cyounkins
Copy link
Contributor

This is great! Do we have info on how many packages have failing tests? Could we discuss enabling this by default?

Unfortunately something we'll run into that I haven't seen addressed in this issue is flakey tests. Sometimes they work, sometimes they don't. Certainly mitigated by the lack of networking but will probably happen anyway.

@oxij
Copy link
Member

oxij commented Dec 7, 2018 via email

@cyounkins
Copy link
Contributor

@oxij You're saying the tests for a package will fail for a single version, then pass again on the next version? Do you happen to have an example?

@oxij
Copy link
Member

oxij commented Dec 8, 2018 via email

@cyounkins
Copy link
Contributor

I might be missing something, but I added config.doCheckByDefault = true; to my /etc/nixos/configuration.nix and nix-build -A haskell.compiler.ghc863 doesn't rebuild and test but pulls a binary from the cache. If I add doCheck = true; to the derivation then it does a build and test. Is this expected?

@oxij
Copy link
Member

oxij commented Dec 15, 2018 via email

@CMCDragonkai
Copy link
Member

Based on #55425 and NixOS/nix#2691, can we also get a way to selectively disable the checkPhase without changing the derivation/output hash? I have use cases where I sometimes want to run tests, and someones I don't want to run tests via nix-build (and this is sometimes due to whether I'm running on a machine with GPU or not).

@timokau
Copy link
Member

timokau commented Mar 26, 2019

This would only be possible with something like @Profpatsch's withTests (not yet merged), and effectively only for install-time tests.
Regular (between build and install) tests can change the build result, and I imagine it would be hard to sandbox them without breaking a lot of tests.

@matthewbauer
Copy link
Member

Are there any examples of make check actually changing the build output? It's definitely possible but I would suspect very rare. The check phase happens before the install so I find it very unlikely that it would mess with the install. The installCheckPhase is a different story though. We could try a few tricks like making $out read only for the duration of checkPhase and installCheckPhase.

@oxij
Copy link
Member

oxij commented Mar 26, 2019 via email

@Profpatsch
Copy link
Member

like @Profpatsch's withTests (not yet merged),

I hear you

@Ekleog
Copy link
Member

Ekleog commented May 22, 2019

(triage) Closing this issue, as the amount of controversy around it make it sound like it would need an RFC to get people to agree on what should be done anyway.

@Ekleog Ekleog closed this as completed May 22, 2019
@gytis-ivaskevicius
Copy link
Contributor

NixOS/rfcs#95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

12 participants