Allow optional collection of code coverage information with gcc

This commit is contained in:
Ray Speth 2012-01-18 23:44:57 +00:00
parent cf80213e6b
commit 4ab232da44
2 changed files with 17 additions and 0 deletions

2
.gitignore vendored
View file

@ -25,3 +25,5 @@ config.log
.pydevproject
.settings
Cantera/matlab/build_cantera.m
*.gcda
*.gcno

View file

@ -222,6 +222,11 @@ opts.AddVariables(
'debug',
"""Enable extra printing code to aid in debugging.""",
False),
BoolVariable(
'coverage',
"""Enable collection of code coverage information with gcov.
Available only when compiling with gcc.""",
False),
BoolVariable(
'with_lattice_solid',
"""Include thermodynamic model for lattice solids in the
@ -709,6 +714,16 @@ else:
env['CCFLAGS'] = listify(env['cc_flags']) + listify(env['debug_flags'])
env['LINKFLAGS'] += listify(defaults.debugLinkFlags)
if env['coverage']:
if env['CC'] == 'gcc':
env.Append(CCFLAGS=['-fprofile-arcs', '-ftest-coverage'])
env.Append(LINKFLAGS=['-fprofile-arcs', '-ftest-coverage'])
# ipdb()
else:
print 'Error: coverage testing is only available with GCC'
exit(0)
# **************************************
# *** Set options needed in config.h ***
# **************************************