From 4e1492f0fa3a48e5fa88d8623e47e50bb8527c87 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 14 Mar 2024 15:52:54 -0400 Subject: 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. --- include/utils.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/utils.h') 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 -- cgit