From ee3b96bcb0d63503cf045bdc3ae75e91897f53ac Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 22 Sep 2022 16:41:25 +0200 Subject: [PATCH] testParseXMLDocFromFile: Validate that the replaced node is identical with parsed root MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/test/test_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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))) { -- 2.47.2