Commit 9375cae1 authored by John Budorick's avatar John Budorick Committed by Commit Bot

android: disable verity in with_asan.py on M+.

Bug: 790202
Change-Id: Icb8d353adb84747d5791c7a38e3ef211690cf712
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1614025Reviewed-by: default avatarBen Pastene <bpastene@chromium.org>
Commit-Queue: John Budorick <jbudorick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660955}
parent f23ad060
...@@ -73,6 +73,7 @@ python_library("devil_chromium_py") { ...@@ -73,6 +73,7 @@ python_library("devil_chromium_py") {
} }
python_library("test_runner_py") { python_library("test_runner_py") {
testonly = true
pydeps_file = "test_runner.pydeps" pydeps_file = "test_runner.pydeps"
data = [ data = [
"pylib/gtest/filter/", "pylib/gtest/filter/",
......
...@@ -152,7 +152,7 @@ class LocalDeviceEnvironment(environment.Environment): ...@@ -152,7 +152,7 @@ class LocalDeviceEnvironment(environment.Environment):
@handle_shard_failures_with(on_failure=self.BlacklistDevice) @handle_shard_failures_with(on_failure=self.BlacklistDevice)
def prepare_device(d): def prepare_device(d):
d.WaitUntilFullyBooted(timeout=120) d.WaitUntilFullyBooted()
if self._enable_device_cache: if self._enable_device_cache:
cache_path = _DeviceCachePath(d) cache_path = _DeviceCachePath(d)
......
...@@ -7,6 +7,7 @@ import("//build/config/clang/clang.gni") ...@@ -7,6 +7,7 @@ import("//build/config/clang/clang.gni")
import("//build/util/generate_wrapper.gni") import("//build/util/generate_wrapper.gni")
generate_wrapper("asan_device_setup") { generate_wrapper("asan_device_setup") {
testonly = true
executable = "with_asan.py" executable = "with_asan.py"
wrapper_script = "$root_out_dir/bin/run_with_asan" wrapper_script = "$root_out_dir/bin/run_with_asan"
...@@ -38,6 +39,11 @@ generate_wrapper("asan_device_setup") { ...@@ -38,6 +39,11 @@ generate_wrapper("asan_device_setup") {
] ]
data += _lib_paths data += _lib_paths
data_deps = [
"//build/android:devil_chromium_py",
"//third_party/catapult/devil",
]
_rebased_adb_path = rebase_path(_adb_path, root_build_dir) _rebased_adb_path = rebase_path(_adb_path, root_build_dir)
_rebased_lib_dir_path = rebase_path(_lib_dir, root_build_dir) _rebased_lib_dir_path = rebase_path(_lib_dir, root_build_dir)
......
...@@ -10,6 +10,15 @@ import os ...@@ -10,6 +10,15 @@ import os
import subprocess import subprocess
import sys import sys
_SRC_ROOT = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
sys.path.append(os.path.join(_SRC_ROOT, 'third_party', 'catapult', 'devil'))
from devil.android import device_utils
from devil.android.sdk import version_codes
sys.path.append(os.path.join(_SRC_ROOT, 'build', 'android'))
import devil_chromium
_SCRIPT_PATH = os.path.abspath( _SCRIPT_PATH = os.path.abspath(
os.path.join( os.path.join(
...@@ -22,7 +31,13 @@ def Asan(args): ...@@ -22,7 +31,13 @@ def Asan(args):
env = os.environ.copy() env = os.environ.copy()
env['ADB'] = args.adb env['ADB'] = args.adb
device = device_utils.DeviceUtils.HealthyDevices(
device_arg=args.device)[0]
disable_verity = device.build_version_sdk >= version_codes.MARSHMALLOW
try: try:
if disable_verity:
device.adb.DisableVerity()
device.Reboot()
setup_cmd = [_SCRIPT_PATH, '--lib', args.lib] setup_cmd = [_SCRIPT_PATH, '--lib', args.lib]
if args.device: if args.device:
setup_cmd += ['--device', args.device] setup_cmd += ['--device', args.device]
...@@ -33,6 +48,9 @@ def Asan(args): ...@@ -33,6 +48,9 @@ def Asan(args):
if args.device: if args.device:
teardown_cmd += ['--device', args.device] teardown_cmd += ['--device', args.device]
subprocess.check_call(teardown_cmd, env=env) subprocess.check_call(teardown_cmd, env=env)
if disable_verity:
device.adb.EnableVerity()
device.Reboot()
def main(raw_args): def main(raw_args):
...@@ -51,6 +69,8 @@ def main(raw_args): ...@@ -51,6 +69,8 @@ def main(raw_args):
help='Command to run with ASAN installed.') help='Command to run with ASAN installed.')
args = parser.parse_args() args = parser.parse_args()
devil_chromium.Initialize(adb_path=args.adb)
with Asan(args): with Asan(args):
if args.command: if args.command:
return subprocess.call(args.command) return subprocess.call(args.command)
......
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