Remove code-coverage support from chromeos test_runner
No CrOS device bot has code-coverage support enabled in its GN args. Given this support code was added a long time ago, and because it appears it hasn't been used since, this code is likely safe to remove. Bug: 1288864 Change-Id: Ia0fb0d8a4af601ef5144a4997e7edac0ef7336cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3402980 Reviewed-by: Yuke Liao <liaoyuke@chromium.org> Commit-Queue: Ben Pastene <bpastene@chromium.org> Cr-Commit-Position: refs/heads/main@{#961208}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
fe69e025e9
commit
dc413c9aa1
@@ -9,7 +9,6 @@ import collections
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pipes
|
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import signal
|
import signal
|
||||||
@@ -132,20 +131,6 @@ class RemoteTest:
|
|||||||
if args.public_image:
|
if args.public_image:
|
||||||
self._test_cmd += ['--public-image']
|
self._test_cmd += ['--public-image']
|
||||||
|
|
||||||
# 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.
|
|
||||||
self._llvm_profile_var = None
|
|
||||||
if os.environ.get('LLVM_PROFILE_FILE'):
|
|
||||||
_, llvm_profile_file = os.path.split(os.environ['LLVM_PROFILE_FILE'])
|
|
||||||
self._llvm_profile_var = '/tmp/profraw/%s' % llvm_profile_file
|
|
||||||
|
|
||||||
# This should make the vm test runner exfil the profiling data.
|
|
||||||
self._test_cmd += ['--results-src', '/tmp/profraw']
|
|
||||||
|
|
||||||
self._test_env = setup_env()
|
self._test_env = setup_env()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -281,7 +266,7 @@ class TastTest(RemoteTest):
|
|||||||
'lacros-chrome deployment uses --nostrip by default, so it cannot '
|
'lacros-chrome deployment uses --nostrip by default, so it cannot '
|
||||||
'be specificed with --deploy-lacros.')
|
'be specificed with --deploy-lacros.')
|
||||||
|
|
||||||
if not self._llvm_profile_var and not self._logs_dir:
|
if not self._logs_dir:
|
||||||
# The host-side Tast bin returns 0 when tests fail, so we need to capture
|
# The host-side Tast bin returns 0 when tests fail, so we need to capture
|
||||||
# and parse its json results to reliably determine if tests fail.
|
# and parse its json results to reliably determine if tests fail.
|
||||||
raise TestFormatError(
|
raise TestFormatError(
|
||||||
@@ -323,38 +308,6 @@ class TastTest(RemoteTest):
|
|||||||
os.path.relpath(self._path_to_outdir, CHROMIUM_SRC_PATH)
|
os.path.relpath(self._path_to_outdir, CHROMIUM_SRC_PATH)
|
||||||
] + self._additional_args
|
] + self._additional_args
|
||||||
|
|
||||||
# Coverage tests require some special pre-test setup, so use an
|
|
||||||
# on_device_script in that case. For all other tests, use cros_run_test's
|
|
||||||
# built-in '--tast' option. This gives us much better results reporting.
|
|
||||||
if self._llvm_profile_var:
|
|
||||||
# Build the shell script that will be used on the device to invoke the
|
|
||||||
# test.
|
|
||||||
device_test_script_contents = self.BASIC_SHELL_SCRIPT[:]
|
|
||||||
device_test_script_contents += [
|
|
||||||
'echo "LLVM_PROFILE_FILE=%s" >> /etc/chrome_dev.conf' %
|
|
||||||
(self._llvm_profile_var)
|
|
||||||
]
|
|
||||||
|
|
||||||
local_test_runner_cmd = ['local_test_runner', '-waituntilready']
|
|
||||||
if self._use_vm:
|
|
||||||
# If we're running tests in VMs, tell the test runner to skip tests that
|
|
||||||
# aren't compatible.
|
|
||||||
local_test_runner_cmd.append('-extrauseflags=tast_vm')
|
|
||||||
if self._attr_expr:
|
|
||||||
local_test_runner_cmd.append(pipes.quote(self._attr_expr))
|
|
||||||
else:
|
|
||||||
local_test_runner_cmd.extend(self._tests)
|
|
||||||
device_test_script_contents.append(' '.join(local_test_runner_cmd))
|
|
||||||
|
|
||||||
self._on_device_script = self.write_test_script_to_disk(
|
|
||||||
device_test_script_contents)
|
|
||||||
|
|
||||||
self._test_cmd += [
|
|
||||||
'--files',
|
|
||||||
os.path.relpath(self._on_device_script), '--',
|
|
||||||
'./' + os.path.relpath(self._on_device_script, self._path_to_outdir)
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
# Capture tast's results in the logs dir as well.
|
# Capture tast's results in the logs dir as well.
|
||||||
if self._logs_dir:
|
if self._logs_dir:
|
||||||
self._test_cmd += [
|
self._test_cmd += [
|
||||||
@@ -398,11 +351,6 @@ class TastTest(RemoteTest):
|
|||||||
self._test_cmd.append('--nostrip')
|
self._test_cmd.append('--nostrip')
|
||||||
|
|
||||||
def post_run(self, return_code):
|
def post_run(self, return_code):
|
||||||
# If we don't need to parse the host-side Tast tool's results, fall back to
|
|
||||||
# the parent method's default behavior.
|
|
||||||
if self._llvm_profile_var:
|
|
||||||
return super().post_run(return_code)
|
|
||||||
|
|
||||||
tast_results_path = os.path.join(self._logs_dir, 'streamed_results.jsonl')
|
tast_results_path = os.path.join(self._logs_dir, 'streamed_results.jsonl')
|
||||||
if not os.path.exists(tast_results_path):
|
if not os.path.exists(tast_results_path):
|
||||||
logging.error(
|
logging.error(
|
||||||
@@ -592,11 +540,6 @@ class GTestTest(RemoteTest):
|
|||||||
# Build the shell script that will be used on the device to invoke the test.
|
# Build the shell script that will be used on the device to invoke the test.
|
||||||
# Stored here as a list of lines.
|
# Stored here as a list of lines.
|
||||||
device_test_script_contents = self.BASIC_SHELL_SCRIPT[:]
|
device_test_script_contents = self.BASIC_SHELL_SCRIPT[:]
|
||||||
if self._llvm_profile_var:
|
|
||||||
device_test_script_contents += [
|
|
||||||
'export LLVM_PROFILE_FILE=%s' % self._llvm_profile_var,
|
|
||||||
]
|
|
||||||
|
|
||||||
for var_name, var_val in self._env_vars:
|
for var_name, var_val in self._env_vars:
|
||||||
device_test_script_contents += ['export %s=%s' % (var_name, var_val)]
|
device_test_script_contents += ['export %s=%s' % (var_name, var_val)]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user