···
# A testScript fragment that prepares a disk with some empty, unpartitioned
-
# space. and uses it to boot the test with. Takes a single argument `machine`
-
# from which the diskImage is extracted.
-
useDiskImage = machine: ''
-
tmp_disk_image = tempfile.NamedTemporaryFile()
-
shutil.copyfile("${machine.system.build.diskImage}/nixos.img", tmp_disk_image.name)
-
"${machine.virtualisation.qemu.package}/bin/qemu-img",
-
# Set NIX_DISK_IMAGE so that the qemu script finds the right disk image.
-
os.environ['NIX_DISK_IMAGE'] = tmp_disk_image.name
···
-
${useDiskImage nodes.machine}
machine.wait_for_unit("multi-user.target")
···
-
${useDiskImage nodes.machine}
machine.wait_for_unit("multi-user.target")
···
-
${useDiskImage nodes.machine}
machine.wait_for_unit("multi-user.target")
···
# A testScript fragment that prepares a disk with some empty, unpartitioned
+
# space. and uses it to boot the test with.
+
# Takes two arguments, `machine` from which the diskImage is extracted,
+
# as well an optional `sizeDiff` (defaulting to +32M), describing how should
+
tmp_disk_image = tempfile.NamedTemporaryFile()
+
shutil.copyfile("${machine.system.build.diskImage}/nixos.img", tmp_disk_image.name)
+
"${machine.virtualisation.qemu.package}/bin/qemu-img",
+
# Set NIX_DISK_IMAGE so that the qemu script finds the right disk image.
+
os.environ['NIX_DISK_IMAGE'] = tmp_disk_image.name
···
+
${useDiskImage { inherit (nodes) machine; }}
machine.wait_for_unit("multi-user.target")
···
+
${useDiskImage { inherit (nodes) machine; }}
machine.wait_for_unit("multi-user.target")
···
+
${useDiskImage { inherit (nodes) machine; }}
machine.wait_for_unit("multi-user.target")