Skip to content

haskellPackages: support cross tests in checkPhase#468007

Draft
alexfmpe wants to merge 1 commit intoNixOS:haskell-updatesfrom
alexfmpe:haskell-cross-test-wrapper
Draft

haskellPackages: support cross tests in checkPhase#468007
alexfmpe wants to merge 1 commit intoNixOS:haskell-updatesfrom
alexfmpe:haskell-cross-test-wrapper

Conversation

@alexfmpe
Copy link
Member

@alexfmpe alexfmpe commented Dec 5, 2025

Note this by itself doesn't change anything meaningful since stdenv.mkDerivation disables checkPhase under cross (unless canExecute is true).
However it's straight-forward and doesn't cause any non-cross rebuilds so it seems worth merging standalone.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Dec 5, 2025
@nixpkgs-ci nixpkgs-ci 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. 6.topic: haskell General-purpose, statically typed, purely functional programming language labels Dec 5, 2025
Copy link
Contributor

@wolfgangwalther wolfgangwalther left a comment

Choose a reason for hiding this comment

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

Diff LGTM; but I would like to test it. It should be possible to test this with the right package as haskell.lib.doCheck pkgsCross.ghcjs.haskellPackages.xxx, right?

I couldn't find such a package, yet. Tests just seem to work regardless, at least for ghcjs. Still building the aarch64 cross compiler.

@wolfgangwalther
Copy link
Contributor

Still building the aarch64 cross compiler.

I was not able to reproduce a failing check phase when cross compiling either, so far. I'm probably looking at the wrong packages...

@alexfmpe
Copy link
Member Author

alexfmpe commented Dec 6, 2025

It should be possible to test this with the right package as haskell.lib.doCheck pkgsCross.ghcjs.haskellPackages.xxx, right?

Not in general. Setting doCheck will only enable building the tests (via enableFeature) since doCheck as a stdenv.mkDerivation argument is disabled on cross unless buildPlatform.canExecute hostPlatform.

See

doCheck' = doCheck && canExecuteHostOnBuild;

For my own testing I've been calling checkPhase on arbitrary cross from inside buildPhase or haddockPhase. Don't really know a better way to run haskell cross tests by default since nixpkgs disables cross tests by default.

Maybe something can be done via passthru.tests ?

@wolfgangwalther
Copy link
Contributor

See

doCheck' = doCheck && canExecuteHostOnBuild;

Ah, I remember, yes. So we really need to fix that, eventually.

But as-is, this PR is dead code, right?

@alexfmpe
Copy link
Member Author

alexfmpe commented Dec 6, 2025

But as-is, this PR is dead code, right?

Yes

@wolfgangwalther wolfgangwalther marked this pull request as draft December 6, 2025 16:05
@wolfgangwalther
Copy link
Contributor

Marked as draft, because merging dead code doesn't make sense. We will need other changes first, to actually support running the checkPhase for cross.

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

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: haskell General-purpose, statically typed, purely functional programming language 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.

2 participants