Граф коммитов

19 Коммитов

Автор SHA1 Сообщение Дата
Yun Liu f61399dad6 [code coverage] Only instrument Java class files related to affected source files for per-CL
Right now Java per-CL coverage instrument everything as full code base coverage.
To only instrument class files related to affected files in a CL, we can:
1. Extract class files only related to affected source files in a jar.
2. Instrument these extracted class files.
3. Extract unaffected members from original jar.
4. Zip everything out to output path.

Bug: 1001387
Change-Id: Iaf6a75c7f8005b5d64eee22bc604f25d0c2fcd8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1797109
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Yun Liu <yliuyliu@google.com>
Cr-Original-Commit-Position: refs/heads/master@{#697661}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c0f2f73bc76d220a37f98c6eb14f849980821842
2019-09-18 17:06:31 +00:00
Yuke Liao 25a268cee3 [code coverage] Allow turning off coverage with one config change
This CL removes the dependency between use_clang_coverage and
coverage_instrumentation_input_file so that the coverage feature can
be turned off with a single change by setting use_clang_coverage to
false.

Change-Id: Iff4d4c3207fa82d81a5b6bcfe417cc955764096d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1698670
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#676959}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9eb53f51810a4b835020760d31e5f31601d1889e
2019-07-12 18:03:59 +00:00
Nico Weber 6050fc9d69 win: Clean up coverage linker flags after clang r360674.
After clang r360674, each .obj file embeds the path to the profile library
as a dependent lib. No intended behavior change.

Change-Id: Ie892fccdb8aaefc2545db56fb3274dc6f0992a96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1630986
Reviewed-by: Hans Wennborg <hans@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#663751}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 5158b6cfadd24bce1f1bf6738a5f369313adf176
2019-05-28 15:47:24 +00:00
Sajjad Mirza 0dc5c0fd3c Use the wrapper script in all coverage builds (fixed).
This is a fix for crrev.com/c/1496002, which was reverted because of a
1-character mistake. The rest of the CL message is copied from the
original:

Previously the wrapper script would only be used for coverage builds
that required selective instrumentation of specific files. Now it
will also be used for any coverage builds.

Since the script's job is to remove flags from files that shouldn't
have them the default_coverage config now adds to cflags even in a
CQ build.

Bug: 918215
Change-Id: Ifdb13657c0c7a80d79960b411050e4f8918fa172
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1508560
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Sajjad Mirza <sajjadm@google.com>
Cr-Original-Commit-Position: refs/heads/master@{#638762}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 494df319742a206bca4d28ac6e0707bdd7d9a3ee
2019-03-07 21:54:53 +00:00
Hans Wennborg 765920bd73 Revert "Use the wrapper script in all coverage builds."
This reverts commit 78d6b9950b4bd9462c226b2cc2ac1f74ad84ad6a.

Reason for revert:

This broke the coverage builds, see e.g.
https://ci.chromium.org/p/chromium/builders/ci/ToTLinuxCoverage/6258
which fails with:
"/bin/sh: 1: ../../build/toolchain/clang_code_coverage_wrapper.py--target-os=linux: not found"

I guess there's a missing space before --target-os.

Could this have been found in testing?


Original change's description:
> Use the wrapper script in all coverage builds.
> 
> Previously the wrapper script would only be used for coverage builds
> that required selective instrumentation of specific files. Now it
> will also be used for any coverage builds.
> 
> Since the script's job is to remove flags from files that shouldn't
> have them the default_coverage config now adds to cflags even in a
> CQ build.
> 
> Bug: 918215
> Change-Id: I012c5732d46bf5cff9eaf8f50615739bb781cc29
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1496002
> Commit-Queue: Sajjad Mirza <sajjadm@google.com>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> Reviewed-by: Max Moroz <mmoroz@chromium.org>
> Reviewed-by: Yuke Liao <liaoyuke@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#638321}

TBR=stgao@chromium.org,dpranke@chromium.org,robertocn@chromium.org,mmoroz@chromium.org,liaoyuke@chromium.org,sajjadm@google.com

Change-Id: I8a945239dadc84d5e1c55a94ee84e34f413e54d5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 918215
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1508457
Reviewed-by: Hans Wennborg <hans@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#638561}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: a3a48425d72da578ca09184e89ef898b405550c5
2019-03-07 14:34:38 +00:00
Sajjad Mirza 7c892d012b Use the wrapper script in all coverage builds.
Previously the wrapper script would only be used for coverage builds
that required selective instrumentation of specific files. Now it
will also be used for any coverage builds.

Since the script's job is to remove flags from files that shouldn't
have them the default_coverage config now adds to cflags even in a
CQ build.

Bug: 918215
Change-Id: I012c5732d46bf5cff9eaf8f50615739bb781cc29
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1496002
Commit-Queue: Sajjad Mirza <sajjadm@google.com>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Reviewed-by: Yuke Liao <liaoyuke@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#638321}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 78d6b9950b4bd9462c226b2cc2ac1f74ad84ad6a
2019-03-06 22:55:16 +00:00
Yuke Liao 6a59547c6a [code coverage] Hook coverage wrapper to build toolchains
This CL hooks the Clang code coverage wrapper into the build
toolchains, and specifically, a new build flag:
coverage_instrumentation_input_file is added to allow turning on/off
the wrapper and pass the list-files-to-instrument around.

Bug: 898695
Change-Id: I405ccbfc1796afa44534794d711f2953fac78f6d
Reviewed-on: https://chromium-review.googlesource.com/c/1309999
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#604858}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9619c7100bab3b50c280efd021f92722bd1ab48e
2018-11-02 07:18:09 +00:00
Reid Kleckner 94e1b55d3b Fix linking against the clang profiling library on Windows
On Windows, the linker is invoked directly, so we can't add
-finstr-profile-generate to ldflags and expect things to work. Instead,
explicitly link against the appropriate library.

Update clang's package.py script to include clang_rt.profile-*.lib.

After this, base_unittests links, but crashes during shutdown when
writing the profile.

BUG=846918
R=thakis@chromium.org,mmoroz@chromium.org

Change-Id: I337e587b83750c86546a9673daeb593d4125bbd9
Reviewed-on: https://chromium-review.googlesource.com/1153625
Commit-Queue: Reid Kleckner <rnk@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#579161}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 0cbb2ddc9cec38649e71ba2c3bfb0ba3b240e76c
2018-07-30 20:49:07 +00:00
Max Moroz adb59b644b [Code Coverage] Fix clang flags: use "-fno-use-cxa-atexit" instead of "-fno-cxa-atexit".
TBR=mmoroz@chromium.org

Bug: 848803
Change-Id: I3d951581422e67c826fe6ac9f5164aa4bc8b9dcf
Reviewed-on: https://chromium-review.googlesource.com/1081886
Reviewed-by: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: Reid Kleckner <rnk@chromium.org>
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Commit-Queue: Max Moroz <mmoroz@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#563747}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 85dcf76e792c7aac74ad739e47334d2c52c66c20
2018-06-01 19:06:04 +00:00
Reid Kleckner 330a9b29b8 Don't pass -fno-cxa-atexit to clang-cl when enabling code coverage
On Windows, clang always uses regular atexit, so this wouldn't do
anything even if clang-cl did understand the flag.

R=mmoroz@chromium.org
BUG=846918

Change-Id: I59523e818488b5de3331a7851ae51a381a3e5c17
Reviewed-on: https://chromium-review.googlesource.com/1081202
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Commit-Queue: Reid Kleckner <rnk@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#563460}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 9aa0375e58d62b3134cc38363e0b54b8bf2208af
2018-06-01 00:38:54 +00:00
Max Moroz 6254389a64 [Code Coverage] Add support for component build + update documentation.
Bug: 831939
Change-Id: I2804796894045dc69aa8309aa3ab34e6c80b38d7
Reviewed-on: https://chromium-review.googlesource.com/1010464
Commit-Queue: Max Moroz <mmoroz@chromium.org>
Reviewed-by: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: Abhishek Arya <inferno@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#553211}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: d73e45fdf4ab585227bdda1f3fd7e3105ae798ee
2018-04-24 18:32:47 +00:00
Yuke Liao b73ec3eda4 [Coverage] Fix documentation and build error message
Fix documentation and build error message regarding
is_component_build flag.

Change-Id: I393ce3b376e30f4fbbabfea332b77728b5344d5a
Reviewed-on: https://chromium-review.googlesource.com/917223
Reviewed-by: Jonathan Metzman <metzman@chromium.org>
Reviewed-by: Abhishek Arya <inferno@chromium.org>
Commit-Queue: Abhishek Arya <inferno@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#537953}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: ab9c44ebfebc2a832ad119a23a466fa7b82040bf
2018-02-21 00:24:40 +00:00
Yuke Liao 6491c4c2c8 [Coverage] Enable experimental limited code coverage
This CL sets -limited-coverage-experimental=true to allow building
large unit test target on Mac.

Bug: 796290
Change-Id: Ief6277ae2ea3d4e1372c4fd796e97c2a1ae0bfba
Reviewed-on: https://chromium-review.googlesource.com/891799
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: Abhishek Arya <inferno@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#532700}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e9592c502eefc7101342bf97f0606f94e1ae612e
2018-01-30 00:47:42 +00:00
Jonathan Metzman 043c473dbe Add assertion preventing is_component_build=true from being used with use_clang_coverage.
Bug: 773530
Change-Id: Ib0997ffdead67437f61e279791a7a8887cbe807f
Reviewed-on: https://chromium-review.googlesource.com/714279
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#509058}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 301ce027adbc5555dec9ac7e449af1732ce3a5f9
2017-10-16 15:43:28 +00:00
Jonathan Metzman b23a360275 Add warnings not to use "is_component_build=true" when using
use_clang_coverage.


Bug: 773530
Change-Id: I7d9002279230b6aa6efaf9cf5ed09117ae4e6ff0
Reviewed-on: https://chromium-review.googlesource.com/711217
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Commit-Queue: Max Moroz <mmoroz@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#507983}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: cc786b3eb32eb1e4c9b844fce74d3e6f5ee1b4b9
2017-10-11 15:07:45 +00:00
Abhishek Arya 58ec82342f Add back clang requirement assert for use_clang_coverage flag.
R=brettw@chromium.org,mmoroz@chromium.org

Bug: 771718, 759794
Change-Id: I77d5f83587777d8ed4b23cf00d8f55ae48015ce0
Reviewed-on: https://chromium-review.googlesource.com/701619
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Abhishek Arya <inferno@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#507165}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 433d48700283e612dcafe76ec8b05c837a48a920
2017-10-06 20:35:04 +00:00
Max Moroz 1cf5783309 Remove an assert due to corrupted "is_clang" variable + add a missing import.
TBR=brettw@chromium.org,inferno@chromium.org

Bug: 771718, 759794
Change-Id: I1fc3ab8b054ce6eeee24d0c1c0599be216b2e386
Reviewed-on: https://chromium-review.googlesource.com/700974
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Commit-Queue: Max Moroz <mmoroz@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#506502}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 74106e986dfbde1caf33410d77cbe1096926db94
2017-10-04 20:36:28 +00:00
Max Moroz e3dda1e762 Optimize clang source-based code coverage build configuration.
I've been testing the changes on net_parse_cookie_line_fuzzer,
which is a fuzz target of average size written in C++.

Improvements step by step:

0) Original configuration, Coverage + ASan:
158 MB  1,000 exec/s

1) Prohibit ASan (and other sanitizers), use only Coverage instrumentation:
132 MB  same speed

The following change hasn't been applied, but let's keep it in the description FTR:
- 2) Disable sanitizer coverage (which is different from clang source-based coverage):
- 90 MB   1,088 exec/s (speed +8-10%)

3) Avoid optimize_for_fuzzing config (i.e. use -O3 instead of -O1 for coverage build):
Same size  1,773 exec/s (speed +60-65% on top of the previous change)

4) Disable coverage for libFuzzer source code:
88 MB  3,988 exec/s (speed +125% on top of previous changes)

5) Disable coverage for libc++ and libc++abi sources
(https://chromium-review.googlesource.com/#/c/chromium/buildtools/+/693570):
86 MB  4,110 exec/s (speed +3% on top of previous changes)

In total, for that particular target:
- build size reduced by ~45%
- execution speed increased by ~310%

I've also tested the changes with zlib_uncompress_fuzzer (a tiny fuzz target for C-library):
- build size reduced by ~83%
- execution speed increased by ~120%

I haven't measured impact on the other fuzz targets, so it may vary a lot,
but the result seems to be quite significant anyway.


Bug: 759794
Change-Id: Icf61c979e38d0f7849ab7281bd9e24cf2b7a7d02
Reviewed-on: https://chromium-review.googlesource.com/693564
Reviewed-by: Brett Wilson <brettw@chromium.org>
Reviewed-by: Oliver Chang <ochang@chromium.org>
Commit-Queue: Abhishek Arya <inferno@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#506454}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c8fee977deb6f47aaf602813b00428adfe7baa74
2017-10-04 18:31:46 +00:00
Tanin Na Nakorn 2accb6158e Add Clang code coverage.
ClusterFuzz would like to enable Code Coverage for our libfuzzer targets.

Bug: 759794
Change-Id: I195454b04cfe7d0f883b388f2c9e5e065b9663b9
Reviewed-on: https://chromium-review.googlesource.com/639054
Commit-Queue: Tanin Na Nakorn <tanin@google.com>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Reviewed-by: Max Moroz <mmoroz@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#499691}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e58f28f35acd02e657b94fef4de38245267a1562
2017-09-05 18:50:45 +00:00