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

runNixOSTest fails on Darwin ( tests.testers.runNixOSTest-example fails to build) #294725

Open
ShamrockLee opened this issue Mar 10, 2024 · 6 comments
Labels
0.kind: bug 6.topic: darwin Running or building packages on Darwin

Comments

@ShamrockLee
Copy link
Contributor

ShamrockLee commented Mar 10, 2024

Describe the bug

#282401 should have made NixOS Tests available on Darwin. This should include package tests produced via tester runNixOSTest, but the OfBorg build result shows it isn't. An example is tests.testers.runNixOSTest-example

error: a 'x86_64-linux' with features {} is required to build '/nix/store/rsjmz848mv48kil2s92vnzy4n7q53rcz-builder.pl.drv', but I am a 'aarch64-darwin' with features {benchmark, big-parallel, nixos-test}

See the OfBorg test result in #292759.

Steps To Reproduce

Steps to reproduce the behavior on MacOS:

  1. Set up Nix on MacOS
  2. git clone https://github.com/NixOS/nixpkgs.git
  3. cd nixpkgs
  4. Checkout commit
  5. Build tests.testers.runNixOSTest-example
  6. See build failure

Steps to reproduce the behavior on GitHub:

  1. Go to tests.references: use runNixOSTest instead of nixosTest #292759 or any PR targeting the Nixpkgs master branch.
  2. Comment @ofborg build tests.testers.runNixOSTest-example

Expected behavior

Package tests written by testers.runNixOSTest, including tests.testers.runNixOSTest-example, should run on MacOS. Related OfBorg build should be green.

Screenshots

OfBorg build failure of tests.testers.runNixOSTest-example on x86_64-darwin from #292759

Additional context

OfBorg build log links:

Notify maintainers

@Gabriella439

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a 👍 reaction to issues you find important.

@chewblacka chewblacka added the 6.topic: darwin Running or building packages on Darwin label Mar 10, 2024
@Gabriella439
Copy link
Contributor

The macOS support for NixOS tests only adds support for running them but not building them. You still need access to a Linux builder to build those tests.

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Mar 10, 2024

Thanks for the quick response!

The macOS support for NixOS tests only adds support for running them but not building them. You still need access to a Linux builder to build those tests.

What's the difficulty to build NixOS tests on macOS? Isn't it just a QEMU virtual machine?

@Gabriella439
Copy link
Contributor

It is possible to build Linux products on NixOS using something like darwin.linux-builder but we don't yet have a way to do that in the course of a Nix build. See:

https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder

@lilyinstarlight
Copy link
Member

lilyinstarlight commented Mar 15, 2024

So I'm thinking about adding a config.disableDarwinNixOSTests to nixpkgs to make

guestSystem =
if hostPlatform.isLinux
then hostPlatform.system
else
let
hostToGuest = {
"x86_64-darwin" = "x86_64-linux";
"aarch64-darwin" = "aarch64-linux";
};
supportedHosts = lib.concatStringsSep ", " (lib.attrNames hostToGuest);
message =
"NixOS Test: don't know which VM guest system to pair with VM host system: ${hostPlatform.system}. Perhaps you intended to run the tests on a Linux host, or one of the following systems that may run NixOS tests: ${supportedHosts}";
in
hostToGuest.${hostPlatform.system} or (throw message);
throw for any attempt to build NixOS tests on Darwin, to give CI an escape hatch to return the old behavior

Does anyone have opinions on this?

I'll probably have a PR prepared today or tomorrow

@ShamrockLee
Copy link
Contributor Author

The macOS support for NixOS tests only adds support for running them but not building them. You still need acces to a Linux builder to build those tests.

Does that mean, those derivations for testing firs got built on the host if not on the cache, and then run in the VM?

@doronbehar
Copy link
Contributor

So I'm thinking about adding a config.disableDarwinNixOSTests to nixpkgs to make

Any progress on that @lilyinstarlight ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

No branches or pull requests

5 participants