nixos/tests/systemd-repart: make sizeDiff configurable
The +32M is not sufficient to create additional partitions. Make it configurable.
This commit is contained in:
@@ -9,9 +9,16 @@ with pkgs.lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
# A testScript fragment that prepares a disk with some empty, unpartitioned
|
# 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`
|
# space. and uses it to boot the test with.
|
||||||
# from which the diskImage is extracted.
|
# Takes two arguments, `machine` from which the diskImage is extracted,
|
||||||
useDiskImage = machine: ''
|
# as well an optional `sizeDiff` (defaulting to +32M), describing how should
|
||||||
|
# be resized.
|
||||||
|
useDiskImage =
|
||||||
|
{
|
||||||
|
machine,
|
||||||
|
sizeDiff ? "+32M",
|
||||||
|
}:
|
||||||
|
''
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -27,7 +34,7 @@ let
|
|||||||
"-f",
|
"-f",
|
||||||
"raw",
|
"raw",
|
||||||
tmp_disk_image.name,
|
tmp_disk_image.name,
|
||||||
"+32M",
|
"${sizeDiff}",
|
||||||
])
|
])
|
||||||
|
|
||||||
# Set NIX_DISK_IMAGE so that the qemu script finds the right disk image.
|
# Set NIX_DISK_IMAGE so that the qemu script finds the right disk image.
|
||||||
@@ -98,7 +105,7 @@ in
|
|||||||
testScript =
|
testScript =
|
||||||
{ nodes, ... }:
|
{ nodes, ... }:
|
||||||
''
|
''
|
||||||
${useDiskImage nodes.machine}
|
${useDiskImage { inherit (nodes) machine; }}
|
||||||
|
|
||||||
machine.start()
|
machine.start()
|
||||||
machine.wait_for_unit("multi-user.target")
|
machine.wait_for_unit("multi-user.target")
|
||||||
@@ -128,7 +135,7 @@ in
|
|||||||
testScript =
|
testScript =
|
||||||
{ nodes, ... }:
|
{ nodes, ... }:
|
||||||
''
|
''
|
||||||
${useDiskImage nodes.machine}
|
${useDiskImage { inherit (nodes) machine; }}
|
||||||
|
|
||||||
machine.start()
|
machine.start()
|
||||||
machine.wait_for_unit("multi-user.target")
|
machine.wait_for_unit("multi-user.target")
|
||||||
@@ -196,7 +203,7 @@ in
|
|||||||
testScript =
|
testScript =
|
||||||
{ nodes, ... }:
|
{ nodes, ... }:
|
||||||
''
|
''
|
||||||
${useDiskImage nodes.machine}
|
${useDiskImage { inherit (nodes) machine; }}
|
||||||
|
|
||||||
machine.start()
|
machine.start()
|
||||||
machine.wait_for_unit("multi-user.target")
|
machine.wait_for_unit("multi-user.target")
|
||||||
|
|||||||
Reference in New Issue
Block a user