[PATCH 3/3] check: ensure sect_stop is initialized if interrupted

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



sect_stop is normally set immediately prior to calling _wrapup() via
run_section(). However, when called via a trap signal handler,
sect_stop may be uninitialized, leading to a negative section time
(sect_stop - sect_start) in the xunit report. E.g.
  Interrupted!
  Passed all 1 tests
  Xunit report: /home/david/xfstests/results//result.xml
  rapido1:/# head /home/david/xfstests/results//result.xml
  <?xml version="1.0" encoding="UTF-8"?>
  <testsuite name="xfstests" failures="0" skipped="0" tests="1"
   time="-1670885797" ... >

This commit uses the existing $interrupt flag to determine when
sect_stop needs to be initialised.

Signed-off-by: David Disseldorp <ddiss@xxxxxxx>
---
 check | 1 +
 1 file changed, 1 insertion(+)

diff --git a/check b/check
index d2e51296..cb3ea155 100755
--- a/check
+++ b/check
@@ -433,6 +433,7 @@ _wrapup()
 {
 	seq="check"
 	check="$RESULT_BASE/check"
+	$interrupt && sect_stop=`_wallclock`
 
 	if $showme && $needwrap; then
 		if $do_report; then
-- 
2.35.3




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux