summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-19 18:56:35 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-19 18:56:35 +0000
commitfa50d105d7a16961f000846e3fa4e80021519639 (patch)
treec3cece61154d8799334b2e10decdcce82db5556a
parent43f43fd1851b72f5e035b9c33f9376e8903020d1 (diff)
downloadnixpkgs-fa50d105d7a16961f000846e3fa4e80021519639.tar
nixpkgs-fa50d105d7a16961f000846e3fa4e80021519639.tar.gz
nixpkgs-fa50d105d7a16961f000846e3fa4e80021519639.tar.bz2
nixpkgs-fa50d105d7a16961f000846e3fa4e80021519639.tar.lz
nixpkgs-fa50d105d7a16961f000846e3fa4e80021519639.tar.xz
nixpkgs-fa50d105d7a16961f000846e3fa4e80021519639.tar.zst
nixpkgs-fa50d105d7a16961f000846e3fa4e80021519639.zip
* Pass -cpu kvm64 in NixOS VMs (and add a simple regression test for
  GMP).

svn path=/nixos/trunk/; revision=33849
-rw-r--r--lib/test-driver/Machine.pm2
-rw-r--r--modules/virtualisation/qemu-vm.nix3
-rw-r--r--release.nix1
-rw-r--r--tests/default.nix1
-rw-r--r--tests/misc.nix21
5 files changed, 26 insertions, 2 deletions
diff --git a/lib/test-driver/Machine.pm b/lib/test-driver/Machine.pm
index 249a6e8b2ab..dee1e4f33cb 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 91ff1d594ba..9596822cd8f 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 6405983f8a7..2ee090f86ae 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 4ee61225219..4edcbd2f325 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 00000000000..6d7d9ac758b
--- /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");
+      };
+    '';
+
+}