From fa50d105d7a16961f000846e3fa4e80021519639 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 19 Apr 2012 18:56:35 +0000 Subject: [PATCH] * Pass -cpu kvm64 in NixOS VMs (and add a simple regression test for GMP). svn path=/nixos/trunk/; revision=33849 --- lib/test-driver/Machine.pm | 2 +- modules/virtualisation/qemu-vm.nix | 3 ++- release.nix | 1 + tests/default.nix | 1 + tests/misc.nix | 21 +++++++++++++++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/misc.nix diff --git a/lib/test-driver/Machine.pm b/lib/test-driver/Machine.pm index 249a6e8b2abf..dee1e4f33cb2 100644 --- a/lib/test-driver/Machine.pm +++ b/lib/test-driver/Machine.pm @@ -27,7 +27,7 @@ sub new { if (!$startCommand) { # !!! merge with qemu-vm.nix. $startCommand = - "qemu-system-x86_64 -m 384 " . + "qemu-kvm -m 384 " . "-net nic,model=virtio \$QEMU_OPTS "; $startCommand .= "-drive file=" . Cwd::abs_path($args->{hda}) . ",if=virtio,boot=on,werror=report " if defined $args->{hda}; diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index 91ff1d594ba3..9596822cd8f6 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -158,9 +158,10 @@ let ${pkgs.vmTools.startSamba} # Start QEMU. - exec ${pkgs.qemu_kvm}/bin/qemu-system-x86_64 \ + exec ${pkgs.qemu_kvm}/bin/qemu-kvm \ -name ${vmName} \ -m ${toString config.virtualisation.memorySize} \ + ${optionalString (pkgs.stdenv.system == "x86_64-linux") "-cpu kvm64"} \ -net nic,vlan=0,model=virtio \ -chardev socket,id=samba,path=./samba \ -net user,vlan=0,guestfwd=tcp:10.0.2.4:445-chardev:samba''${QEMU_NET_OPTS:+,$QEMU_NET_OPTS} \ diff --git a/release.nix b/release.nix index 6405983f8a70..2ee090f86ae6 100644 --- a/release.nix +++ b/release.nix @@ -216,6 +216,7 @@ let ipv6 = t.ipv6.test; kde4 = t.kde4.test; login = t.login.test; + misc = t.misc.test; mpich = t.mpich.test; mysql = t.mysql.test; mysql_replication = t.mysql_replication.test; diff --git a/tests/default.nix b/tests/default.nix index 4ee612252192..4edcbd2f325b 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -11,6 +11,7 @@ with import ../lib/testing.nix { inherit system; }; ipv6 = makeTest (import ./ipv6.nix); kde4 = makeTest (import ./kde4.nix); login = makeTest (import ./login.nix); + misc = makeTest (import ./misc.nix); mpich = makeTest (import ./mpich.nix); mysql = makeTest (import ./mysql.nix); mysql_replication = makeTest (import ./mysql-replication.nix); diff --git a/tests/misc.nix b/tests/misc.nix new file mode 100644 index 000000000000..6d7d9ac758b0 --- /dev/null +++ b/tests/misc.nix @@ -0,0 +1,21 @@ +# Miscellaneous small tests that don't warrant their own VM run. + +{ pkgs, ... }: + +{ + + machine = { config, pkgs, ... }: { }; + + testScript = + '' + subtest "nixos-version", sub { + $machine->succeed("[ `nixos-version | wc -w` = 1 ]"); + }; + + # Regression test for GMP aborts on QEMU. + subtest "gmp", sub { + $machine->succeed("expr 1 + 2"); + }; + ''; + +}