]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuxml2argvtest: Fix type for faked chardev backing a TPM
authorPeter Krempa <pkrempa@redhat.com>
Mon, 15 Nov 2021 15:52:52 +0000 (16:52 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 19 Nov 2021 11:38:35 +0000 (12:38 +0100)
The test filled the chardev type to VIR_DOMAIN_CHR_TYPE_FILE and thus
set the 'data.emulator.source->data.file.path' pointer, but the
commandline formatter is unconditionally expecting VIR_DOMAIN_CHR_TYPE_UNIX
and thus reading 'data.emulator.source->data.nix.path'. Since it's an
union it happened to land in the correct place. Fix the faked data.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tests/qemuxml2argvtest.c

index 1d0d6e14ba42d6d2ec158b3401a99745842071f5..a5d162958e399a3a2d6ff2b34361910c308dc054 100644 (file)
@@ -450,9 +450,9 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv,
         if (vm->def->tpms[i]->type != VIR_DOMAIN_TPM_TYPE_EMULATOR)
             continue;
 
-        VIR_FREE(vm->def->tpms[i]->data.emulator.source->data.file.path);
-        vm->def->tpms[i]->data.emulator.source->data.file.path = g_strdup("/dev/test");
-        vm->def->tpms[i]->data.emulator.source->type = VIR_DOMAIN_CHR_TYPE_FILE;
+        VIR_FREE(vm->def->tpms[i]->data.emulator.source->data.nix.path);
+        vm->def->tpms[i]->data.emulator.source->type = VIR_DOMAIN_CHR_TYPE_UNIX;
+        vm->def->tpms[i]->data.emulator.source->data.nix.path = g_strdup("/dev/test");
     }
 
     for (i = 0; i < vm->def->nvideos; i++) {