about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-09-17 14:12:24 +0200
committeraszlig <aszlig@redmoonstudios.org>2015-09-17 16:02:43 +0200
commitda0e642c2b12f974d77fce4ed2c180d2fa518970 (patch)
treec6120829953f3196e9ab194e7ca71497517208e5 /nixos/tests
parentf81982e779e51402dc4e4717718b1ba50a739004 (diff)
downloadnixlib-da0e642c2b12f974d77fce4ed2c180d2fa518970.tar
nixlib-da0e642c2b12f974d77fce4ed2c180d2fa518970.tar.gz
nixlib-da0e642c2b12f974d77fce4ed2c180d2fa518970.tar.bz2
nixlib-da0e642c2b12f974d77fce4ed2c180d2fa518970.tar.lz
nixlib-da0e642c2b12f974d77fce4ed2c180d2fa518970.tar.xz
nixlib-da0e642c2b12f974d77fce4ed2c180d2fa518970.tar.zst
nixlib-da0e642c2b12f974d77fce4ed2c180d2fa518970.zip
tests/virtualbox: Add systemd-detect-virt subtest.
Addresses #9876 in the way that we want to make sure that VirtualBox 5.x
is going to be properly detected. Right now the result is "kvm", so the
subtest fails as expected with:

error: systemd-detect-virt returned "kvm" instead of "oracle" at (eval
       14) line 414, <__ANONIO__> line 92.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/virtualbox.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix
index a944c9caf356..1a5a6f7b5bbc 100644
--- a/nixos/tests/virtualbox.nix
+++ b/nixos/tests/virtualbox.nix
@@ -189,6 +189,8 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
     };
 
     testSubs = ''
+      my ${"$" + name}_sharepath = '${sharePath}';
+
       sub checkRunning_${name} {
         my $cmd = 'VBoxManage list runningvms | grep -q "^\"${name}\""';
         my ($status, $out) = $machine->execute(ru $cmd);
@@ -295,9 +297,15 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
     echo "$otherIP reachable" | ${pkgs.netcat}/bin/netcat -clp 5678 || :
   '';
 
+  sysdDetectVirt = pkgs: ''
+    ${pkgs.systemd}/bin/systemd-detect-virt > /mnt-root/result
+  '';
+
   vboxVMs = mapAttrs createVM {
     simple = {};
 
+    detectvirt.vmScript = sysdDetectVirt;
+
     test1.vmFlags = hostonlyVMFlags;
     test1.vmScript = dhcpScript;
 
@@ -381,6 +389,18 @@ in {
 
     destroyVM_simple;
 
+    subtest "systemd-detect-virt", sub {
+      createVM_detectvirt;
+      vbm("startvm detectvirt");
+      waitForStartup_detectvirt;
+      waitForVMBoot_detectvirt;
+      shutdownVM_detectvirt;
+      my $result = $machine->succeed("cat '$detectvirt_sharepath/result'");
+      chomp $result;
+      die "systemd-detect-virt returned \"$result\" instead of \"oracle\""
+        if $result ne "oracle";
+    };
+
     subtest "net-hostonlyif", sub {
       createVM_test1;
       createVM_test2;