From patchwork Sun Jun 9 21:04:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 10983841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 274E91398 for ; Sun, 9 Jun 2019 21:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F25072881A for ; Sun, 9 Jun 2019 21:04:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCB3B28823; Sun, 9 Jun 2019 21:04:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E69B2881A for ; Sun, 9 Jun 2019 21:04:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729085AbfFIVEn (ORCPT ); Sun, 9 Jun 2019 17:04:43 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:39486 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727697AbfFIVEn (ORCPT ); Sun, 9 Jun 2019 17:04:43 -0400 Received: from callcc.thunk.org (guestnat-104-133-0-109.corp.google.com [104.133.0.109] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id x59L4eaV011266 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 9 Jun 2019 17:04:41 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id C9ADD420481; Sun, 9 Jun 2019 17:04:39 -0400 (EDT) From: "Theodore Ts'o" To: fstests@vger.kernel.org Cc: "Theodore Ts'o" Subject: [PATCH RESEND] report: gracefully handle XML report creation when no tests are run Date: Sun, 9 Jun 2019 17:04:31 -0400 Message-Id: <20190609210431.26373-1-tytso@mit.edu> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 "" > $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" >> $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 "" >> $REPORT_DIR/result.xml echo "Xunit report: $REPORT_DIR/result.xml" }