• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# Copyright 2016 the V8 project authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6# CC/CXX wrapper script that excludes certain file patterns from coverage
7# instrumentation.
8
9import re
10import subprocess
11import sys
12
13exclusions = [
14  'buildtools',
15  'src/third_party',
16  'third_party',
17  'test',
18  'testing',
19]
20
21def remove_if_exists(string_list, item):
22  if item in string_list:
23    string_list.remove(item)
24
25args = sys.argv[1:]
26text = ' '.join(sys.argv[2:])
27for exclusion in exclusions:
28  if re.search(r'\-o obj/%s[^ ]*\.o' % exclusion, text):
29    remove_if_exists(args, '-fprofile-arcs')
30    remove_if_exists(args, '-ftest-coverage')
31    remove_if_exists(args, '-fsanitize-coverage=func')
32    remove_if_exists(args, '-fsanitize-coverage=bb')
33    remove_if_exists(args, '-fsanitize-coverage=edge')
34    break
35
36sys.exit(subprocess.check_call(args))
37