summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormad@google.com <mad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 17:34:05 +0000
committermad@google.com <mad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 17:34:05 +0000
commit8359e1daaf68988eecf129d3284eebf80e933a96 (patch)
treec0e299859af7ee18d6ec01288d971e31a88c01d8
parente453b77b771a08563748e1850ba680121f620c4a (diff)
downloadchromium_src-8359e1daaf68988eecf129d3284eebf80e933a96.zip
chromium_src-8359e1daaf68988eecf129d3284eebf80e933a96.tar.gz
chromium_src-8359e1daaf68988eecf129d3284eebf80e933a96.tar.bz2
Adding support for Code Coverage.
BUG=34671 TEST=Make sure all Chrome Frame tests still pass... Review URL: http://codereview.chromium.org/3166003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55746 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome_frame/chrome_frame.gyp179
1 files changed, 166 insertions, 13 deletions
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp
index 7d36d33..0f996ae 100644
--- a/chrome_frame/chrome_frame.gyp
+++ b/chrome_frame/chrome_frame.gyp
@@ -45,6 +45,8 @@
],
'target_defaults': {
'dependencies': [
+ # locales need to be built for the chrome frame binaries to be loadable.
+ '../chrome/app/locales/locales.gyp:*',
'../chrome/chrome.gyp:chrome_resources',
'../chrome/chrome.gyp:chrome_strings',
'../chrome/chrome.gyp:theme_resources',
@@ -113,29 +115,17 @@
{
'target_name': 'chrome_frame_unittests',
'type': 'executable',
- 'msvs_guid': '17D98CCA-0F6A-470F-9DF9-56DC6CC1A0BE',
'dependencies': [
- '../build/temp_gyp/googleurl.gyp:googleurl',
- '../chrome/chrome.gyp:browser',
- '../chrome/chrome.gyp:common',
- '../chrome/chrome.gyp:debugger',
- '../chrome/chrome.gyp:nacl',
- '../chrome/chrome.gyp:renderer',
- '../chrome/chrome.gyp:utility',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
- 'base_noicu',
'chrome_frame_ie',
- 'chrome_frame_npapi',
'chrome_frame_strings',
- 'xulrunner_sdk',
],
'sources': [
'chrome_tab.h',
'chrome_tab.idl',
'chrome_frame_histograms.h',
'chrome_frame_histograms.cc',
- 'chrome_frame_npapi_unittest.cc',
'chrome_frame_unittest_main.cc',
'chrome_launcher.cc',
'chrome_launcher.h',
@@ -169,6 +159,32 @@
'<(SHARED_INTERMEDIATE_DIR)',
],
'conditions': [
+ # We needed to extract this test from the chrome_frame_unittests because
+ # we can't instrument code for coverage if it depends on 3rd party
+ # binaries that we don't have PDBs for. See here for more details:
+ # http://connect.microsoft.com/VisualStudio/feedback/details/176188/can-not-disable-warning-lnk4099
+ ['coverage==0', {
+ 'dependencies': [
+ 'chrome_frame_npapi',
+ 'xulrunner_sdk',
+ ],
+ 'sources': [
+ 'chrome_frame_npapi_unittest.cc',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'DelayLoadDLLs': ['xpcom.dll', 'nspr4.dll'],
+ },
+ },
+ 'dependencies': [
+ # TODO(slightlyoff): Get automation targets working on OS X
+ '../chrome/chrome.gyp:automation',
+ ],
+ }],
+ ],
+ }],
['OS=="win"', {
'link_settings': {
'libraries': [
@@ -177,7 +193,7 @@
},
'msvs_settings': {
'VCLinkerTool': {
- 'DelayLoadDLLs': ['xpcom.dll', 'nspr4.dll', 'shdocvw.dll'],
+ 'DelayLoadDLLs': ['shdocvw.dll'],
},
},
'dependencies': [
@@ -806,6 +822,143 @@
],
},
],
+ 'conditions': [
+ # To enable the coverage targets, do
+ # GYP_DEFINES='coverage=1' gclient sync
+ ['coverage!=0',
+ { 'targets': [
+ {
+ # Coverage BUILD AND RUN.
+ # Not named coverage_build_and_run for historical reasons.
+ 'target_name': 'gcf_coverage',
+ 'dependencies': [ 'gcf_coverage_build', 'gcf_coverage_run' ],
+ # do NOT place this in the 'all' list; most won't want it.
+ 'suppress_wildcard': 1,
+ 'type': 'none',
+ 'actions': [
+ {
+ 'message': 'Coverage is now complete.',
+ # MSVS must have an input file and an output file.
+ 'inputs': [ '<(PRODUCT_DIR)/gcf_coverage.info' ],
+ 'outputs': [ '<(PRODUCT_DIR)/gcf_coverage-build-and-run.stamp' ],
+ 'action_name': 'gcf_coverage',
+ # Wish gyp had some basic builtin commands (e.g. 'touch').
+ 'action': [ 'python', '-c',
+ 'import os; ' \
+ 'open(' \
+ '\'<(PRODUCT_DIR)\' + os.path.sep + ' \
+ '\'gcf_coverage-build-and-run.stamp\'' \
+ ', \'w\').close()' ],
+ # Use outputs of this action as inputs for the main target build.
+ # Seems as a misnomer but makes this happy on Linux (scons).
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ # Coverage BUILD. Compile only; does not run the bundles.
+ # Intended as the build phase for our coverage bots.
+ #
+ # Builds unit test bundles needed for coverage.
+ # Outputs this list of bundles into coverage_bundles.py.
+ #
+ # If you want to both build and run coverage from your IDE,
+ # use the 'coverage' target.
+ {
+ 'target_name': 'gcf_coverage_build',
+ 'suppress_wildcard': 1,
+ 'type': 'none',
+ 'dependencies': [
+ # Some tests are disabled because they depend on browser.lib which
+ # has some trouble to link with instrumentation. Until this is
+ # fixed on the Chrome side we won't get complete coverage from
+ # our tests but we at least get the process rolling...
+ # TODO(mad): FIX THIS!
+ #'chrome_frame_net_tests',
+ #'chrome_frame_reliability_tests',
+
+ # Other tests depend on Chrome bins being available when they run.
+ # Those should be re-enabled as soon as we setup the build slave to
+ # also build (or download an archive of) Chrome, even it it isn't
+ # instrumented itself.
+ # TODO(mad): FIX THIS!
+ #'chrome_frame_perftests',
+ #'chrome_frame_tests',
+
+ 'chrome_frame_unittests',
+ ], # 'dependencies'
+ 'actions': [
+ {
+ # TODO(jrg):
+ # Technically I want inputs to be the list of
+ # executables created in <@(_dependencies) but use of
+ # that variable lists the dep by dep name, not their
+ # output executable name.
+ # Is there a better way to force this action to run, always?
+ #
+ # If a test bundle is added to this coverage_build target it
+ # necessarily means this file (chrome_frame.gyp) is changed,
+ # so the action is run (coverage_bundles.py is generated).
+ # Exceptions to that rule are theoretically possible
+ # (e.g. re-gyp with a GYP_DEFINES set).
+ # Else it's the same list of bundles as last time. They are
+ # built (since on the deps list) but the action may not run.
+ # For now, things work, but it's less than ideal.
+ 'inputs': [ 'chrome_frame.gyp' ],
+ 'outputs': [ '<(PRODUCT_DIR)/coverage_bundles.py' ],
+ 'action_name': 'gcf_coverage_build',
+ 'action': [ 'python', '-c',
+ 'import os; '
+ 'f = open(' \
+ '\'<(PRODUCT_DIR)\' + os.path.sep + ' \
+ '\'coverage_bundles.py\'' \
+ ', \'w\'); ' \
+ 'deplist = \'' \
+ '<@(_dependencies)' \
+ '\'.split(\' \'); ' \
+ 'f.write(str(deplist)); ' \
+ 'f.close()'],
+ # Use outputs of this action as inputs for the main target build.
+ # Seems as a misnomer but makes this happy on Linux (scons).
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ # Coverage RUN. Does not actually compile the bundles (though it
+ # depends on the gcf_coverage_build step which will do it).
+ # This target mirrors the run_coverage_bundles buildbot phase.
+ # If you update this command update the mirror in
+ # $BUILDBOT/scripts/master/factory/chromium_commands.py.
+ # If you want both build and run, use the 'gcf_coverage' target which
+ # adds a bit more magic to identify if we need to run or not.
+ {
+ 'target_name': 'gcf_coverage_run',
+ 'dependencies': [ 'gcf_coverage_build' ],
+ 'suppress_wildcard': 1,
+ 'type': 'none',
+ 'actions': [
+ {
+ # MSVS must have an input file and an output file.
+ 'inputs': [ '<(PRODUCT_DIR)/coverage_bundles.py' ],
+ 'outputs': [ '<(PRODUCT_DIR)/coverage.info' ],
+ 'action_name': 'gcf_coverage_run',
+ 'action': [ 'python',
+ '../tools/code_coverage/coverage_posix.py',
+ '--directory',
+ '<(PRODUCT_DIR)',
+ '--src_root',
+ '.',
+ '--bundles',
+ '<(PRODUCT_DIR)/coverage_bundles.py',
+ ],
+ # Use outputs of this action as inputs for the main target build.
+ # Seems as a misnomer but makes this happy on Linux (scons).
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ ],
+ }, ], # 'coverage!=0'
+ ], # 'conditions'
}
# vim: shiftwidth=2:et:ai:tabstop=2