]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Add coverage support.
authorJosh Durgin <josh.durgin@dreamhost.com>
Tue, 7 Jun 2011 18:45:29 +0000 (11:45 -0700)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Fri, 10 Jun 2011 00:17:47 +0000 (17:17 -0700)
teuthology/misc.py
teuthology/task/autotest.py
teuthology/task/ceph.py
teuthology/task/cfuse.py

index bc98477f5ef302e8f49314e61e3c233c63379602..f1243938f1417f72db7a8f26efe63338974cd4c5 100644 (file)
@@ -152,6 +152,8 @@ def create_simple_monmap(remote, conf):
     log.debug('Ceph mon addresses: %s', addresses)
 
     args = [
+        '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+        '/tmp/cephtest/coverage',
         '/tmp/cephtest/binary/usr/local/bin/monmaptool',
         '--create',
         '--clobber',
@@ -197,6 +199,8 @@ def wait_until_healthy(remote):
     while True:
         r = remote.run(
             args=[
+                '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                '/tmp/cephtest/coverage',
                 '/tmp/cephtest/binary/usr/local/bin/ceph',
                 '-c', '/tmp/cephtest/ceph.conf',
                 'health',
index 1beb451a8ec6b1bf19f0d7a5471dc5dfb4afb52c..544e11ee6db75e743367cb2e327ff3d5121c6b91 100644 (file)
@@ -104,6 +104,8 @@ def task(ctx, config):
                 )
             remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    '/tmp/cephtest/coverage',
                     '/tmp/cephtest/autotest/client/bin/autotest',
                     '--verbose',
                     '--harness=simple',
index 16908c7b0b674be88e02409215bae2207ebd7e90..98e5a92663e0de6fd64a89e3519b359852539943 100644 (file)
@@ -44,6 +44,8 @@ def task(ctx, config):
     """
     if config is None:
         config = {}
+    assert isinstance(config, dict), \
+        "task ceph only supports a dictionary for configuration"
 
     flavor = None
     if config.get('coverage'):
@@ -68,6 +70,7 @@ def task(ctx, config):
     if failed:
         raise RuntimeError('Stale jobs detected, aborting.')
 
+    coverage_dir = '/tmp/cephtest/archive/coverage'
     log.info('Creating directories...')
     run.wait(
         ctx.cluster.run(
@@ -78,6 +81,7 @@ def task(ctx, config):
                 '/tmp/cephtest/archive/log',
                 '/tmp/cephtest/archive/profiling-logger',
                 '/tmp/cephtest/data',
+                coverage_dir,
                 ],
             wait=False,
             )
@@ -151,6 +155,8 @@ def task(ctx, config):
     log.info('Setting up mon.0...')
     ctx.cluster.only('mon.0').run(
         args=[
+            '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+            coverage_dir,
             '/tmp/cephtest/binary/usr/local/bin/cauthtool',
             '--create-keyring',
             '/tmp/cephtest/ceph.keyring',
@@ -158,6 +164,8 @@ def task(ctx, config):
         )
     ctx.cluster.only('mon.0').run(
         args=[
+            '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+            coverage_dir,
             '/tmp/cephtest/binary/usr/local/bin/cauthtool',
             '--gen-key',
             '--name=mon.',
@@ -173,6 +181,8 @@ def task(ctx, config):
     log.info('Creating admin key on mon.0...')
     ctx.cluster.only('mon.0').run(
         args=[
+            '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+            coverage_dir,
             '/tmp/cephtest/binary/usr/local/bin/cauthtool',
             '--gen-key',
             '--name=client.admin',
@@ -214,6 +224,8 @@ def task(ctx, config):
     run.wait(
         mons.run(
             args=[
+                '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                coverage_dir,
                 '/tmp/cephtest/binary/usr/local/bin/osdmaptool',
                 '--clobber',
                 '--createsimple', '{num:d}'.format(
@@ -231,6 +243,8 @@ def task(ctx, config):
         for id_ in teuthology.roles_of_type(roles_for_host, 'mon'):
             remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
                     '/tmp/cephtest/binary/usr/local/bin/cmon',
                     '--mkfs',
                     '-i', id_,
@@ -259,6 +273,8 @@ def task(ctx, config):
         for id_ in teuthology.roles_of_type(roles_for_host, 'mon'):
             proc = remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
                     '/tmp/cephtest/daemon-helper',
                     '/tmp/cephtest/binary/usr/local/bin/cmon',
                     '-f',
@@ -277,6 +293,8 @@ def task(ctx, config):
         for id_ in teuthology.roles_of_type(roles_for_host, 'osd'):
             remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
                     '/tmp/cephtest/binary/usr/local/bin/cauthtool',
                     '--create-keyring',
                     '--gen-key',
@@ -291,6 +309,8 @@ def task(ctx, config):
         for id_ in teuthology.roles_of_type(roles_for_host, 'mds'):
             remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
                     '/tmp/cephtest/binary/usr/local/bin/cauthtool',
                     '--create-keyring',
                     '--gen-key',
@@ -305,6 +325,8 @@ def task(ctx, config):
         for id_ in teuthology.roles_of_type(roles_for_host, 'client'):
             remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
                     '/tmp/cephtest/binary/usr/local/bin/cauthtool',
                     '--create-keyring',
                     '--gen-key',
@@ -337,6 +359,8 @@ def task(ctx, config):
             )
         mon0_remote.run(
             args=[
+                '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                coverage_dir,
                 '/tmp/cephtest/binary/usr/local/bin/cauthtool',
                 '/tmp/cephtest/temp.keyring',
                 '--name={type}.{id}'.format(
@@ -347,6 +371,8 @@ def task(ctx, config):
             )
         mon0_remote.run(
             args=[
+                '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                coverage_dir,
                 '/tmp/cephtest/binary/usr/local/bin/ceph',
                 '-c', '/tmp/cephtest/ceph.conf',
                 '-k', '/tmp/cephtest/ceph.keyring',
@@ -364,6 +390,8 @@ def task(ctx, config):
     # TODO where does this belong?
     mon0_remote.run(
         args=[
+            '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+            coverage_dir,
             '/tmp/cephtest/binary/usr/local/bin/ceph',
             '-c', '/tmp/cephtest/ceph.conf',
             '-k', '/tmp/cephtest/ceph.keyring',
@@ -386,6 +414,8 @@ def task(ctx, config):
                 )
             remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
                     '/tmp/cephtest/binary/usr/local/bin/cosd',
                     '--mkfs',
                     '-i', id_,
@@ -399,6 +429,8 @@ def task(ctx, config):
         for id_ in teuthology.roles_of_type(roles_for_host, 'osd'):
             proc = remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
                     '/tmp/cephtest/daemon-helper',
                     '/tmp/cephtest/binary/usr/local/bin/cosd',
                     '-f',
@@ -417,6 +449,8 @@ def task(ctx, config):
         for id_ in teuthology.roles_of_type(roles_for_host, 'mds'):
             proc = remote.run(
                 args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
                     '/tmp/cephtest/daemon-helper',
                     '/tmp/cephtest/binary/usr/local/bin/cmds',
                     '-f',
@@ -438,20 +472,32 @@ def task(ctx, config):
     try:
         yield
     finally:
-        log.info('Shutting down mds daemons...')
-        for id_, proc in mds_daemons.iteritems():
-            proc.stdin.close()
-        run.wait(mds_daemons.itervalues())
-
-        log.info('Shutting down osd daemons...')
-        for id_, proc in osd_daemons.iteritems():
-            proc.stdin.close()
-        run.wait(osd_daemons.itervalues())
-
-        log.info('Shutting down mon daemons...')
-        for id_, proc in mon_daemons.iteritems():
-            proc.stdin.close()
-        run.wait(mon_daemons.itervalues())
+        if config.get('coverage'):
+            # need to exit cleanly to trigger atexit coverage data writing
+            mon0_remote.run(
+                args=[
+                    '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                    coverage_dir,
+                    '/tmp/cephtest/binary/usr/local/bin/ceph',
+                    '-c', '/tmp/cephtest/ceph.conf',
+                    'all_exit'
+                    ]
+                )
+        else:
+            log.info('Shutting down mds daemons...')
+            for id_, proc in mds_daemons.iteritems():
+                proc.stdin.close()
+            run.wait(mds_daemons.itervalues())
+
+            log.info('Shutting down osd daemons...')
+            for id_, proc in osd_daemons.iteritems():
+                proc.stdin.close()
+            run.wait(osd_daemons.itervalues())
+
+            log.info('Shutting down mon daemons...')
+            for id_, proc in mon_daemons.iteritems():
+                proc.stdin.close()
+            run.wait(mon_daemons.itervalues())
 
         log.info('Removing uninteresting files...')
         run.wait(
index 00cfdc2bc49874a15d0257ec9f34a95fcd55a6ff..7988bc9739d9bfb068f3d19ce947547439f34cd9 100644 (file)
@@ -42,6 +42,8 @@ def task(ctx, config):
             )
         proc = remote.run(
             args=[
+                '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
+                '/tmp/cephtest/coverage',
                 '/tmp/cephtest/daemon-helper',
                 '/tmp/cephtest/binary/usr/local/bin/cfuse',
                 '-f',