mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-30 16:35:24 +00:00
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>
This commit is contained in:
parent
541e9ae6d4
commit
cba18f8ac2
@ -180,6 +180,12 @@ mymain(void)
|
||||
data.schema = sch; \
|
||||
if (virTestRun("test schema grammar file: " sch, \
|
||||
testSchemaGrammar, &data) == 0) { \
|
||||
/* initialize the validator even if the schema test \
|
||||
* was skipped because of VIR_TEST_RANGE */ \
|
||||
if (!data.validator && testSchemaGrammar(&data) < 0) { \
|
||||
ret = -1; \
|
||||
break; \
|
||||
} \
|
||||
if (testSchemaDirs(sch, data.validator, __VA_ARGS__, NULL) < 0) \
|
||||
ret = -1; \
|
||||
\
|
||||
|
Loading…
x
Reference in New Issue
Block a user