]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
report: clarify the meaning of the timestamp attribute
authorDarrick J. Wong <djwong@kernel.org>
Wed, 15 Mar 2023 00:52:53 +0000 (17:52 -0700)
committerZorro Lang <zlang@kernel.org>
Sun, 26 Mar 2023 14:02:55 +0000 (22:02 +0800)
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>
check
common/report
doc/xunit.xsd

diff --git a/check b/check
index 14b398fd732f1d1022896c27f090617cb607200e..f2be3d7d7d1fbd7808e1fd5745718dff5c34b465 100755 (executable)
--- 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
index 1817132d511fe8b7c2f68b31bd896c759cc611cd..8e19e9f5572a05994d9f50f7502c87af1bd53df6 100644 (file)
@@ -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
index 9295c5dc8234a7c30d475ea3ad671004c5be3307..653f48687144a0323f72f186ded8a1d523a3b296 100644 (file)
         </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">