[libvirt] [PATCH v2 2/2] conf: don't crash on a tpm device with no backends

Ján Tomko jtomko at redhat.com
Fri May 10 07:06:51 UTC 2013


On 05/09/2013 07:22 PM, Eric Blake wrote:
> On 05/09/2013 06:18 AM, Ján Tomko wrote:
>> Print an error instead of crashing when a TPM device without
>> a backend is specified.
>>
>> Add a test for tpm device with no backend, which should fail
>> with a parse error.
>>
>> https://bugzilla.redhat.com/show_bug.cgi?id=961252
>> ---
>>  src/conf/domain_conf.c                             |  6 +++++
>>  .../qemuxml2argv-tpm-no-backend-invalid.xml        | 27 ++++++++++++++++++++++
>>  tests/qemuxml2argvtest.c                           |  2 ++
>>  3 files changed, 35 insertions(+)
>>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-tpm-no-backend-invalid.xml
> 
> Awesome that we've enhanced the testsuite to check RNG parser rejection
> of invalid xml!
> 
>>  
>>      DO_TEST("tpm-passthrough", QEMU_CAPS_DEVICE,
>>              QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
>> +    DO_TEST_PARSE_ERROR("tpm-no-backend-invalid", QEMU_CAPS_DEVICE,
>> +                        QEMU_CAPS_DEVICE_TPM_PASSTHROUGH, QEMU_CAPS_DEVICE_TPM_TIS);
> 
> Should we be tweaking things for the other xml files (renaming files
> and/or tightening RNG) so that other uses of DO_TEST_PARSE_ERROR can
> also stress RNG validation?
> 
> tests/qemuxml2argvtest.c:    DO_TEST_PARSE_ERROR("boot-dev+order",
> tests/qemuxml2argvtest.c:    DO_TEST_PARSE_ERROR("usb-ich9-no-companion",
> tests/qemuxml2argvtest.c:    DO_TEST_PARSE_ERROR("usb-none-other",
> tests/qemuxml2argvtest.c:    DO_TEST_PARSE_ERROR("usb-none-hub",
> tests/qemuxml2argvtest.c:    DO_TEST_PARSE_ERROR("usb-none-usbtablet",
> 

I think none of these errors can be found by RNG validation, so this is only
good for new files.

Jan




More information about the libvir-list mailing list