projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Backport: trackers: tests: adapt tests to new xsd schemas
[lttng-tools.git]
/
tests
/
regression
/
tools
/
mi
/
extract_xml.c
diff --git
a/tests/regression/tools/mi/extract_xml.c
b/tests/regression/tools/mi/extract_xml.c
index ddf8c16773331b9786b2018c4cbf2d7fb5a651e5..9c324896e3d18cbe7e9797eb9904180e18d86cca 100644
(file)
--- a/
tests/regression/tools/mi/extract_xml.c
+++ b/
tests/regression/tools/mi/extract_xml.c
@@
-35,6
+35,7
@@
*/
#include <stdlib.h>
#include <stdio.h>
*/
#include <stdlib.h>
#include <stdio.h>
+#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
@@
-48,8
+49,9
@@
#if defined(LIBXML_XPATH_ENABLED)
#if defined(LIBXML_XPATH_ENABLED)
-int opt_verbose;
-int node_exist;
+static int opt_verbose;
+static int node_exist;
+static bool result = false;
/**
* print_xpath_nodes:
/**
* print_xpath_nodes:
@@
-86,7
+88,7
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
node_child_value_string = xmlNodeListGetString(doc,
cur->children, 1);
if (node_exist) {
node_child_value_string = xmlNodeListGetString(doc,
cur->children, 1);
if (node_exist) {
-
fprintf(output, "true\n")
;
+
result = true
;
} else if (opt_verbose) {
fprintf(output, "%s;%s;\n", cur->name,
node_child_value_string);
} else if (opt_verbose) {
fprintf(output, "%s;%s;\n", cur->name,
node_child_value_string);
@@
-98,7
+100,7
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
} else {
/* We don't want to print non-final element */
if (node_exist) {
} else {
/* We don't want to print non-final element */
if (node_exist) {
-
fprintf(output, "true\n")
;
+
result = true
;
} else {
fprintf(stderr, "ERR:%s\n",
"Xpath expression return non-final xml element");
} else {
fprintf(stderr, "ERR:%s\n",
"Xpath expression return non-final xml element");
@@
-108,7
+110,7
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
}
} else {
if (node_exist) {
}
} else {
if (node_exist) {
-
fprintf(output, "true\n")
;
+
result = true
;
} else {
/* We don't want to print non-final element */
fprintf(stderr, "ERR:%s\n",
} else {
/* We don't want to print non-final element */
fprintf(stderr, "ERR:%s\n",
@@
-121,7
+123,7
@@
static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
} else {
cur = nodes->nodeTab[i];
if (node_exist) {
} else {
cur = nodes->nodeTab[i];
if (node_exist) {
-
fprintf(output, "true\n")
;
+
result = true
;
} else if (opt_verbose) {
fprintf(output, "%s;%s;\n", cur->parent->name, cur->content);
} else {
} else if (opt_verbose) {
fprintf(output, "%s;%s;\n", cur->parent->name, cur->content);
} else {
@@
-221,6
+223,9
@@
static int extract_xpath(const char *xml_path, const xmlChar *xpath)
xmlFreeDoc(doc);
return -1;
}
xmlFreeDoc(doc);
return -1;
}
+ if (node_exist && result) {
+ fprintf(stdout, "true\n");
+ }
/* Cleanup */
xmlXPathFreeObject(xpathObj);
/* Cleanup */
xmlXPathFreeObject(xpathObj);
This page took
0.025917 seconds
and
5
git commands to generate.