Re: [PATCH v3 11/14] tests: Add test cases for external swtpm TPM emulator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 05/04/2018 04:21 PM, Stefan Berger wrote:
> This patch adds extensions to existing test cases and specific test cases
> for the tpm-emulator.
> 
> Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>
> ---
>  tests/qemuxml2argvdata/tpm-emulator.args | 27 +++++++++++++++++++++++++++
>  tests/qemuxml2argvtest.c                 | 15 +++++++++++++++
>  2 files changed, 42 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/tpm-emulator.args
> 
> diff --git a/tests/qemuxml2argvdata/tpm-emulator.args b/tests/qemuxml2argvdata/tpm-emulator.args
> new file mode 100644
> index 0000000..5970928
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/tpm-emulator.args
> @@ -0,0 +1,27 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/home/test \
> +USER=test \
> +LOGNAME=test \
> +QEMU_AUDIO_DRV=none \
> +/usr/bin/qemu-system-x86_64 \
> +-name TPM-VM \
> +-S \
> +-machine pc-i440fx-2.12,accel=tcg,usb=off,dump-guest-core=off \
> +-m 2048 \
> +-smp 1,sockets=1,cores=1,threads=1 \
> +-uuid 11d7cd22-da89-3094-6212-079a48a309a1 \
> +-display none \
> +-no-user-config \
> +-nodefaults \
> +-chardev socket,id=charmonitor,\
> +path=/tmp/lib/domain--1-TPM-VM/monitor.sock,server,nowait \

syntax check will tell you
"path=/tmp/lib/domain--1-TPM-VM/monitor.sock," can fit on the previous line.

> +-mon chardev=charmonitor,id=monitor,mode=control \
> +-rtc base=utc \
> +-no-shutdown \
> +-boot order=c,menu=on \
> +-usb \
> +-tpmdev emulator,id=tpm-tpm0,chardev=chrtpm \
> +-chardev socket,id=chrtpm,path=/dev/test \
> +-device tpm-tis,tpmdev=tpm-tpm0,id=tpm0 \
> +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index 8ef7701..a80e3f2 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -532,6 +532,19 @@ testCompareXMLToArgv(const void *data)
>          }
>      }
>  
> +    if (vm->def->tpm) {
> +       switch (vm->def->tpm->type) {
> +       case VIR_DOMAIN_TPM_TYPE_EMULATOR:
> +           if (VIR_STRDUP(vm->def->tpm->data.emulator.source.data.file.path,
> +                          "/dev/test") < 0)
> +               goto cleanup;
> +           break;
> +       case VIR_DOMAIN_TPM_TYPE_PASSTHROUGH:
> +       case VIR_DOMAIN_TPM_TYPE_LAST:
> +           break;
> +       }
> +    }
> +
>      if (!(cmd = qemuProcessCreatePretendCmd(&driver, vm, migrateURI,
>                                              (flags & FLAG_FIPS), false,
>                                              VIR_QEMU_PROCESS_START_COLD))) {
> @@ -1989,6 +2002,8 @@ mymain(void)
>              QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_CRB);
>      DO_TEST_PARSE_ERROR("tpm-no-backend-invalid",
>                          QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
> +    DO_TEST("tpm-emulator",
> +            QEMU_CAPS_DEVICE_TPM_EMULATOR, QEMU_CAPS_DEVICE_TPM_TIS);

Probably should use DO_TEST_CAPS_LATEST here...

John

>  
>  
>      DO_TEST_PARSE_ERROR("pci-domain-invalid", NONE);
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux