diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-14 15:52:54 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-14 15:52:54 -0400 |
commit | 4e1492f0fa3a48e5fa88d8623e47e50bb8527c87 (patch) | |
tree | 04198e99f40355cdd2644884bd8ca2b33f832069 /include | |
parent | 7656ed0e011f910b84131360cc82e335f01913db (diff) | |
download | stasis-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')
-rw-r--r-- | include/deliverable.h | 3 | ||||
-rw-r--r-- | include/utils.h | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/deliverable.h b/include/deliverable.h index 0aad8ab..fda3c94 100644 --- a/include/deliverable.h +++ b/include/deliverable.h @@ -54,6 +54,7 @@ struct Delivery { char *tools_dir; ///< Tools storage char *mission_dir; ///< Mission data storage char *package_dir; ///< Base path to where all packages are stored + char *results_dir; ///< Base path to where test results are stored char *conda_install_prefix; ///< Path to install Conda char *conda_artifact_dir; ///< Base path to store compiled conda packages char *conda_staging_dir; ///< Base path to copy compiled conda packages @@ -362,4 +363,6 @@ int delivery_artifact_upload(struct Delivery *ctx); int delivery_mission_render_files(struct Delivery *ctx); int delivery_docker(struct Delivery *ctx); + +int delivery_fixup_test_results(struct Delivery *ctx); #endif //OMC_DELIVERABLE_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 |