All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: zlang@redhat.com, djwong@kernel.org
Cc: Qu Wenruo <wqu@suse.com>,
	linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me,
	leah.rumancik@gmail.com, quwenruo.btrfs@gmx.com, tytso@mit.edu
Subject: [PATCH 03/15] report: capture the time zone in the test report timestamp
Date: Tue, 14 Mar 2023 17:52:47 -0700	[thread overview]
Message-ID: <167884156778.2482843.3569229630033004210.stgit@magnolia> (raw)
In-Reply-To: <167884155064.2482843.4310780034948240980.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

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 <djwong@kernel.org>
Reviewed-by: Qu Wenruo <wqu@suse.com>
---
 common/report |    9 ++++++---
 doc/xunit.xsd |    4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)


diff --git a/common/report b/common/report
index 1d84650270..1817132d51 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 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $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 ba97ccd67d..9295c5dc82 100644
--- a/doc/xunit.xsd
+++ b/doc/xunit.xsd
@@ -12,7 +12,7 @@
     <xs:element name="testsuite" type="testsuite"/>
     <xs:simpleType name="ISO8601_DATETIME_PATTERN">
         <xs:restriction base="xs:dateTime">
-            <xs:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}"/>
+            <xs:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}[+-][0-9]{2}:[0-9]{2}"/>
         </xs:restriction>
     </xs:simpleType>
     <xs:element name="testsuites">
@@ -184,7 +184,7 @@
         </xs:attribute>
         <xs:attribute name="timestamp" type="ISO8601_DATETIME_PATTERN" use="required">
             <xs:annotation>
-                <xs:documentation xml:lang="en">when the test was executed. Timezone may not be specified.</xs:documentation>
+                <xs:documentation xml:lang="en">when the test was executed. Timezone must be specified as an offset from UTC.</xs:documentation>
             </xs:annotation>
         </xs:attribute>
         <xs:attribute name="hostname" use="required">


  parent reply	other threads:[~2023-03-15  0:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15  0:52 [PATCHSET v3 00/15] fstests: improve junit xml reporting Darrick J. Wong
2023-03-15  0:52 ` [PATCH 01/15] check: generate section reports between tests Darrick J. Wong
2023-03-15  0:52 ` [PATCH 02/15] report: derive an xml schema for the xunit report Darrick J. Wong
2023-03-15  0:52 ` Darrick J. Wong [this message]
2023-03-15  0:52 ` [PATCH 04/15] report: clarify the meaning of the timestamp attribute Darrick J. Wong
2023-03-15  0:52 ` [PATCH 05/15] report: record fstests start and report generation timestamps Darrick J. Wong
2023-03-15  0:53 ` [PATCH 06/15] report: encode cdata sections correctly Darrick J. Wong
2023-03-15  0:53 ` [PATCH 07/15] report: encode the kernel log as a separate xml element Darrick J. Wong
2023-03-15  0:53 ` [PATCH 08/15] report: sort properties by name Darrick J. Wong
2023-03-15  0:53 ` [PATCH 09/15] report: pass property value to _xunit_add_property Darrick J. Wong
2023-03-15  0:53 ` [PATCH 10/15] report: encode xml entities in property values Darrick J. Wong
2023-03-15  0:53 ` [PATCH 11/15] report: collect basic information about a test run Darrick J. Wong
2023-03-15  0:53 ` [PATCH 12/15] report: record optional environment variables Darrick J. Wong
2023-03-15  0:53 ` [PATCH 13/15] report: record xfs-specific information about a test run Darrick J. Wong
2023-03-15  0:53 ` [PATCH 14/15] report: record ext*-specific " Darrick J. Wong
2023-03-15  0:53 ` [PATCH 15/15] report: allow test runners to inject arbitrary values Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=167884156778.2482843.3569229630033004210.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=leah.rumancik@gmail.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=tytso@mit.edu \
    --cc=wqu@suse.com \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.