summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2018-01-28 21:07:59 +0100
committerTodd Gamblin <tgamblin@llnl.gov>2018-01-28 12:07:59 -0800
commit5af9256d4f3d9ad5189ddd7dbe1523fe43138e22 (patch)
tree7a6283d05981b5974440b3893fba74e41fc9ea35 /templates
parent784234ae8e246680ba77c946c1c348460cd2f145 (diff)
downloadspack-5af9256d4f3d9ad5189ddd7dbe1523fe43138e22.tar.gz
spack-5af9256d4f3d9ad5189ddd7dbe1523fe43138e22.tar.bz2
spack-5af9256d4f3d9ad5189ddd7dbe1523fe43138e22.tar.xz
spack-5af9256d4f3d9ad5189ddd7dbe1523fe43138e22.zip
Cleaned up JUnit report generation on install (#6977)
* Cleaned up JUnit report generation on install The generation of a JUnit report was previously part of the install command. This commit factors the logic into its own module, and uses a template for the generation of the report. It also improves report generation, that now can deal with multiple specs installed at once. Finally, extending the list of supported formats is much easier than before, as it entails just writing a new template. * Polished report generation + added tests for failures and errors The generation of a JUnit report has been polished, so that the stacktrace is correctly displayed with Jenkins JUnit plugin. Standard error is still not used. Added unit tests to cover for installation failures and installation errors.
Diffstat (limited to 'templates')
-rw-r--r--templates/reports/junit.xml51
1 files changed, 51 insertions, 0 deletions
diff --git a/templates/reports/junit.xml b/templates/reports/junit.xml
new file mode 100644
index 0000000000..fe2566bd42
--- /dev/null
+++ b/templates/reports/junit.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This file has been modeled after the basic
+ specifications at this url:
+
+ http://help.catchsoftware.com/display/ET/JUnit+Format
+-->
+<testsuites>
+{% for suite in test_suites %}
+ <testsuite name="{{ suite.name }}"
+ errors="{{ suite.nerrors }}"
+ tests="{{ suite.ntests }}"
+ failures="{{ suite.nfailures }}"
+ time="{{ suite.time }}"
+ timestamp="{{ suite.timestamp }}" >
+ <properties>
+{% for property in suite.properties %}
+ <property name="{{ property.name }}" value="{{ property.value }}" />
+{% endfor %}
+ </properties>
+{% for test in suite.testcases %}
+ <testcase classname="{{ test.name }}"
+ name="{{ test.id }}"
+ time="{{ test.elapsed_time }}">
+{% if test.result == 'failure' %}
+ <failure message="{{ test.message }}">
+{{ test.exception }}
+ </failure>
+{% elif test.result == 'error' %}
+ <error message="{{ test.message }}">
+{{ test.exception }}
+ </error>
+{% elif test.result == 'skipped' %}
+ <skipped />
+{% endif %}
+{% if test.stdout %}
+ <system-out>
+{{ test.stdout }}
+ </system-out>
+{% endif %}
+{% if test.stderr %}
+ <system-err>
+{{ test.stderr }}
+ </system-err>
+{% endif %}
+ </testcase>
+{% endfor %}
+{# Add an error tag? #}
+ </testsuite>
+{% endfor %}
+</testsuites>