summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-08-24 21:46:50 +0200
committerGitHub <noreply@github.com>2020-08-24 21:46:50 +0200
commitc4ef188cae9a24ee7973be2eac5993244b673967 (patch)
treed61c55d3c4a1cceaabd8471e80f74114e96750e8 /nixos
parentf68082006fa99061ed189ef56c24f7a113c9aa33 (diff)
parentddbd436dc4644aa2c95730b3be8e1a3de9154acc (diff)
downloadnixpkgs-c4ef188cae9a24ee7973be2eac5993244b673967.tar
nixpkgs-c4ef188cae9a24ee7973be2eac5993244b673967.tar.gz
nixpkgs-c4ef188cae9a24ee7973be2eac5993244b673967.tar.bz2
nixpkgs-c4ef188cae9a24ee7973be2eac5993244b673967.tar.lz
nixpkgs-c4ef188cae9a24ee7973be2eac5993244b673967.tar.xz
nixpkgs-c4ef188cae9a24ee7973be2eac5993244b673967.tar.zst
nixpkgs-c4ef188cae9a24ee7973be2eac5993244b673967.zip
Merge pull request #96187 from helsinki-systems/os-prober-python
nixos/tests/os-prober.nix: port to python
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/os-prober.nix33
1 files changed, 18 insertions, 15 deletions
diff --git a/nixos/tests/os-prober.nix b/nixos/tests/os-prober.nix
index 6a38f5ca531..be0235a4175 100644
--- a/nixos/tests/os-prober.nix
+++ b/nixos/tests/os-prober.nix
@@ -1,4 +1,4 @@
-import ./make-test.nix ({pkgs, lib, ...}:
+import ./make-test-python.nix ({pkgs, lib, ...}:
 let
   # A filesystem image with a (presumably) bootable debian
   debianImage = pkgs.vmTools.diskImageFuns.debian9i386 {
@@ -34,9 +34,6 @@ let
     '';
   };
 
-  # options to add the disk to the test vm
-  QEMU_OPTS = "-drive index=2,file=${debianImage}/disk-image.qcow2,read-only,if=virtio";
-
   # a part of the configuration of the test vm
   simpleConfig = {
     boot.loader.grub = {
@@ -71,7 +68,7 @@ in {
   machine = { config, pkgs, ... }: (simpleConfig // {
       imports = [ ../modules/profiles/installation-device.nix
                   ../modules/profiles/base.nix ];
-      virtualisation.memorySize = 1024;
+      virtualisation.memorySize = 1300;
       # The test cannot access the network, so any packages
       # nixos-rebuild needs must be included in the VM.
       system.extraDependencies = with pkgs;
@@ -99,22 +96,28 @@ in {
 
   testScript = ''
     # hack to add the secondary disk
-    $machine->{startCommand} = "QEMU_OPTS=\"\$QEMU_OPTS \"${lib.escapeShellArg QEMU_OPTS} ".$machine->{startCommand};
+    os.environ[
+        "QEMU_OPTS"
+    ] = "-drive index=2,file=${debianImage}/disk-image.qcow2,read-only,if=virtio"
 
-    $machine->start;
-    $machine->succeed("udevadm settle");
-    $machine->waitForUnit("multi-user.target");
+    machine.start()
+    machine.succeed("udevadm settle")
+    machine.wait_for_unit("multi-user.target")
+    print(machine.succeed("lsblk"))
 
     # check that os-prober works standalone
-    $machine->succeed("${pkgs.os-prober}/bin/os-prober | grep /dev/vdb1");
+    machine.succeed(
+        "${pkgs.os-prober}/bin/os-prober | grep /dev/vdb1"
+    )
 
     # rebuild and test that debian is available in the grub menu
-    $machine->succeed("nixos-generate-config");
-    $machine->copyFileFromHost(
+    machine.succeed("nixos-generate-config")
+    machine.copy_from_host(
         "${configFile}",
-        "/etc/nixos/configuration.nix");
-    $machine->succeed("nixos-rebuild boot >&2");
+        "/etc/nixos/configuration.nix",
+    )
+    machine.succeed("nixos-rebuild boot >&2")
 
-    $machine->succeed("egrep 'menuentry.*debian' /boot/grub/grub.cfg");
+    machine.succeed("egrep 'menuentry.*debian' /boot/grub/grub.cfg")
   '';
 })