]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
suite: log results and coverage generation
authorJosh Durgin <josh.durgin@dreamhost.com>
Fri, 16 Mar 2012 18:40:17 +0000 (11:40 -0700)
committerJosh Durgin <josh.durgin@dreamhost.com>
Fri, 16 Mar 2012 18:44:13 +0000 (11:44 -0700)
Need to figure out where and when results emails are failing.

teuthology/coverage.py
teuthology/suite.py

index b68b7961f8dfeb0edf6f0d6e28a9e774ab1e7c5b..9bdc498202c0e3392bf0b2ce8ffe220ffa76a460 100644 (file)
@@ -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'))]
 
index 56edceef6803ba800d60b80938736ae9694e4ba8..6994215136d209345fc29abf91cf81ac8f3f81e1 100644 (file)
@@ -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()