Reland of Move side-loaded test data /sdcard -> /sdcard/chromium_tests_root

Reason for reland:
Updated webview tests that broke (WebViewLayoutTest.java)

And use delete_device_stale=True when pushing. This will prevent tests
mistakenly passing when they depend on stale data files from a previous test.

TBR=jbudorick@chromium.org,thakis@chromium.org,mef@chromium.org
BUG=607169

Review-Url: https://codereview.chromium.org/2018663002
Cr-Original-Commit-Position: refs/heads/master@{#396479}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 2524a0db714a44fbce723e00f6ed914e6d143cb6
This commit is contained in:
agrieve 2016-05-27 08:57:57 -07:00 коммит произвёл Commit bot
Родитель 06819181d4
Коммит a3802f0af2
4 изменённых файлов: 24 добавлений и 10 удалений

Просмотреть файл

@ -241,12 +241,16 @@ class LocalDeviceGtestRun(local_device_test_run.LocalDeviceTestRun):
def push_test_data():
# Push data dependencies.
external_storage = dev.GetExternalStoragePath()
device_root = posixpath.join(dev.GetExternalStoragePath(),
'chromium_tests_root')
data_deps = self._test_instance.GetDataDependencies()
host_device_tuples = [
(h, d if d is not None else external_storage)
(h, d if d is not None else device_root)
for h, d in data_deps]
dev.PushChangedFiles(host_device_tuples)
dev.PushChangedFiles(host_device_tuples, delete_device_stale=True)
if not host_device_tuples:
dev.RunShellCommand(['rm', '-rf', device_root], check_return=True)
dev.RunShellCommand(['mkdir', '-p', device_root], check_return=True)
def init_tool_and_start_servers():
tool = self.GetTool(dev)

Просмотреть файл

@ -4,6 +4,7 @@
import logging
import os
import posixpath
import re
import time
@ -58,11 +59,11 @@ class LocalDeviceInstrumentationTestRun(
return self._test_instance.suite
def SetUp(self):
def substitute_external_storage(d, external_storage):
def substitute_device_root(d, device_root):
if not d:
return external_storage
return device_root
elif isinstance(d, list):
return '/'.join(p if p else external_storage for p in d)
return posixpath.join(p if p else device_root for p in d)
else:
return d
@ -106,14 +107,19 @@ class LocalDeviceInstrumentationTestRun(
check_return=True)
def push_test_data():
external_storage = dev.GetExternalStoragePath()
device_root = posixpath.join(dev.GetExternalStoragePath(),
'chromium_tests_root')
host_device_tuples_substituted = [
(h, substitute_external_storage(d, external_storage))
(h, substitute_device_root(d, device_root))
for h, d in host_device_tuples]
logging.info('instrumentation data deps:')
for h, d in host_device_tuples_substituted:
logging.info('%r -> %r', h, d)
dev.PushChangedFiles(host_device_tuples_substituted)
dev.PushChangedFiles(host_device_tuples_substituted,
delete_device_stale=True)
if not host_device_tuples_substituted:
dev.RunShellCommand(['rm', '-rf', device_root], check_return=True)
dev.RunShellCommand(['mkdir', '-p', device_root], check_return=True)
def create_flag_changer():
if self._test_instance.flags:

Просмотреть файл

@ -230,6 +230,8 @@ class RemoteDeviceTestRun(test_run.TestRun):
self._app_id = self._UploadAppToDevice(app_path)
# TODO(agrieve): If AMP is ever ressurected, this needs to be changed to put
# test files under /sdcard/gtestdata. http://crbug.com/607169
data_deps = self._test_instance.GetDataDependencies()
if data_deps:
with tempfile.NamedTemporaryFile(suffix='.zip') as test_with_deps:

Просмотреть файл

@ -24,6 +24,7 @@
'<(DEPTH)/build/android/pylib/remote/device/dummy/dummy.gyp:require_remote_device_dummy_apk',
'<(DEPTH)/testing/android/appurify_support.gyp:appurify_support_java',
'<(DEPTH)/testing/android/on_device_instrumentation.gyp:reporter_java',
'<(DEPTH)/testing/android/native_test.gyp:native_test_java',
'<(DEPTH)/tools/android/android_tools.gyp:android_tools',
],
'conditions': [
@ -33,8 +34,9 @@
'test_type': 'gtest',
'apk_name': '<(test_suite_name)',
'intermediate_dir': '<(PRODUCT_DIR)/<(test_suite_name)_apk',
'java_in_dir': '<(DEPTH)/build/android/empty',
'android_manifest_path%': '<(DEPTH)/testing/android/native_test/java/AndroidManifest.xml',
'final_apk_path': '<(intermediate_dir)/<(test_suite_name)-debug.apk',
'java_in_dir': '<(DEPTH)/testing/android/native_test/java',
'native_lib_target': 'lib<(test_suite_name)',
# TODO(yfriedman, cjhopman): Support managed installs for gtests.
'gyp_managed_install': 0,