test: use QEMU from stable nixpkgs

This commit is contained in:
Erik Arvstedt 2020-09-27 12:43:37 +02:00
parent 03f8dbba47
commit 04075b108c
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
2 changed files with 7 additions and 12 deletions

View File

@ -3,11 +3,6 @@ testArgs:
let let
pkgs = import <nixpkgs> { config = {}; overlays = []; }; pkgs = import <nixpkgs> { config = {}; overlays = []; };
pkgs19_09 = import (pkgs.fetchzip {
url = "https://github.com/NixOS/nixpkgs-channels/archive/a7ceb2536ab11973c59750c4c48994e3064a75fa.tar.gz";
sha256 = "0hka65f31njqpq7i07l22z5rs7lkdfcl4pbqlmlsvnysb74ynyg1";
}) { config = {}; overlays = []; };
test = (import "${pkgs.path}/nixos/tests/make-test-python.nix") testArgs; test = (import "${pkgs.path}/nixos/tests/make-test-python.nix") testArgs;
fixedTest = { system ? builtins.currentSystem, ... }@args: fixedTest = { system ? builtins.currentSystem, ... }@args:
@ -23,11 +18,6 @@ let
exec ${pkgs.python3Packages.black}/bin/black $extraArgs "$@" exec ${pkgs.python3Packages.black}/bin/black $extraArgs "$@"
''; '';
}; };
# QEMU 4.20 from unstable fails on Travis build nodes with message
# "error: failed to set MSR 0x48b to 0x159ff00000000"
# Use version 4.0.1 instead.
inherit (pkgs19_09) qemu_test;
}; };
in in
test (args // { pkgs = pkgsFixed; }); test (args // { pkgs = pkgsFixed; });

View File

@ -149,14 +149,19 @@ exprForCI() {
((memAvailableMiB < memoryMiB)) && memoryMiB=$memAvailableMiB ((memAvailableMiB < memoryMiB)) && memoryMiB=$memAvailableMiB
>&2 echo "VM stats: CPUs: $numCPUs, memory: $memoryMiB MiB" >&2 echo "VM stats: CPUs: $numCPUs, memory: $memoryMiB MiB"
>&2 echo "Host memory total: $((memTotalKiB / 1024)) MiB, available: $memAvailableMiB MiB" >&2 echo "Host memory total: $((memTotalKiB / 1024)) MiB, available: $memAvailableMiB MiB"
vmTestNixExpr
# VMX is usually not available on CI nodes due to recursive virtualisation.
# Explicitly disable VMX, otherwise QEMU 4.20 fails with message
# "error: failed to set MSR 0x48b to 0x159ff00000000"
vmTestNixExpr "-cpu host,-vmx"
} }
vmTestNixExpr() { vmTestNixExpr() {
extraQEMUOpts="$1"
cat <<EOF cat <<EOF
((import "$testDir/tests.nix" { scenario = "$scenario"; }).vm {}).overrideAttrs (old: rec { ((import "$testDir/tests.nix" { scenario = "$scenario"; }).vm {}).overrideAttrs (old: rec {
buildCommand = '' buildCommand = ''
export QEMU_OPTS="-smp $numCPUs -m $memoryMiB" export QEMU_OPTS="-smp $numCPUs -m $memoryMiB $extraQEMUOpts"
echo "VM stats: CPUs: $numCPUs, memory: $memoryMiB MiB" echo "VM stats: CPUs: $numCPUs, memory: $memoryMiB MiB"
'' + old.buildCommand; '' + old.buildCommand;
}) })