Commit 47c6af43 authored by Roberto Carrillo's avatar Roberto Carrillo Committed by Commit Bot

[code coverage] Pass profile location var to vm and exfil data.

This change passes the LLVM_PROFILE_FILE var from the test_runner
environment down to the environment inside the VM where actual test is
run.

The location is set to /tmp inside the VM, where the test can write to,
and passed to the test runner for extracting the data out into the
results directory (which should be included in the isolated output IIUC)

R=liaoyuke,stgao,jbudorick
BUG=934059

Change-Id: Id85f54120355176925cc39ce52947fcfe83c2e62
Reviewed-on: https://chromium-review.googlesource.com/c/1480552
Commit-Queue: Roberto Carrillo <robertocn@chromium.org>
Reviewed-by: default avatarYuke Liao <liaoyuke@chromium.org>
Reviewed-by: default avatarBen Pastene <bpastene@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarShuotao Gao <stgao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634355}
parent 2bc8e92a
......@@ -230,6 +230,9 @@ class GTestTest(RemoteTest):
self._on_vm_script = None
# If set, pass this value to the LLVM_PROFILE_FILE env var in the vm.
self._vm_profile_var = None
@property
def suite_name(self):
return self._test_exe
......@@ -258,6 +261,21 @@ class GTestTest(RemoteTest):
'--results-dest-dir', result_dir,
]
# This environment variable is set for tests that have been instrumented
# for code coverage. Its incoming value is expected to be a location
# inside a subdirectory of result_dir above. This is converted to an
# absolute path that the vm is able to write to, and passed in the
# --results-src flag to cros_run_vm_test for copying out of the vm before
# its termination.
if os.environ.get('LLVM_PROFILE_FILE'):
_, vm_profile_file = os.path.split(os.environ['LLVM_PROFILE_FILE'])
self._vm_profile_var = '/tmp/profraw/%s' % vm_profile_file
# This should make the vm test runner exfil the profiling data.
self._vm_test_cmd += [
'--results-src', '/tmp/profraw'
]
# Build the shell script that will be used on the VM to invoke the test.
vm_test_script_contents = ['#!/bin/sh']
......@@ -268,6 +286,11 @@ class GTestTest(RemoteTest):
# duration of the test.
vm_test_script_contents.append('export HOME=/tmp')
if self._vm_profile_var:
vm_test_script_contents += [
'export LLVM_PROFILE_FILE=%s'% self._vm_profile_var,
]
if self._vpython_dir:
vpython_spec_path = os.path.relpath(
os.path.join(CHROMIUM_SRC_PATH, '.vpython'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment