Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 1926793002: 👔 Move side-loaded test data /sdcard -> /sdcard/gtestdata (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import logging 5 import logging
6 import posixpath
6 import re 7 import re
7 import time 8 import time
8 9
9 from devil.android import device_errors 10 from devil.android import device_errors
10 from devil.android import flag_changer 11 from devil.android import flag_changer
11 from devil.utils import reraiser_thread 12 from devil.utils import reraiser_thread
12 from pylib import valgrind_tools 13 from pylib import valgrind_tools
13 from pylib.base import base_test_result 14 from pylib.base import base_test_result
14 from pylib.local.device import local_device_test_run 15 from pylib.local.device import local_device_test_run
15 16
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class LocalDeviceInstrumentationTestRun( 51 class LocalDeviceInstrumentationTestRun(
51 local_device_test_run.LocalDeviceTestRun): 52 local_device_test_run.LocalDeviceTestRun):
52 def __init__(self, env, test_instance): 53 def __init__(self, env, test_instance):
53 super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance) 54 super(LocalDeviceInstrumentationTestRun, self).__init__(env, test_instance)
54 self._flag_changers = {} 55 self._flag_changers = {}
55 56
56 def TestPackage(self): 57 def TestPackage(self):
57 return self._test_instance.suite 58 return self._test_instance.suite
58 59
59 def SetUp(self): 60 def SetUp(self):
60 def substitute_external_storage(d, external_storage): 61 def substitute_device_root(d, device_root):
61 if not d: 62 if not d:
62 return external_storage 63 return device_root
63 elif isinstance(d, list): 64 elif isinstance(d, list):
64 return '/'.join(p if p else external_storage for p in d) 65 return '/'.join(p if p else device_root for p in d)
jbudorick 2016/05/18 14:23:38 nit: since you're here, this should be posixpath.j
agrieve 2016/05/19 02:11:53 Done.
65 else: 66 else:
66 return d 67 return d
67 68
68 @local_device_test_run.handle_shard_failures_with( 69 @local_device_test_run.handle_shard_failures_with(
69 self._env.BlacklistDevice) 70 self._env.BlacklistDevice)
70 def individual_device_set_up(dev, host_device_tuples): 71 def individual_device_set_up(dev, host_device_tuples):
71 def install_apk(): 72 def install_apk():
72 if self._test_instance.apk_under_test: 73 if self._test_instance.apk_under_test:
73 if self._test_instance.apk_under_test_incremental_install_script: 74 if self._test_instance.apk_under_test_incremental_install_script:
74 local_device_test_run.IncrementalInstall( 75 local_device_test_run.IncrementalInstall(
(...skipping 23 matching lines...) Expand all
98 if not self._test_instance.package_info: 99 if not self._test_instance.package_info:
99 logging.error("Couldn't set debug app: no package info") 100 logging.error("Couldn't set debug app: no package info")
100 elif not self._test_instance.package_info.package: 101 elif not self._test_instance.package_info.package:
101 logging.error("Couldn't set debug app: no package defined") 102 logging.error("Couldn't set debug app: no package defined")
102 else: 103 else:
103 dev.RunShellCommand(['am', 'set-debug-app', '--persistent', 104 dev.RunShellCommand(['am', 'set-debug-app', '--persistent',
104 self._test_instance.package_info.package], 105 self._test_instance.package_info.package],
105 check_return=True) 106 check_return=True)
106 107
107 def push_test_data(): 108 def push_test_data():
108 external_storage = dev.GetExternalStoragePath() 109 device_root = posixpath.join(dev.GetExternalStoragePath(),
110 'chromium_tests_root')
jbudorick 2016/05/18 14:23:38 3 places :(
agrieve 2016/05/19 02:11:53 The entire pushing of .isolate data is duplicated.
109 host_device_tuples_substituted = [ 111 host_device_tuples_substituted = [
110 (h, substitute_external_storage(d, external_storage)) 112 (h, substitute_device_root(d, device_root))
111 for h, d in host_device_tuples] 113 for h, d in host_device_tuples]
112 logging.info('instrumentation data deps:') 114 logging.info('instrumentation data deps:')
113 for h, d in host_device_tuples_substituted: 115 for h, d in host_device_tuples_substituted:
114 logging.info('%r -> %r', h, d) 116 logging.info('%r -> %r', h, d)
115 dev.PushChangedFiles(host_device_tuples_substituted) 117 dev.PushChangedFiles(host_device_tuples_substituted,
118 delete_device_stale=True)
119 if not host_device_tuples_substituted:
120 dev.RunShellCommand(['rm', '-rf', device_root])
jbudorick 2016/05/18 14:23:38 again, check_return=True
agrieve 2016/05/19 02:11:53 Done.
121 dev.RunShellCommand(['mkdir', '-p', device_root])
116 122
117 def create_flag_changer(): 123 def create_flag_changer():
118 if self._test_instance.flags: 124 if self._test_instance.flags:
119 if not self._test_instance.package_info: 125 if not self._test_instance.package_info:
120 logging.error("Couldn't set flags: no package info") 126 logging.error("Couldn't set flags: no package info")
121 elif not self._test_instance.package_info.cmdline_file: 127 elif not self._test_instance.package_info.cmdline_file:
122 logging.error("Couldn't set flags: no cmdline_file") 128 logging.error("Couldn't set flags: no cmdline_file")
123 else: 129 else:
124 self._CreateFlagChangerIfNeeded(dev) 130 self._CreateFlagChangerIfNeeded(dev)
125 logging.debug('Attempting to set flags: %r', 131 logging.debug('Attempting to set flags: %r',
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 timeout = v 301 timeout = v
296 break 302 break
297 else: 303 else:
298 logging.warning('Using default 1 minute timeout for %s', test_name) 304 logging.warning('Using default 1 minute timeout for %s', test_name)
299 timeout = 60 305 timeout = 60
300 306
301 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations) 307 timeout *= cls._GetTimeoutScaleFromAnnotations(annotations)
302 308
303 return timeout 309 return timeout
304 310
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698