diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-02-21 00:36:28 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-02-21 00:36:28 +0200 |
commit | f7d7888b700bb7e684ec8a0cd3e4ef0aca8599fc (patch) | |
tree | 8e475f65023b2cdf36ed693abf886fccbc750100 /environment.py | |
parent | 9418ece26a83c3c9925ace74eef20b3c19058bbb (diff) | |
download | meson-f7d7888b700bb7e684ec8a0cd3e4ef0aca8599fc.zip meson-f7d7888b700bb7e684ec8a0cd3e4ef0aca8599fc.tar.gz meson-f7d7888b700bb7e684ec8a0cd3e4ef0aca8599fc.tar.bz2 |
Added support for coverage.
Diffstat (limited to 'environment.py')
-rwxr-xr-x | environment.py | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/environment.py b/environment.py index 1dda393..86ef9bc 100755 --- a/environment.py +++ b/environment.py @@ -52,10 +52,16 @@ class CCompiler(): def get_debug_flags(self): return ['-g'] - + + def get_coverage_flags(self): + return ['--coverage'] + + def get_coverage_link_flags(self): + return ['-lgcov'] + def get_std_exe_link_flags(self): return [] - + def get_include_arg(self, path): return '-I' + path @@ -167,7 +173,7 @@ class GnuCXXCompiler(CXXCompiler): class ClangCXXCompiler(CXXCompiler): std_warn_flags = ['-Wall', '-Winvalid-pch'] std_opt_flags = ['-O2'] - + def __init__(self, exelist): CXXCompiler.__init__(self, exelist) @@ -191,10 +197,32 @@ class ArLinker(): def get_std_link_flags(self): return self.std_flags - + def get_output_flags(self): return [] + def get_coverage_link_flags(self): + return [] + +def find_coverage_tools(): + gcovr_exe = 'gcovr' + lcov_exe = 'lcov' + genhtml_exe = 'genhtml' + + pg = subprocess.Popen([gcovr_exe, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + pg.communicate() + if pg.returncode != 0: + gcovr_exe = None + pl = subprocess.Popen([lcov_exe, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + pl.communicate() + if pl.returncode != 0: + lcov_exe = None + ph = subprocess.Popen([genhtml_exe, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + ph.communicate() + if ph.returncode != 0: + genhtml_exe = None + return (gcovr_exe, lcov_exe, genhtml_exe) + header_suffixes = ['h', 'hh', 'hpp', 'hxx', 'H'] class Environment(): |