author | melunko |
Wed Feb 27 11:00:07 2008 +0000 (2008-02-27) | |
branch | trunk |
changeset 931 | e8e3219edf5f |
parent 624 | f41dd580496b |
permissions | -rwxr-xr-x |
rosfran@597 | 1 |
#!/usr/bin/python |
rosfran@597 | 2 |
|
rosfran@597 | 3 |
import re |
rosfran@597 | 4 |
import sys |
rosfran@597 | 5 |
import os |
rosfran@597 | 6 |
import shutil |
rosfran@598 | 7 |
from testing_tools import is_coverage, get_gcda |
rosfran@597 | 8 |
|
rosfran@597 | 9 |
def build_dir(exe): |
rosfran@597 | 10 |
t = get_gcda(exe) |
rosfran@618 | 11 |
a = re.search("(/.*)/tests/.*" ,t) |
rosfran@618 | 12 |
print "GMyth base build directory - %s" % a.groups()[0] |
rosfran@597 | 13 |
return a.groups()[0] |
rosfran@597 | 14 |
|
rosfran@624 | 15 |
def remove_all_gcov_info(base_dir): |
rosfran@637 | 16 |
os.system('for gfile in `find ' + base_dir + ' -name \"*.gcov\" -print`; do rm -f $gfile; done') |
rosfran@624 | 17 |
|
rosfran@597 | 18 |
def gen_cov_info(build_dir): |
rosfran@624 | 19 |
# remove all the useless GCOV information |
rosfran@624 | 20 |
remove_all_gcov_info(build_dir) |
rosfran@597 | 21 |
if os.path.exists('coverage'): |
rosfran@597 | 22 |
shutil.rmtree('coverage') |
rosfran@597 | 23 |
os.mkdir('coverage') |
rosfran@623 | 24 |
os.chdir('coverage') |
rosfran@618 | 25 |
#base_dir = '../' + os.environ['top_srcdir'] + '/src' |
rosfran@618 | 26 |
#base_dir = build_dir + '/tests' |
rosfran@624 | 27 |
os.system('lcov -d ' + build_dir + '/src -b ' + build_dir + '/src --compat-libtool -z') |
rosfran@624 | 28 |
os.system('lcov -d ' + build_dir + '/src -b ' + build_dir + '/src --compat-libtool -c -o gmyth.info') |
rosfran@618 | 29 |
#os.system('lcov -d ' + build_dir + ' -z') |
rosfran@618 | 30 |
#os.system('lcov -d ' + build_dir + ' -c -o gmyth.info') |
rosfran@623 | 31 |
os.system('genhtml gmyth.info') |
rosfran@597 | 32 |
|
rosfran@618 | 33 |
exe = 'gmyth_test_connection' |
rosfran@601 | 34 |
exe = [ '.libs/' + exe ] |
rosfran@597 | 35 |
if is_coverage(exe): |
rosfran@597 | 36 |
bdir = build_dir(exe) |
rosfran@597 | 37 |
gen_cov_info(bdir) |
rosfran@597 | 38 |
sys.exit(0) |