]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virschematest: Make sure that validator is initialized
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 15 Aug 2016 07:51:10 +0000 (09:51 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 15 Aug 2016 07:51:10 +0000 (09:51 +0200)
commitcba18f8ac2265660764592ebfb1547d20720d4a5
tree4a587c857b95f975fd05e84c7fc6ef01017a94b2
parent541e9ae6d4290b9004ed73648ea663563b329b3d
virschematest: Make sure that validator is initialized

It may happen that a developer wants to run just a specific
subset of tests:

tests $ VIR_TEST_RANGE=22 ../run ./virschematest

This now fails miserably:

    ==6840== Invalid read of size 8
    ==6840==    at 0x4F397C0: virXMLValidatorValidate (virxml.c:1216)
    ==6840==    by 0x402B72: testSchemaFile (virschematest.c:53)
    ==6840==    by 0x403737: virTestRun (testutils.c:180)
    ==6840==    by 0x402CF5: testSchemaDir (virschematest.c:98)
    ==6840==    by 0x402EB1: testSchemaDirs (virschematest.c:131)
    ==6840==    by 0x40314D: mymain (virschematest.c:194)
    ==6840==    by 0x4051AF: virTestMain (testutils.c:982)
    ==6840==    by 0x4035A9: main (virschematest.c:217)
    ==6840==  Address 0x10 is not stack'd, malloc'd or (recently) free'd

Problem is, we are trying to do two types of tests here: validate
RNG schema itself, and validate XML files against RNG schemas.
And the latter tries to re-use a resource allocated in the
former. Therefore if the former is skipped (due to
VIR_TEST_RANGE) we have to allocate the resource manually.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tests/virschematest.c