mirror of
https://github.com/nix-community/disko.git
synced 2026-12-01 05:23:28 +01:00
tests: use nixpkgs qemu-common for proper machine type configuration
QEMU on aarch64 requires an explicit machine type (e.g., '-machine virt'), unlike x86_64 which has a default. Previously, the test script hardcoded 'qemu-kvm' without machine type arguments, causing aarch64 tests to fail with "No machine specified, and there is no default". By importing and using nixpkgs' qemu-common.nix library, we reuse the existing platform-specific QEMU configuration logic.
This commit is contained in:
1 parent
af087d076d
commit
a19c2b6d3a
4 files changed
+34
-6
No files matched your search
+12
-4
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
makeTest,
|
||||
eval-config,
|
||||
qemu-common-lib,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -91,6 +92,12 @@ let
|
||||
inherit pkgs;
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
};
|
||||
|
||||
# Get qemu-common library functions for this pkgs
|
||||
qemu-common = qemu-common-lib pkgs;
|
||||
# qemuBinary returns a string like: "/nix/store/.../qemu-system-x86_64 -machine accel=kvm:tcg -cpu max"
|
||||
qemuBinaryString = qemu-common.qemuBinary pkgs.qemu_test;
|
||||
|
||||
# for installation we skip /dev/vda because it is the test runner disk
|
||||
|
||||
importedDiskoConfig = if builtins.isPath disko-config then import disko-config else disko-config;
|
||||
@@ -291,6 +298,8 @@ let
|
||||
testScript =
|
||||
{ nodes, ... }:
|
||||
''
|
||||
import shlex
|
||||
|
||||
def disks(oldmachine, num_disks):
|
||||
disk_flags = []
|
||||
for i in range(num_disks):
|
||||
@@ -305,10 +314,9 @@ let
|
||||
def create_test_machine(
|
||||
oldmachine=None, **kwargs
|
||||
): # taken from <nixpkgs/nixos/tests/installer.nix>
|
||||
start_command = [
|
||||
"${pkgs.qemu_test}/bin/qemu-kvm",
|
||||
"-cpu",
|
||||
"max",
|
||||
# Use qemu-common from nixpkgs to get the proper QEMU binary with correct machine type and flags
|
||||
# shlex.split properly handles the command string with options like "-machine virt,gic-version=max"
|
||||
start_command = shlex.split("${qemuBinaryString}") + [
|
||||
"-m",
|
||||
"1024",
|
||||
"-virtfs",
|
||||
|
||||
Reference in new issue
Block a user