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

Issue 809377 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

Coverage script fails on GetXDisplay for Chrome OS unit tests

Project Member Reported by maajid@chromium.org, Feb 6 2018

Issue description

What steps will reproduce the problem?
(1) Run the coverage.py script against a Chrome OS unit test target. Example invocation in the paste at the bottom of the bug

Perhaps this is an issue with the aura testing framework, but I'm not knowledgeable enough about this to really debug much.

What is the expected result?

Coverage report should be generated

What happens instead?

Script fails while attempting to run tests

gn args:

target_os = "chromeos"
enable_nacl = false
use_goma = true
is_debug = false
remove_webcore_debug_symbols = true
use_clang_coverage = true
proprietary_codecs = true
ffmpeg_branding = "ChromeOS"
pdf_enable_xfa = true
use_jumbo_build = true
is_component_build = false
use_libfuzzer = true


output:

maajid@maajid:~/chromium/src$ python tools/code_coverage/coverage.py unit_tests -b out/Coverage -o out/Report -c 'out/Coverage/unit_tests --gtest_filter=EncryptionMigrationScreenHandlerTest.*' -f chrome/browser/ui/webui/chromeos/ -f chromeos/
[2018-02-06 14:23:15,791] Building ['unit_tests']
ninja: Entering directory `out/Coverage'
[30325/30325] LINK ./unit_tests
[2018-02-06 14:56:58,167] Running command: "out/Coverage/unit_tests --gtest_filter=EncryptionMigrationScreenHandlerTest.*", the output is redirected to "out/Report/unit_tests_output.txt"
[35382:35382:0206/145721.922100:1529503078303:FATAL:device_data_manager_x11.cc(171)] Check failed: gfx::GetXDisplay(). 
#0 0x00001415d3ca base::debug::StackTrace::StackTrace()
#1 0x0000141cc0d4 logging::LogMessage::~LogMessage()
#2 0x000017539c83 ui::DeviceDataManagerX11::DeviceDataManagerX11()
#3 0x000017538286 ui::DeviceDataManagerX11::CreateInstance()
#4 0x00001750a24d ui::X11EventSource::X11EventSource()
#5 0x000017510e3c ui::X11EventSourceLibevent::X11EventSourceLibevent()
#6 0x0000078ebfd9 ui::(anonymous namespace)::OzonePlatformX11::CreatePlatformEventSource()
#7 0x0000078ea0b0 ui::(anonymous namespace)::OzonePlatformX11::InitializeUI()
#8 0x0000076b0f90 __llvm_coverage_mapping
#9 0x000018d24f26 aura::Env::Init()
#10 0x000018d24def aura::Env::CreateInstance()
#11 0x000013c9fed6 aura::AuraTestSuiteSetup::AuraTestSuiteSetup()
#12 0x000011a562e4 content::UnitTestTestSuite::UnitTestTestSuite()
#13 0x000011719f98 main
#14 0x7f95a19312b1 __libc_start_main
#15 0x000000ccb45a __llvm_coverage_mapping

Traceback (most recent call last):
  File "tools/code_coverage/coverage.py", line 1104, in <module>
    sys.exit(Main())
  File "tools/code_coverage/coverage.py", line 1068, in Main
    args.targets, args.command, args.jobs)
  File "tools/code_coverage/coverage.py", line 679, in _CreateCoverageProfileDataForTargets
    targets, commands)
  File "tools/code_coverage/coverage.py", line 741, in _GetProfileRawDataPathsByExecutingCommands
    _ExecuteCommand(target, command)
  File "tools/code_coverage/coverage.py", line 790, in _ExecuteCommand
    command.split(), env={'LLVM_PROFILE_FILE': expected_profraw_file_path})
  File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['out/Coverage/unit_tests', '--gtest_filter=EncryptionMigrationScreenHandlerTest.*']' returned non-zero exit status -6


 
Thanks for the report. This failure is unrelated to the coverage script or coverage instrumentation, you just need to run the tests in a way like:

$ python testing/xvfb.py out/Coverage/unit_tests --gtest_filter=EncryptionMigrationScreenHandlerTest.*

However, it's possible that the script may not work properly if you pass this command to the script via -c arg. Yuke, do we require all commands start with a binary executable?

If I put python into the -c arg I get an assertion error:

AssertionError: Target executable "python" in command: "python testing/xvfb.py out/Coverage/unit_tests --gtest_filter=CryptohomeUtilTest.*" is outside of the given build directory: "out/Coverage".

Also I independently discovered xvfb-run which I tried to use with the python call, but I think this won't work. I can't confirm at any rate because ToT doesn't compile atm.
Cc: -liaoyuke@chromium.org
Labels: -Pri-3 Pri-1
Owner: liaoyuke@chromium.org
Status: Assigned (was: Untriaged)
Thanks for testing! I'm not surprised by the assert you've got. Assigning to Yuke now.
Just for fun I disabled that assert and I get a different error:

maajid@maajid:~/chromium/src$ python tools/code_coverage/coverage.py unit_tests -b out/Coverage -o out/Report -c '/usr/bin/python testing/xvfb.py out/Coverage/unit_tests --gtest_filter=CryptohomeUtilTest.*' -f chrome/browser/ui/webui/chromeos/ -f chromeos/
[2018-02-07 14:14:33,938] Building ['unit_tests']
ninja: Entering directory `out/Coverage'
ninja: no work to do.
[2018-02-07 14:14:36,746] Running command: "/usr/bin/python testing/xvfb.py out/Coverage/unit_tests --gtest_filter=CryptohomeUtilTest.*", the output is redirected to "out/Report/unit_tests_output.txt"
[2018-02-07 14:14:38,014] Creating the coverage profile data file
out/Report/unit_tests.9092094292374385578_3.profraw: jmemmgr.c:alloc_small: Function basic block count change detected (counter mismatch)
Make sure that all profile data to be merged is generated from the same binary.
[2018-02-07 14:14:57,661] Code coverage profile data is created as: out/Report/coverage.profdata
[2018-02-07 14:14:57,730] Generating code coverage report in html (this can take a while depending on size of target!)
error: /usr/bin/python: Failed to load coverage: No coverage data found
error: Could not load coverage information
Traceback (most recent call last):
  File "tools/code_coverage/coverage.py", line 1110, in <module>
    sys.exit(Main())
  File "tools/code_coverage/coverage.py", line 1080, in Main
    binary_paths, profdata_file_path, absolute_filter_paths)
  File "tools/code_coverage/coverage.py", line 849, in _GeneratePerFileCoverageSummary
    json_output = json.loads(subprocess.check_output(subprocess_cmd))
  File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['/usr/local/google/home/maajid/chromium/src/third_party/llvm-build/Release+Asserts/bin/llvm-cov', 'export', '-summary-only', '-instr-profile=out/Report/coverage.profdata', '/usr/bin/python', '/usr/local/google/home/maajid/chromium/src/chrome/browser/ui/webui/chromeos/', '/usr/local/google/home/maajid/chromium/src/chromeos/']' returned non-zero exit status 1
Thanks for testing it out maajid@! I'm at a convergence this week, I'll take a look at this error next week.
Status: Started (was: Assigned)
Project Member

Comment 7 by bugdroid1@chromium.org, Feb 15 2018

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

commit 545db3293cc1f6425fa68d87d18758977d9e1d38
Author: Yuke Liao <liaoyuke@chromium.org>
Date: Thu Feb 15 17:12:01 2018

[Coverage] Support running tests using xvfb

This CL supports running tests using xvfb.py in the command.

Bug:  809377 
Change-Id: I3d8462209b947b7e9f655b378d705b89112773b5
Reviewed-on: https://chromium-review.googlesource.com/915303
Commit-Queue: Yuke Liao <liaoyuke@chromium.org>
Reviewed-by: Abhishek Arya <inferno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537054}
[modify] https://crrev.com/545db3293cc1f6425fa68d87d18758977d9e1d38/tools/code_coverage/coverage.py

Status: Fixed (was: Started)

Comment 9 by maajid@chromium.org, Feb 16 2018

Status: Verified (was: Fixed)
Awesome, it works. Thanks!

Sign in to add a comment