New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 865376 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

Code coverage linking fails building ChromeOS on linux

Project Member Reported by noel@chromium.org, Jul 19

Issue description

With gclient checkout synced to ToT, follow the "ChromeOS on Linux" instructions:

https://chromium.googlesource.com/chromium/src/+/HEAD/docs/chromeos_build_instructions.md

They're the same as "Chrome on Linux" instructions, but need gn target_os arg set to

  target_os = "chromeos"

and also .gclient file containing target_os = ['chromeos']. Success.  Next, for the code coverage case, run:

  gn gen out/coverage

Run gn args and set:

  target_os = "chromeos"
  use_clang_coverage = true
  is_component_build = false
  is_debug = false
  use_goma = true

Follow https://chromium.googlesource.com/chromium/src/+/lkgr/docs/code_coverage.md and build browser_tests gn target

  python tools/code_coverage/coverage.py browser_tests \
    -b  out/coverage -o out/report \
    -c 'out/coverage/browser_tests --gtest_filter=*FilesAppBrowserTest*' \
    -f  chrome/browser/chromeos/file_manager

Build fails while linking libmojo_core as a shared library: error is about a missing
file, not found ...

  third_party/llvm-build/*/clang/7.0.0/lib/lib/libclang_rt.profile-X86_64.android.a

Seems tools/code_coverage/coverage.py is not downloading rt.profile files for Android. 
 
Status: Started (was: Untriaged)
Things seem to be even worse now, the compiler is crashing when trying to build that target :(

Checking out with the previous clang roll.
Labels: -Pri-3 Pri-1
The same crash when building with the previous clang revision ( issue 863425 ). Fun!
chrome@ git-hash c47e277ca2dbf13b4bb5e402a7330c29805c04ac

% gn args out/coverage
Waiting for editor on "$HOME/chrome/src/out/coverage/args.gn"...
Generating files...
Done. Made 11307 targets from 1892 files in 3595ms

% gn args out/coverage --list --short --overrides-only
crashpad_dependencies = "chromium"
is_component_build = false
is_debug = false
rtc_include_ilbc = false
rtc_link_task_queue_impl = false
target_os = "chromeos"
use_clang_coverage = true
use_goma = true
v8_check_microtasks_scopes_consistency = false
v8_enable_gdbjit = false
v8_experimental_extra_library_files = []
v8_extra_library_files = ["<file-list-elided>..."]
v8_imminent_deprecation_warnings = false

% python tools/code_coverage/coverage.py browser_tests \
    -b  out/coverage -o out/report \
    -c 'out/coverage/browser_tests --gtest_filter=*FilesAppBrowserTest*' \
    -f  chrome/browser/chromeos/file_manager

Downloading https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64/llvm-code-coverage-336424-1.tgz .......... Done.

[2018-07-20 10:40:05,824 INFO] Building ['browser_tests'].
ninja: Entering directory `$HOME/chrome/src/out/coverage' 

Crashes for me too. Crash log attached.
chrome-os-coverage-crash.txt
14.6 KB View Download
Tried the 'unit_tests' target for the record.

  python tools/code_coverage/coverage.py unit_tests \
    -b  out/coverage -o out/report \
    -c 'out/coverage/unit_tests' \
    -f  chrome/browser/chromeos/file_manager

No crash there.

chrome_browser_chromeos_file_manager_unittest_report.png
640 KB View Download
Cc: h...@chromium.org thakis@chromium.org r...@chromium.org
The original issue though is not related to the coverage script. Coverage script downloads only llvm-cov and llvm-profdata utilities, while compiler-rt*profile* library should be downloaded amongst other LLVM libraries.


I know how it works for Linux, Mac and Windows: https://cs.chromium.org/chromium/src/tools/clang/scripts/package.py?q=package.py&sq=package:chromium&g=0&l=272

But can't see how LLVM package for Android is getting created, so CC'ing some other folks who can advice on this.

Still unclear why target_os="chromeos" built on Linux needs Android library, but likely it's WAI since non-coverage builds work fine.
Android stuff is generally in the linux package:

s$ ls ~/Downloads/clang-337439-1/lib/clang/7.0.0/lib/linux/*android*
/Users/thakis/Downloads/clang-337439-1/lib/clang/7.0.0/lib/linux/libclang_rt.asan-aarch64-android.so			/Users/thakis/Downloads/clang-337439-1/lib/clang/7.0.0/lib/linux/libclang_rt.ubsan_standalone-aarch64-android.so
/Users/thakis/Downloads/clang-337439-1/lib/clang/7.0.0/lib/linux/libclang_rt.asan-arm-android.so			/Users/thakis/Downloads/clang-337439-1/lib/clang/7.0.0/lib/linux/libclang_rt.ubsan_standalone-arm-android.so
/Users/thakis/Downloads/clang-337439-1/lib/clang/7.0.0/lib/linux/libclang_rt.asan-i686-android.so			/Users/thakis/Downloads/clang-337439-1/lib/clang/7.0.0/lib/linux/libclang_rt.ubsan_standalone-i686-android.so


But we don't bundle libprofile for android since it's not needed for regular android builds. If we were to bundle it, we probably wouldn't bundle it for x86-64 since most android devices are arm.
ChromeOS devices are x86-64 or arm.

Sure, but "coverage for the android part of a chromeos build" is a somewhat exotic flag combination. Maybe we could make it so that coverage flags aren't passed in to the android part of a cros build.
Labels: OS-Chrome
Agree, semi-exotic.  Not having clang coverage flags passed into the android part of a cros build would work for me.
Project Member

Comment 10 by bugdroid1@chromium.org, Jul 31

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d89549b20cedcf250e16cf5d98a89ed0b691e6e0

commit d89549b20cedcf250e16cf5d98a89ed0b691e6e0
Author: Max Moroz <mmoroz@chromium.org>
Date: Tue Jul 31 16:19:55 2018

Build and bundle compiler-rt profile library for Android.

This is needed for supporting profiling and code coverage reporting on
ChromeOS and Android.

Bug: 843356,865376
Change-Id: I36836a7876c5e9230b33594362ac029bc1670c86
Reviewed-on: https://chromium-review.googlesource.com/1153653
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Abhishek Arya <inferno@chromium.org>
Reviewed-by: Hans Wennborg <hans@chromium.org>
Commit-Queue: Max Moroz <mmoroz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579426}
[modify] https://crrev.com/d89549b20cedcf250e16cf5d98a89ed0b691e6e0/tools/clang/scripts/update.py

Status: WontFix (was: Started)
Apparently we don't even build compiler-rt libraries for Android x86_64. 

I guess I'm WontFix'ing this. Noel, if you really need to run coverage in this configuration, I probably can build that missing library for you, but no promises that other pieces would work :(

For the solution discussed in c#8 and c#9 you just need to remove "//build/config/coverage:default_coverage" under certain conditions in GN file of your interest, e.g. https://cs.chromium.org/chromium/src/chrome/test/data/nacl/BUILD.gn?type=cs&q=%22:default_coverage%22&g=0&l=614

Cc: saintlou@chromium.org abodenha@chromium.org kerz@chromium.org rockot@google.com
Once the compiler crash is fixed in Clang, will this bug still not be actionable? I am trying to get a sense of what all needs to be fixed for us to get Code Coverage working on Chrome on Chrome OS.

Cc: r...@chromium.org
rkc@, which CPU architectures do you need?
Either ARM or x64 should work for us. The code we're trying to measure coverage on should not deviate too much on either of the architectures.

In ARM case, we should be in a better shape, I believe. Someone just has to try building some test target :) Better to start with something small.

Comment 16 by noel@google.com, Jan 21 (2 days ago)

This bug's x64 link failure is due to cross compilation of mojo bindings for Android, done as part of the Chrome OS on Linux build.

Then see #8 and #9 above, an idea that seems to work (diff attached), and with it, I was able to compile Chrome OS browser tests with clang coverage enabled.
clang-coverage.git.diff
817 bytes Download

Comment 17 by liaoyuke@chromium.org, Today (16 hours ago)

Owner: ----
Status: Available (was: WontFix)
I'm re-opening this bug since there are still activities.

Re #12: sorry I missed your comment. This bug will be actionable once the platform specific issues are fixed.

That said, someone should fix the platform specific issues (compiler crash is a known one, there maybe more) so that the coverage.py script can successfully generate code coverage reports for the list of targets you're interested in, and then our team can take care of the rest at the infrastructure side to set up the CI builders and get the reports integrated into the dashboard.

Sign in to add a comment