From: Peter Krempa Date: Thu, 22 Sep 2022 14:41:25 +0000 (+0200) Subject: testParseXMLDocFromFile: Validate that the replaced node is identical with parsed... X-Git-Tag: v8.9.0-rc1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee3b96bcb0d63503cf045bdc3ae75e91897f53ac;p=thirdparty%2Flibvirt.git testParseXMLDocFromFile: Validate that the replaced node is identical with parsed root When replacing a definition node by contents of a file the root node in the file must match the replaced node. Enforce that by passing the original node name as the 'rootnode' argument of virXMLParse. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 26c6c95c28..5eae22f591 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -851,7 +851,8 @@ testParseXMLDocFromFile(xmlNodePtr node, g_autofree char *absFile = testBuildFilename(file, relFile); xmlNodePtr newnode = NULL; - if (!(doc = virXMLParse(absFile, NULL, NULL, NULL, NULL, NULL, false))) + if (!(doc = virXMLParse(absFile, NULL, NULL, (const char *) node->name, + NULL, NULL, false))) return NULL; if (!(newnode = xmlCopyNode(xmlDocGetRootElement(doc), 1))) {