From: Darrick J. Wong Date: Wed, 15 Mar 2023 00:52:47 +0000 (-0700) Subject: report: capture the time zone in the test report timestamp X-Git-Tag: v2023.03.26~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=545315976e728b682e2cc5732c652dd574f1149a;p=xfstests-dev.git report: capture the time zone in the test report timestamp Make sure we put the time zone of the system running the test in the timestamp that is recorded in the xunit report. `date "+%F %T"' reports the local time zone, not UTC. Signed-off-by: Darrick J. Wong Reviewed-by: Qu Wenruo Signed-off-by: Zorro Lang --- diff --git a/common/report b/common/report index 1d846502..1817132d 100644 --- a/common/report +++ b/common/report @@ -38,6 +38,7 @@ _xunit_make_section_report() local bad_count="$3" local notrun_count="$4" local sect_time="$5" + local timestamp if [ $sect_name == '-no-sections-' ]; then sect_name='global' @@ -45,8 +46,10 @@ _xunit_make_section_report() local report=$tmp.report.xunit.$sect_name.xml # Header echo "" > $REPORT_DIR/result.xml - if [ -z "$date_time" ]; then - date_time=$(date +"%F %T") + if [ -n "$date_time" ]; then + timestamp="$(date -Iseconds --date="$date_time")" + else + timestamp="$(date -Iseconds)" fi local fstests_ns="https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git" @@ -58,7 +61,7 @@ _xunit_make_section_report() name="xfstests" failures="$bad_count" skipped="$notrun_count" tests="$tests_count" time="$sect_time" - hostname="$HOST" timestamp="${date_time/ /T}"> + hostname="$HOST" timestamp="$timestamp"> ENDL # Properties diff --git a/doc/xunit.xsd b/doc/xunit.xsd index ba97ccd6..9295c5dc 100644 --- a/doc/xunit.xsd +++ b/doc/xunit.xsd @@ -12,7 +12,7 @@ - + @@ -184,7 +184,7 @@ - when the test was executed. Timezone may not be specified. + when the test was executed. Timezone must be specified as an offset from UTC.