From 31b5ccbf1b09c7d11ee2d3ebcbed1993359baf31 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 13 Dec 2011 16:16:09 -0800 Subject: [PATCH] coverage: use locally stored build instead of downloading from a gitbuilder --- coverage/cov-init.sh | 8 ++++---- teuthology/coverage.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/coverage/cov-init.sh b/coverage/cov-init.sh index cf5cebf9c0..e3afb99615 100755 --- a/coverage/cov-init.sh +++ b/coverage/cov-init.sh @@ -2,14 +2,15 @@ set -e usage () { - printf '%s: usage: %s TEST_DIR OUTPUT_DIR\n' "$(basename "$0")" "$(basename "$0")" 1>&2 + printf '%s: usage: %s TEST_DIR OUTPUT_DIR CEPH_BUILD_TARBALL\n' "$(basename "$0")" "$(basename "$0")" 1>&2 exit 1 } TEST_DIR=$1 OUTPUT_DIR=$2 +CEPH_TARBALL=$3 -if [ -z "$TEST_DIR" ] || [ -z "$OUTPUT_DIR" ]; then +if [ -z "$TEST_DIR" ] || [ -z "$OUTPUT_DIR" ] || [ -z "$CEPH_TARBALL" ]; then usage fi @@ -19,8 +20,7 @@ mkdir -p $OUTPUT_DIR/ceph echo "Retrieving source and .gcno files..." wget -q -O- "https://github.com/NewDreamNetwork/ceph/tarball/$SHA1" | tar xzf - --strip-components=1 -C $OUTPUT_DIR/ceph -wget "http://gitbuilder-gcov-amd64.ceph.newdream.net/output/sha1/$SHA1/ceph.x86_64.tgz" -P $OUTPUT_DIR -tar zxf $OUTPUT_DIR/ceph.x86_64.tgz -C $OUTPUT_DIR +tar zxf $CEPH_TARBALL -C $OUTPUT_DIR cp $OUTPUT_DIR/usr/local/lib/ceph/coverage/*.gcno $OUTPUT_DIR/ceph/src mkdir $OUTPUT_DIR/ceph/src/.libs cp $OUTPUT_DIR/usr/local/lib/ceph/coverage/.libs/*.gcno $OUTPUT_DIR/ceph/src/.libs diff --git a/teuthology/coverage.py b/teuthology/coverage.py index eb9df9d0ce..b68b7961f8 100644 --- a/teuthology/coverage.py +++ b/teuthology/coverage.py @@ -12,7 +12,6 @@ from teuthology import misc as teuthology log = logging.getLogger(__name__) def connect_to_db(ctx): - teuthology.read_config(ctx) db = MySQLdb.connect( host=ctx.teuthology_config['coverage_db_host'], user=ctx.teuthology_config['coverage_db_user'], @@ -109,6 +108,8 @@ Analyze the coverage of a suite of test runs, generating html output with lcov. level=loglevel, ) + teuthology.read_config(args) + tests = [ f for f in sorted(os.listdir(args.test_dir)) if not f.startswith('.') @@ -130,6 +131,8 @@ Analyze the coverage of a suite of test runs, generating html output with lcov. assert len(test_summaries) > 0 + suite = os.path.basename(args.test_dir) + # only run cov-init once. # this only works if all tests were run against the same version. if not args.skip_init: @@ -139,6 +142,10 @@ Analyze the coverage of a suite of test runs, generating html output with lcov. os.path.join(args.cov_tools_dir, 'cov-init.sh'), os.path.join(args.test_dir, tests[0]), args.lcov_output, + os.path.join( + args.teuthology_config['ceph_build_output_dir'], + '{suite}.tgz'.format(suite=suite), + ), ]) shutil.copy( os.path.join(args.lcov_output, 'base.lcov'), @@ -180,7 +187,6 @@ Analyze the coverage of a suite of test runs, generating html output with lcov. os.path.join(args.lcov_output, 'total.lcov') ) - suite = os.path.basename(args.test_dir) coverage = read_coverage(output) test_coverage['total for {suite}'.format(suite=suite)] = coverage log.debug('total coverage is %s', str(coverage)) -- 2.39.5