summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-03-14 17:52:53 -0700
committerZorro Lang <zlang@kernel.org>2023-03-26 22:02:55 +0800
commit72dc174d42d97549a5770edaeae429702579912f (patch)
tree32e4a083847b4b3c3d2c870cfbe3a108b0b8392a /common
parent545315976e728b682e2cc5732c652dd574f1149a (diff)
report: clarify the meaning of the timestamp attribute
We've never specified what the timestamp attribute of the testsuite element actually means, and it history is rather murky. Prior to the introduction of the xml report format in commit f9fde7db2f, the "date_time" variable was used only to scrape dmesg via the /dev/kmsg device after each test. If /dev/kmsg was not a writable path, the variable was not set at all. In this case, the report timestamp would be blank. In commit ffdecf7498a1, Ted changed the xunit report code to handle empty date_time values by setting date_time to the time of report generation. This change was done to handle the case where no tests are run at all. However, it did not change the behavior that date_time is not set if /dev/kmsg is not writable. Clear up all this confusion by defining the timestamp attribute to reflect the start time of the most recent test, regardless of the state of /dev/kmsg. If no tests are run, then define the attribute to be the time of report generation. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'common')
-rw-r--r--common/report8
1 files changed, 5 insertions, 3 deletions
diff --git a/common/report b/common/report
index 1817132d..8e19e9f5 100644
--- a/common/report
+++ b/common/report
@@ -46,8 +46,8 @@ _xunit_make_section_report()
local report=$tmp.report.xunit.$sect_name.xml
# Header
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $REPORT_DIR/result.xml
- if [ -n "$date_time" ]; then
- timestamp="$(date -Iseconds --date="$date_time")"
+ if [ -n "$test_start_time" ]; then
+ timestamp="$(date -Iseconds --date="$test_start_time")"
else
timestamp="$(date -Iseconds)"
fi
@@ -61,7 +61,9 @@ _xunit_make_section_report()
name="xfstests"
failures="$bad_count" skipped="$notrun_count" tests="$tests_count" time="$sect_time"
- hostname="$HOST" timestamp="$timestamp">
+ hostname="$HOST"
+ timestamp="$timestamp"
+>
ENDL
# Properties