|
1 | | -import ./make-test.nix ({pkgs, lib, ...}: |
| 1 | +import ./make-test-python.nix ({pkgs, lib, ...}: |
2 | 2 | let |
3 | 3 | # A filesystem image with a (presumably) bootable debian |
4 | 4 | debianImage = pkgs.vmTools.diskImageFuns.debian9i386 { |
|
34 | 34 | ''; |
35 | 35 | }; |
36 | 36 |
|
37 | | - # options to add the disk to the test vm |
38 | | - QEMU_OPTS = "-drive index=2,file=${debianImage}/disk-image.qcow2,read-only,if=virtio"; |
39 | | - |
40 | 37 | # a part of the configuration of the test vm |
41 | 38 | simpleConfig = { |
42 | 39 | boot.loader.grub = { |
|
71 | 68 | machine = { config, pkgs, ... }: (simpleConfig // { |
72 | 69 | imports = [ ../modules/profiles/installation-device.nix |
73 | 70 | ../modules/profiles/base.nix ]; |
74 | | - virtualisation.memorySize = 1024; |
| 71 | + virtualisation.memorySize = 1300; |
75 | 72 | # The test cannot access the network, so any packages |
76 | 73 | # nixos-rebuild needs must be included in the VM. |
77 | 74 | system.extraDependencies = with pkgs; |
|
99 | 96 |
|
100 | 97 | testScript = '' |
101 | 98 | # hack to add the secondary disk |
102 | | - $machine->{startCommand} = "QEMU_OPTS=\"\$QEMU_OPTS \"${lib.escapeShellArg QEMU_OPTS} ".$machine->{startCommand}; |
| 99 | + os.environ[ |
| 100 | + "QEMU_OPTS" |
| 101 | + ] = "-drive index=2,file=${debianImage}/disk-image.qcow2,read-only,if=virtio" |
103 | 102 |
|
104 | | - $machine->start; |
105 | | - $machine->succeed("udevadm settle"); |
106 | | - $machine->waitForUnit("multi-user.target"); |
| 103 | + machine.start() |
| 104 | + machine.succeed("udevadm settle") |
| 105 | + machine.wait_for_unit("multi-user.target") |
| 106 | + print(machine.succeed("lsblk")) |
107 | 107 |
|
108 | 108 | # check that os-prober works standalone |
109 | | - $machine->succeed("${pkgs.os-prober}/bin/os-prober | grep /dev/vdb1"); |
| 109 | + machine.succeed( |
| 110 | + "${pkgs.os-prober}/bin/os-prober | grep /dev/vdb1" |
| 111 | + ) |
110 | 112 |
|
111 | 113 | # rebuild and test that debian is available in the grub menu |
112 | | - $machine->succeed("nixos-generate-config"); |
113 | | - $machine->copyFileFromHost( |
| 114 | + machine.succeed("nixos-generate-config") |
| 115 | + machine.copy_from_host( |
114 | 116 | "${configFile}", |
115 | | - "/etc/nixos/configuration.nix"); |
116 | | - $machine->succeed("nixos-rebuild boot >&2"); |
| 117 | + "/etc/nixos/configuration.nix", |
| 118 | + ) |
| 119 | + machine.succeed("nixos-rebuild boot >&2") |
117 | 120 |
|
118 | | - $machine->succeed("egrep 'menuentry.*debian' /boot/grub/grub.cfg"); |
| 121 | + machine.succeed("egrep 'menuentry.*debian' /boot/grub/grub.cfg") |
119 | 122 | ''; |
120 | 123 | }) |
0 commit comments