2011-06-21 17:00:16 +00:00
|
|
|
import argparse
|
2011-07-01 16:32:30 +00:00
|
|
|
import errno
|
2011-06-21 17:00:16 +00:00
|
|
|
import itertools
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = argparse.ArgumentParser(description="""
|
|
|
|
Run a suite of ceph integration tests.
|
|
|
|
|
|
|
|
A suite is a directory containing facets.
|
|
|
|
|
|
|
|
A facet is a directory containing config snippets.
|
|
|
|
|
|
|
|
Running the suite means running teuthology for every configuration
|
|
|
|
combination generated by taking one config snippet from each facet.
|
|
|
|
|
|
|
|
Any config files passed on the command line will be used for every
|
2011-07-07 23:19:26 +00:00
|
|
|
combination, and will override anything in the suite.
|
2011-06-21 17:00:16 +00:00
|
|
|
""")
|
|
|
|
parser.add_argument(
|
|
|
|
'-v', '--verbose',
|
|
|
|
action='store_true', default=None,
|
|
|
|
help='be more verbose',
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
'--suite',
|
|
|
|
metavar='DIR',
|
|
|
|
help='suite of tests to run',
|
|
|
|
required=True,
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
2011-07-11 19:52:07 +00:00
|
|
|
'--owner',
|
|
|
|
help='job owner',
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
'--name',
|
|
|
|
help='name for this suite',
|
2011-06-21 17:00:16 +00:00
|
|
|
required=True,
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
'config',
|
|
|
|
metavar='CONFFILE',
|
|
|
|
nargs='*',
|
|
|
|
default=[],
|
|
|
|
help='config file to read',
|
|
|
|
)
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
loglevel = logging.INFO
|
|
|
|
if args.verbose:
|
|
|
|
loglevel = logging.DEBUG
|
|
|
|
|
|
|
|
logging.basicConfig(
|
|
|
|
level=loglevel,
|
|
|
|
)
|
|
|
|
|
|
|
|
facets = [
|
2011-06-21 17:19:35 +00:00
|
|
|
f for f in sorted(os.listdir(args.suite))
|
2011-06-21 17:00:16 +00:00
|
|
|
if not f.startswith('.')
|
|
|
|
and os.path.isdir(os.path.join(args.suite, f))
|
|
|
|
]
|
|
|
|
facet_configs = (
|
2011-06-21 17:19:35 +00:00
|
|
|
[(f, name, os.path.join(args.suite, f, name))
|
|
|
|
for name in sorted(os.listdir(os.path.join(args.suite, f)))
|
2011-06-21 17:00:16 +00:00
|
|
|
if not name.startswith('.')
|
|
|
|
and name.endswith('.yaml')
|
|
|
|
]
|
|
|
|
for f in facets
|
|
|
|
)
|
|
|
|
for configs in itertools.product(*facet_configs):
|
2011-06-28 21:44:52 +00:00
|
|
|
description=' '.join('{facet}:{name}'.format(facet=facet, name=name)
|
2011-06-21 17:00:16 +00:00
|
|
|
for facet, name, path in configs)
|
2011-06-28 21:44:52 +00:00
|
|
|
log.info(
|
2011-07-11 19:52:07 +00:00
|
|
|
'Running teuthology-schedule with facets %s', description
|
2011-06-21 17:00:16 +00:00
|
|
|
)
|
|
|
|
arg = [
|
2011-07-11 19:52:07 +00:00
|
|
|
os.path.join(os.path.dirname(sys.argv[0]), 'teuthology-schedule'),
|
2011-06-21 17:00:16 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
if args.verbose:
|
|
|
|
arg.append('-v')
|
|
|
|
|
2011-07-11 19:52:07 +00:00
|
|
|
if args.owner:
|
|
|
|
arg.extend(['--owner', args.owner])
|
|
|
|
|
2011-07-07 23:19:26 +00:00
|
|
|
arg.extend([
|
2011-07-11 19:52:07 +00:00
|
|
|
'--name', args.name,
|
|
|
|
'--description', description,
|
2011-07-07 23:19:26 +00:00
|
|
|
'--',
|
|
|
|
])
|
2011-06-21 17:00:16 +00:00
|
|
|
|
|
|
|
arg.extend(path for facet, name, path in configs)
|
|
|
|
arg.extend(args.config)
|
2011-07-11 19:52:07 +00:00
|
|
|
subprocess.check_call(
|
|
|
|
args=arg,
|
|
|
|
)
|
2011-06-29 19:54:53 +00:00
|
|
|
|
|
|
|
def ls():
|
|
|
|
parser = argparse.ArgumentParser(description='List teuthology job results')
|
|
|
|
parser.add_argument(
|
|
|
|
'--archive-dir',
|
|
|
|
metavar='DIR',
|
|
|
|
help='path under which to archive results',
|
|
|
|
required=True,
|
|
|
|
)
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
import yaml
|
2011-07-01 16:29:19 +00:00
|
|
|
|
2011-06-29 19:54:53 +00:00
|
|
|
for j in sorted(os.listdir(args.archive_dir)):
|
|
|
|
if j.startswith('.'):
|
|
|
|
continue
|
2011-07-01 16:29:19 +00:00
|
|
|
|
2011-07-01 16:33:06 +00:00
|
|
|
summary = {}
|
2011-06-29 19:54:53 +00:00
|
|
|
try:
|
|
|
|
with file('%s/%s/summary.yaml' % (args.archive_dir,j)) as f:
|
|
|
|
g = yaml.safe_load_all(f)
|
|
|
|
for new in g:
|
2011-06-30 18:25:15 +00:00
|
|
|
summary.update(new)
|
2011-06-29 19:54:53 +00:00
|
|
|
except IOError, e:
|
2011-07-01 16:32:30 +00:00
|
|
|
if e.errno == errno.ENOENT:
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
raise
|
2011-06-29 19:54:53 +00:00
|
|
|
|
|
|
|
print "{job} {success} {owner} {desc}".format(
|
|
|
|
job=j,
|
2011-07-01 16:34:08 +00:00
|
|
|
owner=summary.get('owner', '-'),
|
|
|
|
desc=summary.get('description', '-'),
|
2011-06-29 19:54:53 +00:00
|
|
|
success='pass' if summary['success'] else 'FAIL',
|
|
|
|
)
|