From patchwork Wed Sep 9 18:11:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 46425 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n89IFYrl019122 for ; Wed, 9 Sep 2009 18:15:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753628AbZIISP3 (ORCPT ); Wed, 9 Sep 2009 14:15:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753919AbZIISP2 (ORCPT ); Wed, 9 Sep 2009 14:15:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60467 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753654AbZIISP2 (ORCPT ); Wed, 9 Sep 2009 14:15:28 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFT93018016; Wed, 9 Sep 2009 14:15:29 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFSMq015347; Wed, 9 Sep 2009 14:15:29 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n89IFNFO012008; Wed, 9 Sep 2009 14:15:27 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [PATCH 03/19] KVM test: scan_results.py: allow parsing and printing of multiple result files Date: Wed, 9 Sep 2009 21:11:56 +0300 Message-Id: <1252519932-30733-3-git-send-email-mgoldish@redhat.com> In-Reply-To: <1252519932-30733-2-git-send-email-mgoldish@redhat.com> References: <1252519932-30733-1-git-send-email-mgoldish@redhat.com> <1252519932-30733-2-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This is useful for printing results of several jobs executing in parallel (using job.parallel()). Signed-off-by: Michael Goldish --- client/tests/kvm/scan_results.py | 42 +++++++++++++++++++------------------ 1 files changed, 22 insertions(+), 20 deletions(-) diff --git a/client/tests/kvm/scan_results.py b/client/tests/kvm/scan_results.py index 95507bd..a22634e 100755 --- a/client/tests/kvm/scan_results.py +++ b/client/tests/kvm/scan_results.py @@ -51,28 +51,30 @@ def print_result(result): print '%-48s\t\t%s\t%s\t%s' % tuple(map(str, result)) -def main(resfile): - print_result(('test', 'status', 'seconds', 'info')) +def main(resfiles): + print_result(('Test', 'Status', 'Seconds', 'Info')) print_result(('----', '------', '-------', '----')) - f = file(resfile) - text = f.read() - f.close() - - results = parse_results(text) - map(print_result, results) + for resfile in resfiles: + print ' (Result file: %s)' % resfile + try: + f = file(resfile) + text = f.read() + f.close() + except IOError: + print 'Bad result file: %s' % resfile + return + results = parse_results(text) + map(print_result, results) if __name__ == '__main__': - import sys, os - - resfile = '../../results/default/status' - if len(sys.argv) == 2: - resfile = sys.argv[1] - if resfile == '-h' or resfile == '--help' or len(sys.argv) > 2: - print 'usage: %s [ ]' % sys.argv[0] - sys.exit(0) - if not os.path.exists(resfile): - print 'Bad result file: %s' % resfile - sys.exit(1) - main(resfile) + import sys, os, glob + + resfiles = glob.glob('../../results/default/status*') + if len(sys.argv) > 1: + if sys.argv[1] == '-h' or sys.argv[1] == '--help': + print 'Usage: %s [result files]' % sys.argv[0] + sys.exit(0) + resfiles = sys.argv[1:] + main(resfiles)