From: Josh Durgin Date: Fri, 16 Mar 2012 18:40:17 +0000 (-0700) Subject: suite: log results and coverage generation X-Git-Tag: v11.1.1~58^2^2~902^2~1317 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=07b97fe77fa71a62d2149dd9b705ea5a1722cc52;p=ceph.git suite: log results and coverage generation Need to figure out where and when results emails are failing. --- diff --git a/teuthology/coverage.py b/teuthology/coverage.py index b68b7961f8dfe..9bdc498202c0e 100644 --- a/teuthology/coverage.py +++ b/teuthology/coverage.py @@ -42,6 +42,7 @@ def store_coverage(ctx, test_coverage, rev, suite): raise else: db.commit() + log.info('added coverage to database') finally: cursor.close() @@ -110,9 +111,26 @@ Analyze the coverage of a suite of test runs, generating html output with lcov. teuthology.read_config(args) + handler = logging.FileHandler( + filename=os.path.join(args.test_dir, 'coverage.log'), + ) + formatter = logging.Formatter( + fmt='%(asctime)s.%(msecs)03d %(levelname)s:%(message)s', + datefmt='%Y-%m-%dT%H:%M:%S', + ) + handler.setFormatter(formatter) + logging.getLogger().addHandler(handler) + + try: + _analyze(args) + except: + log.exception('error generating coverage') + raise + +def _analyze(args): tests = [ f for f in sorted(os.listdir(args.test_dir)) - if not f.startswith('.') + if not f.startswith('.') and os.path.isdir(f) and os.path.exists(os.path.join(args.test_dir, f, 'summary.yaml')) and os.path.exists(os.path.join(args.test_dir, f, 'ceph-sha1'))] diff --git a/teuthology/suite.py b/teuthology/suite.py index 56edceef6803b..6994215136d20 100644 --- a/teuthology/suite.py +++ b/teuthology/suite.py @@ -157,7 +157,7 @@ def ls(): args = parser.parse_args() for j in sorted(os.listdir(args.archive_dir)): - if j.startswith('.'): + if j.startswith('.') or os.path.isdir(j): continue summary = {} @@ -206,6 +206,7 @@ def ls(): print ' {reason}'.format(reason=summary['failure_reason']) def generate_coverage(args): + log.info('starting coverage generation') subprocess.Popen( args=[ os.path.join(os.path.dirname(sys.argv[0]), 'teuthology-coverage'), @@ -221,6 +222,7 @@ def generate_coverage(args): ) def email_results(subject, from_, to, body): + log.info('Sending results to {to}: {body}'.format(to=to, body=body)) import smtplib from email.mime.text import MIMEText msg = MIMEText(body) @@ -272,9 +274,26 @@ def results(): teuthology.read_config(args) + handler = logging.FileHandler( + filename=os.path.join(args.archive_dir, 'results.log'), + ) + formatter = logging.Formatter( + fmt='%(asctime)s.%(msecs)03d %(levelname)s:%(message)s', + datefmt='%Y-%m-%dT%H:%M:%S', + ) + handler.setFormatter(formatter) + logging.getLogger().addHandler(handler) + + try: + _results(args) + except: + log.exception('error generating results') + raise + +def _results(args): running_tests = [ f for f in sorted(os.listdir(args.archive_dir)) - if not f.startswith('.') + if not f.startswith('.') and os.path.isdir(f) and not os.path.exists(os.path.join(args.archive_dir, f, 'summary.yaml')) ] starttime = time.time()