From a65d4136e51e4442066a8be1ee88d45c4188af6f Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 19 Mar 2012 14:16:14 -0700 Subject: [PATCH] suite, coverage: use absolute dirs for isdir checks This fixes the results to wait for all jobs to complete again. --- teuthology/coverage.py | 3 ++- teuthology/suite.py | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/teuthology/coverage.py b/teuthology/coverage.py index 9bdc498202c0e..d49d804f744ba 100644 --- a/teuthology/coverage.py +++ b/teuthology/coverage.py @@ -130,7 +130,8 @@ Analyze the coverage of a suite of test runs, generating html output with lcov. def _analyze(args): tests = [ f for f in sorted(os.listdir(args.test_dir)) - if not f.startswith('.') and os.path.isdir(f) + if not f.startswith('.') + and os.path.isdir(os.path.join(args.test_dir, 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 9ebf368c08178..aaaa8cc45b11f 100644 --- a/teuthology/suite.py +++ b/teuthology/suite.py @@ -157,12 +157,13 @@ def ls(): args = parser.parse_args() for j in sorted(os.listdir(args.archive_dir)): - if j.startswith('.') or not os.path.isdir(j): + job_dir = os.path.join(args.archive_dir, j) + if j.startswith('.') or not os.path.isdir(job_dir): continue summary = {} try: - with file('%s/%s/summary.yaml' % (args.archive_dir, j)) as f: + with file(os.path.join(job_dir, 'summary.yaml')) as f: g = yaml.safe_load_all(f) for new in g: summary.update(new) @@ -172,7 +173,7 @@ def ls(): # pid try: - pidfile = '%s/%s/pid' % (args.archive_dir, j) + pidfile = os.path.join(job_dir, 'pid') found = False if os.path.isfile(pidfile): pid = open(pidfile, 'r').read() @@ -293,7 +294,8 @@ def results(): def _results(args): running_tests = [ f for f in sorted(os.listdir(args.archive_dir)) - if not f.startswith('.') and os.path.isdir(f) + if not f.startswith('.') + and os.path.isdir(os.path.join(args.archive_dir, f)) and not os.path.exists(os.path.join(args.archive_dir, f, 'summary.yaml')) ] starttime = time.time() @@ -318,9 +320,10 @@ def _results(args): passed = [] all_jobs = sorted(os.listdir(args.archive_dir)) for j in all_jobs: - if j.startswith('.'): + job_dir = os.path.join(args.archive_dir, j) + if j.startswith('.') or not os.path.isdir(job_dir): continue - summary_fn = os.path.join(args.archive_dir, j, 'summary.yaml') + summary_fn = os.path.join(job_dir, 'summary.yaml') if not os.path.exists(summary_fn): unfinished.append(j) continue -- 2.39.5