summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-17 10:12:55 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-17 20:47:11 +0000
commitda489976371eb928d8b4d004744667fdf82b90d4 (patch)
tree77b632e0a6401931078ddbe1e94e032010609a9a
parent783a7e048c677d26aaf3884304627bbe27cff546 (diff)
downloadpdfium-da489976371eb928d8b4d004744667fdf82b90d4.tar.xz
Add optional coverage flags to build
This CL allows generating coverage information for the source files. By adding use_coverage=true to the GN build settings clang will generate .gcno files for each source file and executing the binary will generate a .gcda file for each source file. Those files can then be processed by llvm-cov to generate .gcov reports for each source file. i.e. (assuming use_coverage=true is set for out/coverage) * ninja -C out/coverage pdfium_unittests * cd out/coverage * find obj -name "*.o" -exec llvm-cov -af -stats {} > d.out \; There should now be .gcov files for each source file in the out/coverage directory. Note, llvm-gcov may have a different name or syntax on your machine. Change-Id: I7379579f5f20a5b8b2f3a3b409b868bba4b4d74d Reviewed-on: https://pdfium-review.googlesource.com/2216 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--BUILD.gn9
-rw-r--r--pdfium.gni3
2 files changed, 12 insertions, 0 deletions
diff --git a/BUILD.gn b/BUILD.gn
index fbede10eb0..fccc6d7900 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -42,6 +42,7 @@ config("pdfium_common_config") {
config("pdfium_core_config") {
cflags = []
+ ldflags = []
configs = [ ":pdfium_common_config" ]
defines = [ "V8_DEPRECATION_WARNINGS" ]
if (is_linux) {
@@ -55,6 +56,14 @@ config("pdfium_core_config") {
if (is_win) {
cflags += [ "/wd4267" ]
}
+ if (use_coverage && is_clang) {
+ cflags += [
+ "--coverage",
+ "-g",
+ "-O0",
+ ]
+ ldflags += [ "--coverage" ]
+ }
}
config("xfa_warnings") {
diff --git a/pdfium.gni b/pdfium.gni
index df051eca81..5737224f70 100644
--- a/pdfium.gni
+++ b/pdfium.gni
@@ -28,4 +28,7 @@ declare_args() {
# Build PDFium standalone
pdf_is_standalone = false
+
+ # Enable coverage information
+ use_coverage = false
}