[coverage] Filter some files from instrumentation.
This filters test and third_party files to get a speed-up when running tests and when collecting profile data. BUG=chromium:568949 LOG=n NOTRY=true Review URL: https://codereview.chromium.org/1730543002 Cr-Commit-Position: refs/heads/master@{#34216}
This commit is contained in:
parent
bd9df50d75
commit
761ee31be5
28
build/coverage_wrapper.py
Executable file
28
build/coverage_wrapper.py
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Copyright 2016 the V8 project authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
# CC/CXX wrapper script that excludes certain file patterns from coverage
|
||||||
|
# instrumentation.
|
||||||
|
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
exclusions = [
|
||||||
|
'src/third_party',
|
||||||
|
'third_party',
|
||||||
|
'test',
|
||||||
|
'testing',
|
||||||
|
]
|
||||||
|
|
||||||
|
args = sys.argv[1:]
|
||||||
|
text = ' '.join(sys.argv[2:])
|
||||||
|
for exclusion in exclusions:
|
||||||
|
if re.search(r'\-o obj/%s[^ ]*\.o' % exclusion, text):
|
||||||
|
args.remove('-fprofile-arcs')
|
||||||
|
args.remove('-ftest-coverage')
|
||||||
|
break
|
||||||
|
|
||||||
|
sys.exit(subprocess.check_call(args))
|
@ -48,6 +48,12 @@
|
|||||||
'release_extra_cflags%': '',
|
'release_extra_cflags%': '',
|
||||||
'variables': {
|
'variables': {
|
||||||
'variables': {
|
'variables': {
|
||||||
|
# goma settings.
|
||||||
|
# 1 to use goma.
|
||||||
|
# If no gomadir is set, it uses the default gomadir.
|
||||||
|
'use_goma%': 0,
|
||||||
|
'gomadir%': '',
|
||||||
|
|
||||||
'variables': {
|
'variables': {
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \
|
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \
|
||||||
@ -70,12 +76,23 @@
|
|||||||
|
|
||||||
# Instrument for code coverage with gcov.
|
# Instrument for code coverage with gcov.
|
||||||
'coverage%': 0,
|
'coverage%': 0,
|
||||||
|
|
||||||
|
'conditions': [
|
||||||
|
# Set default gomadir.
|
||||||
|
['OS=="win"', {
|
||||||
|
'gomadir': 'c:\\goma\\goma-win',
|
||||||
|
}, {
|
||||||
|
'gomadir': '<!(/bin/echo -n ${HOME}/goma)',
|
||||||
|
}],
|
||||||
|
],
|
||||||
},
|
},
|
||||||
'base_dir%': '<(base_dir)',
|
'base_dir%': '<(base_dir)',
|
||||||
'host_arch%': '<(host_arch)',
|
'host_arch%': '<(host_arch)',
|
||||||
'target_arch%': '<(target_arch)',
|
'target_arch%': '<(target_arch)',
|
||||||
'v8_target_arch%': '<(target_arch)',
|
'v8_target_arch%': '<(target_arch)',
|
||||||
'coverage%': '<(coverage)',
|
'coverage%': '<(coverage)',
|
||||||
|
'use_goma%': '<(use_goma)',
|
||||||
|
'gomadir%': '<(gomadir)',
|
||||||
'asan%': 0,
|
'asan%': 0,
|
||||||
'lsan%': 0,
|
'lsan%': 0,
|
||||||
'msan%': 0,
|
'msan%': 0,
|
||||||
@ -104,22 +121,10 @@
|
|||||||
# TODO(machenbach): Only configured for windows.
|
# TODO(machenbach): Only configured for windows.
|
||||||
'fastbuild%': 0,
|
'fastbuild%': 0,
|
||||||
|
|
||||||
# goma settings.
|
|
||||||
# 1 to use goma.
|
|
||||||
# If no gomadir is set, it uses the default gomadir.
|
|
||||||
'use_goma%': 0,
|
|
||||||
'gomadir%': '',
|
|
||||||
|
|
||||||
# Check if valgrind directories are present.
|
# Check if valgrind directories are present.
|
||||||
'has_valgrind%': '<!pymod_do_main(has_valgrind)',
|
'has_valgrind%': '<!pymod_do_main(has_valgrind)',
|
||||||
|
|
||||||
'conditions': [
|
'conditions': [
|
||||||
# Set default gomadir.
|
|
||||||
['OS=="win"', {
|
|
||||||
'gomadir': 'c:\\goma\\goma-win',
|
|
||||||
}, {
|
|
||||||
'gomadir': '<!(/bin/echo -n ${HOME}/goma)',
|
|
||||||
}],
|
|
||||||
['host_arch!="ppc" and host_arch!="ppc64" and host_arch!="ppc64le" and host_arch!="s390" and host_arch!="s390x" and \
|
['host_arch!="ppc" and host_arch!="ppc64" and host_arch!="ppc64le" and host_arch!="s390" and host_arch!="s390x" and \
|
||||||
coverage==0', {
|
coverage==0', {
|
||||||
'host_clang%': 1,
|
'host_clang%': 1,
|
||||||
@ -362,6 +367,23 @@
|
|||||||
'host_cc': '<!(which gcc)',
|
'host_cc': '<!(which gcc)',
|
||||||
'host_cxx': '<!(which g++)',
|
'host_cxx': '<!(which g++)',
|
||||||
}],
|
}],
|
||||||
|
['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
|
||||||
|
'conditions': [
|
||||||
|
['coverage==1', {
|
||||||
|
'cc_wrapper': '<(base_dir)/build/coverage_wrapper.py <(gomadir)/gomacc',
|
||||||
|
}, {
|
||||||
|
'cc_wrapper': '<(gomadir)/gomacc',
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
}, {
|
||||||
|
'conditions': [
|
||||||
|
['coverage==1', {
|
||||||
|
'cc_wrapper': '<(base_dir)/build/coverage_wrapper.py',
|
||||||
|
}, {
|
||||||
|
'cc_wrapper': 0,
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
}],
|
||||||
],
|
],
|
||||||
# Default ARM variable settings.
|
# Default ARM variable settings.
|
||||||
'arm_version%': 'default',
|
'arm_version%': 'default',
|
||||||
@ -1261,12 +1283,12 @@
|
|||||||
# TODO(yyanagisawa): supports GENERATOR==make
|
# TODO(yyanagisawa): supports GENERATOR==make
|
||||||
# make generator doesn't support CC_wrapper without CC
|
# make generator doesn't support CC_wrapper without CC
|
||||||
# in make_global_settings yet.
|
# in make_global_settings yet.
|
||||||
['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
|
['cc_wrapper!=0', {
|
||||||
'make_global_settings': [
|
'make_global_settings': [
|
||||||
['CC_wrapper', '<(gomadir)/gomacc'],
|
['CC_wrapper', '<(cc_wrapper)'],
|
||||||
['CXX_wrapper', '<(gomadir)/gomacc'],
|
['CXX_wrapper', '<(cc_wrapper)'],
|
||||||
['CC.host_wrapper', '<(gomadir)/gomacc'],
|
['CC.host_wrapper', '<(cc_wrapper)'],
|
||||||
['CXX.host_wrapper', '<(gomadir)/gomacc'],
|
['CXX.host_wrapper', '<(cc_wrapper)'],
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
['use_lto==1', {
|
['use_lto==1', {
|
||||||
|
Loading…
Reference in New Issue
Block a user