All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] report: gracefully handle XML report creation when no tests are run
@ 2019-06-09 21:04 Theodore Ts'o
  2019-06-16 13:22 ` Eryu Guan
  0 siblings, 1 reply; 2+ messages in thread
From: Theodore Ts'o @ 2019-06-09 21:04 UTC (permalink / raw)
  To: fstests; +Cc: Theodore Ts'o

If no tests are run (because they have all been excluded) then make
sure we insert a valid timestamp into the XML file, and avoid printing
an error message when reading a non-existent test summary scratch
file.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---

I sent this a while back, and didn't get any comments, so I'm resending.  PTAL.

 common/report | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/common/report b/common/report
index fb00b402..6cac71fc 100644
--- a/common/report
+++ b/common/report
@@ -59,6 +59,9 @@ _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")
+	fi
 	local dtime=`echo $date_time| tr  " " 'T'`
 	local stats="failures=\"$n_bad\" skipped=\"$n_notrun\" tests=\"$n_total\" time=\"$sect_time\""
 	local hw_info="hostname=\"$HOST\" timestamp=\"$dtime\" "
@@ -70,7 +73,9 @@ _xunit_make_section_report()
 		_xunit_add_property "$p"
 	done
 	echo -e "\t</properties>" >> $REPORT_DIR/result.xml
-	cat $tmp.report.xunit.$sect_name.xml >> $REPORT_DIR/result.xml
+	if [ -f $report ]; then
+		cat $report >> $REPORT_DIR/result.xml
+	fi
 	echo "</testsuite>" >> $REPORT_DIR/result.xml
 	echo "Xunit report: $REPORT_DIR/result.xml"
 }
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] report: gracefully handle XML report creation when no tests are run
  2019-06-09 21:04 [PATCH RESEND] report: gracefully handle XML report creation when no tests are run Theodore Ts'o
@ 2019-06-16 13:22 ` Eryu Guan
  0 siblings, 0 replies; 2+ messages in thread
From: Eryu Guan @ 2019-06-16 13:22 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: fstests

On Sun, Jun 09, 2019 at 05:04:31PM -0400, Theodore Ts'o wrote:
> If no tests are run (because they have all been excluded) then make
> sure we insert a valid timestamp into the XML file, and avoid printing
> an error message when reading a non-existent test summary scratch
> file.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
> 
> I sent this a while back, and didn't get any comments, so I'm resending.  PTAL.

Sorry, I totally missed it.. applied now, thanks!

Eryu

> 
>  common/report | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/common/report b/common/report
> index fb00b402..6cac71fc 100644
> --- a/common/report
> +++ b/common/report
> @@ -59,6 +59,9 @@ _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")
> +	fi
>  	local dtime=`echo $date_time| tr  " " 'T'`
>  	local stats="failures=\"$n_bad\" skipped=\"$n_notrun\" tests=\"$n_total\" time=\"$sect_time\""
>  	local hw_info="hostname=\"$HOST\" timestamp=\"$dtime\" "
> @@ -70,7 +73,9 @@ _xunit_make_section_report()
>  		_xunit_add_property "$p"
>  	done
>  	echo -e "\t</properties>" >> $REPORT_DIR/result.xml
> -	cat $tmp.report.xunit.$sect_name.xml >> $REPORT_DIR/result.xml
> +	if [ -f $report ]; then
> +		cat $report >> $REPORT_DIR/result.xml
> +	fi
>  	echo "</testsuite>" >> $REPORT_DIR/result.xml
>  	echo "Xunit report: $REPORT_DIR/result.xml"
>  }
> -- 
> 2.22.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-16 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-09 21:04 [PATCH RESEND] report: gracefully handle XML report creation when no tests are run Theodore Ts'o
2019-06-16 13:22 ` Eryu Guan

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.