aboutsummaryrefslogtreecommitdiff
path: root/include/utils.h
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-03-14 15:52:54 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-03-14 15:52:54 -0400
commit4e1492f0fa3a48e5fa88d8623e47e50bb8527c87 (patch)
tree04198e99f40355cdd2644884bd8ca2b33f832069 /include/utils.h
parent7656ed0e011f910b84131360cc82e335f01913db (diff)
downloadstasis-4e1492f0fa3a48e5fa88d8623e47e50bb8527c87.tar.gz
Pretty-print pytest xml results (if xmllint is present)
* Adds Delivery.storage.results_dir member * Exposes storage.results_dir to templates * This is to make the test results human-readable * xmllint is optional. If it isn't installed it isn't a big deal.
Diffstat (limited to 'include/utils.h')
-rw-r--r--include/utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/utils.h b/include/utils.h
index 71d3f8b..b03d99e 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -22,6 +22,9 @@
#define LINE_SEP "\n"
#endif
+#define OMC_XML_PRETTY_PRINT_PROG "xmllint"
+#define OMC_XML_PRETTY_PRINT_ARGS "--format"
+
typedef int (ReaderFn)(size_t line, char **);
/**
@@ -243,4 +246,12 @@ char *xmkstemp(FILE **fp, const char *mode);
*/
int isempty_dir(const char *path);
+/**
+ * Rewrite an XML file with a pretty printer command
+ * @param filename path to modify
+ * @param pretty_print_prog program to call
+ * @param pretty_print_args arguments to pass to program
+ * @return 0 on success, -1 on error
+ */
+int xml_pretty_print_in_place(const char *filename, const char *pretty_print_prog, const char *pretty_print_args);
#endif //OMC_UTILS_H