diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 04:35:18 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 04:35:18 +0000 |
commit | f5ecbba1f92417edf8759d93904e12cfe9a2d0b4 (patch) | |
tree | 88eb8f6e89012dd41189a478fa6e263569a23ffa /build | |
parent | a6cf87ec511a64fc29c0bda5cf83ec282d34be59 (diff) | |
download | chromium_src-f5ecbba1f92417edf8759d93904e12cfe9a2d0b4.zip chromium_src-f5ecbba1f92417edf8759d93904e12cfe9a2d0b4.tar.gz chromium_src-f5ecbba1f92417edf8759d93904e12cfe9a2d0b4.tar.bz2 |
Start of code coverage for Mac.
Only base_unittests included for now. Linux changes added as well but
untested until Linux switches to gyp.
Enable coverage with the following command:
src/tools/gyp/gyp_dogfood -Dcoverage=1 src/build/all.gyp
Review URL: http://codereview.chromium.org/56136
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13068 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build')
-rw-r--r-- | build/common.gypi | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/build/common.gypi b/build/common.gypi index 07b4f5f..2ddf44f 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -25,6 +25,12 @@ # Override branding to select the desired branding flavor. 'branding%': 'Chromium', + + # Set to 1 to enable code coverage. In addition to build changes + # (e.g. extra CFLAGS), also creates a new target in the src/chrome + # project file called "coverage". + # Currently ignored on Windows. + 'coverage%': 0, }, 'target_defaults': { 'conditions': [ @@ -33,6 +39,35 @@ }, { # else: branding!="Chrome" 'defines': ['CHROMIUM_BUILD'], }], + ['coverage!=0', { + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES', + 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES', + }, + # Add -lgcov for executables, not for static_libraries. + # This is a delayed conditional. + 'target_conditions': [ + ['_type=="executable"', { + 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] }, + }], + ], + }], + # TODO(jrg): complete this work once Linux transitions to gyp. + # This is untested (--> likely doesn't work). + ['OS=="linux"', { + 'cflags': [ '-ftest-coverage', + '-fprofile-arcs' ], + 'target_conditions': [ + ['_type=="executable"', { + 'link_settings': { 'libraries': [ '-lgcov' ] }, + }], + ], + }], + ]}, + # TODO(jrg): options for code coverage on Windows + ], ], 'default_configuration': 'Debug', 'configurations': { |