[PATCH 04/15] report: clarify the meaning of the timestamp attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 check         |    1 +
 common/report |    8 +++++---
 doc/xunit.xsd |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)


diff --git a/check b/check
index 14b398fd73..f2be3d7d7d 100755
--- a/check
+++ b/check
@@ -917,6 +917,7 @@ function run_section()
 		# to be reported for each test
 		(echo 1 > $DEBUGFS_MNT/clear_warn_once) > /dev/null 2>&1
 
+		test_start_time="$(date +"%F %T")"
 		if [ "$DUMP_OUTPUT" = true ]; then
 			_run_seq 2>&1 | tee $tmp.out
 			# Because $? would get tee's return code
diff --git a/common/report b/common/report
index 1817132d51..8e19e9f557 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
diff --git a/doc/xunit.xsd b/doc/xunit.xsd
index 9295c5dc82..653f486871 100644
--- a/doc/xunit.xsd
+++ b/doc/xunit.xsd
@@ -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 must be specified as an offset from UTC.</xs:documentation>
+                <xs:documentation xml:lang="en">Time that the last testcase was started. If no tests are started, this is the time the report was generated. Timezone must be specified as an offset from UTC.</xs:documentation>
             </xs:annotation>
         </xs:attribute>
         <xs:attribute name="hostname" use="required">




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux