tests: use untouched nixpkgs for the test host
This commit is contained in:
parent
f5108bc99b
commit
7bd3ce4e07
|
@ -266,16 +266,17 @@
|
|||
|
||||
nixosModules =
|
||||
# Modules for composing Genode and NixOS.
|
||||
import ./nixos-modules { flake = self; };
|
||||
import ./nixos-modules { inherit (self) legacyPackages; };
|
||||
|
||||
checks =
|
||||
# Checks for continous testing.
|
||||
let tests = import ./tests;
|
||||
in with (forAllCrossSystems ({ system, localSystem, crossSystem }:
|
||||
tests {
|
||||
flake = self;
|
||||
inherit system localSystem crossSystem;
|
||||
pkgs = self.legacyPackages.${system};
|
||||
inherit lib system localSystem crossSystem;
|
||||
hostPkgs = nixpkgs.legacyPackages.${localSystem};
|
||||
testPkgs = self.legacyPackages.${system};
|
||||
modulesPath = "${nixpkgs}/nixos/modules";
|
||||
} // {
|
||||
ports = self.legacyPackages.${localSystem}.symlinkJoin {
|
||||
name = "ports";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ flake }:
|
||||
{ legacyPackages }:
|
||||
|
||||
{
|
||||
|
||||
|
@ -13,11 +13,11 @@
|
|||
./qemu-vm.nix
|
||||
./services
|
||||
];
|
||||
nixpkgs = rec {
|
||||
nixpkgs = {
|
||||
localSystem.system = "x86_64-linux";
|
||||
crossSystem.system = "x86_64-genode";
|
||||
system = localSystem.system + "-" + crossSystem.system;
|
||||
pkgs = flake.legacyPackages.${system};
|
||||
pkgs = legacyPackages.${system};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with import ../tests/lib/qemu-flags.nix { inherit pkgs; };
|
||||
with import ../tests/lib/qemu-flags.nix { inherit (pkgs) lib stdenv; };
|
||||
|
||||
let
|
||||
|
||||
qemu = pkgs.buildPackages.buildPackages.qemu;
|
||||
inherit (config.system.build) OVMF qemu runtimeShell;
|
||||
|
||||
cfg = config.virtualisation;
|
||||
|
||||
consoles = lib.concatMapStringsSep " " (c: "console=${c}") cfg.qemu.consoles;
|
||||
|
||||
efiPrefix = if (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) then
|
||||
"${pkgs.buildPackages.buildPackages.OVMF.fd}/FV/OVMF"
|
||||
"${OVMF.fd}/FV/OVMF"
|
||||
else if pkgs.stdenv.isAarch64 then
|
||||
"${pkgs.buildPackages.buildPackages.OVMF.fd}/FV/AAVMF"
|
||||
"${OVMF.fd}/FV/AAVMF"
|
||||
else
|
||||
throw "No EFI firmware available for platform";
|
||||
efiFirmware = "${efiPrefix}_CODE.fd";
|
||||
|
||||
# Shell script to start the VM.
|
||||
startVM = ''
|
||||
#! ${pkgs.buildPackages.runtimeShell}
|
||||
#! ${runtimeShell}
|
||||
'' + lib.optionalString (config.virtualisation.diskImage != null) ''
|
||||
NIX_DISK_IMAGE=$(readlink -f ''${NIX_DISK_IMAGE:-${config.virtualisation.diskImage}})
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{ flake, system, localSystem, crossSystem, pkgs }:
|
||||
{ lib, system, localSystem, crossSystem, hostPkgs, testPkgs, modulesPath }:
|
||||
|
||||
let
|
||||
lib = flake.lib;
|
||||
|
||||
testingPython =
|
||||
# Mostly lifted from Nixpkgs.
|
||||
import ./lib/testing-python.nix;
|
||||
|
@ -24,12 +22,12 @@ let
|
|||
];
|
||||
|
||||
core = builtins.filter (core:
|
||||
builtins.any (x: x == pkgs.stdenv.hostPlatform.system) core.platforms) [
|
||||
builtins.any (x: x == testPkgs.hostPlatform.system) core.platforms) [
|
||||
/* # Need to fix the QEMU boot parameters?
|
||||
{
|
||||
prefix = "hw-pc-";
|
||||
testingPython = testingPython {
|
||||
inherit flake system localSystem crossSystem pkgs;
|
||||
inherit lib system localSystem crossSystem hostPkgs testPkgs modulesPath;
|
||||
extraConfigurations = [ ../nixos-modules/base-hw-pc.nix ];
|
||||
};
|
||||
specs = [ "x86" "hw" ];
|
||||
|
@ -40,7 +38,7 @@ let
|
|||
{
|
||||
prefix = "hw-virt_qemu-";
|
||||
testingPython = testingPython {
|
||||
inherit flake system localSystem crossSystem pkgs;
|
||||
inherit lib system localSystem crossSystem hostPkgs testPkgs modulesPath;
|
||||
extraConfigurations = [ ../nixos-modules/base-hw-virt_qemu.nix ];
|
||||
};
|
||||
specs = [ "aarch64" "hw" ];
|
||||
|
@ -50,7 +48,8 @@ let
|
|||
{
|
||||
prefix = "nova-";
|
||||
testingPython = testingPython {
|
||||
inherit flake system localSystem crossSystem pkgs;
|
||||
inherit lib system localSystem crossSystem hostPkgs testPkgs
|
||||
modulesPath;
|
||||
extraConfigurations = [ ../nixos-modules/nova.nix ];
|
||||
};
|
||||
specs = [ "x86" "nova" ];
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
{ system, localSystem, crossSystem
|
||||
# Nixpkgs, for qemu, lib and more
|
||||
, pkgs, lib, modulesPath
|
||||
{ lib, system, localSystem, crossSystem, hostPkgs, testPkgs, modulesPath
|
||||
# NixOS configuration to add to the VMs
|
||||
, extraConfigurations ? [ ] }:
|
||||
|
||||
with pkgs.lib;
|
||||
with import ./qemu-flags.nix { inherit pkgs; };
|
||||
with lib;
|
||||
with import ./qemu-flags.nix { inherit (testPkgs) lib stdenv; };
|
||||
|
||||
rec {
|
||||
|
||||
inherit pkgs;
|
||||
|
||||
qemu = pkgs.buildPackages.buildPackages.qemu_test;
|
||||
qemu = hostPkgs.qemu_test;
|
||||
|
||||
# Build a virtual network from an attribute set `{ machine1 =
|
||||
# config1; ... machineN = configN; }', where `machineX' is the
|
||||
|
@ -37,15 +33,21 @@ rec {
|
|||
../../nixos-modules/services
|
||||
{
|
||||
key = "qemu";
|
||||
system.build.qemu = qemu;
|
||||
system.build = {
|
||||
inherit qemu;
|
||||
inherit (hostPkgs) runtimeShell;
|
||||
};
|
||||
}
|
||||
{
|
||||
key = "nodes";
|
||||
_module.args.nodes = nodes;
|
||||
}
|
||||
{
|
||||
system.build.qemu = qemu;
|
||||
nixpkgs = { inherit system crossSystem localSystem pkgs; };
|
||||
key = "nixpkgs";
|
||||
nixpkgs = {
|
||||
inherit system crossSystem localSystem;
|
||||
pkgs = testPkgs;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# QEMU flags shared between various Nix expressions.
|
||||
{ pkgs }:
|
||||
{ lib, stdenv }:
|
||||
|
||||
let
|
||||
zeroPad = n:
|
||||
pkgs.lib.optionalString (n < 16) "0" + (if n > 255 then
|
||||
lib.optionalString (n < 16) "0" + (if n > 255 then
|
||||
throw "Can't have more than 255 nets or nodes!"
|
||||
else
|
||||
pkgs.lib.toHexString n);
|
||||
lib.toHexString n);
|
||||
|
||||
in rec {
|
||||
qemuNicMac = net: machine: "52:54:00:12:${zeroPad net}:${zeroPad machine}";
|
||||
|
@ -18,13 +18,13 @@ in rec {
|
|||
"-netdev vde,id=vlan${toString nic},sock=$QEMU_VDE_SOCKET_${toString net}"
|
||||
];
|
||||
|
||||
qemuSerialDevice = if pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 then
|
||||
qemuSerialDevice = if stdenv.isi686 || stdenv.isx86_64 then
|
||||
"ttyS0"
|
||||
else if pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64 then
|
||||
else if stdenv.isAarch32 || stdenv.isAarch64 then
|
||||
"ttyAMA0"
|
||||
else
|
||||
throw
|
||||
"Unknown QEMU serial device for system '${pkgs.stdenv.hostPlatform.system}'";
|
||||
"Unknown QEMU serial device for system '${stdenv.hostPlatform.system}'";
|
||||
|
||||
qemuBinary = qemuPkg:
|
||||
{
|
||||
|
@ -37,5 +37,5 @@ in rec {
|
|||
aarch64-genode =
|
||||
"${qemuPkg}/bin/qemu-system-aarch64 -M virt,virtualization=true,gic_version=3 -cpu cortex-a53";
|
||||
x86_64-genode = "${qemuPkg}/bin/qemu-system-x86_64 -machine q35";
|
||||
}.${pkgs.stdenv.hostPlatform.system} or "${qemuPkg}/bin/qemu-kvm";
|
||||
}.${stdenv.hostPlatform.system} or "${qemuPkg}/bin/qemu-kvm";
|
||||
}
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
{ flake, system, localSystem, crossSystem, pkgs
|
||||
{ lib, system, localSystem, crossSystem, hostPkgs, testPkgs, modulesPath
|
||||
# Modules to add to each VM
|
||||
, extraConfigurations ? [ ] }:
|
||||
|
||||
with import ./build-vms.nix {
|
||||
inherit system localSystem crossSystem pkgs extraConfigurations;
|
||||
inherit (flake) lib;
|
||||
modulesPath = "${flake.inputs.nixpkgs}/nixos/modules";
|
||||
inherit lib system localSystem crossSystem hostPkgs testPkgs modulesPath
|
||||
extraConfigurations;
|
||||
};
|
||||
with pkgs.buildPackages.buildPackages;
|
||||
with hostPkgs;
|
||||
|
||||
rec {
|
||||
|
||||
inherit pkgs;
|
||||
inherit hostPkgs testPkgs;
|
||||
|
||||
testDriver = let testDriverScript = ./test-driver.py;
|
||||
in stdenv.mkDerivation {
|
||||
|
|
Loading…
Reference in New Issue