New issue
Advanced search Search tips

Issue 626690 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Jul 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Can't run WebView instrumentation tests locally

Project Member Reported by gsennton@chromium.org, Jul 8 2016

Issue description

Trying to run
build/android/test_runner.py instrumentation --output-directory out-gn/Debug --test_data webview:android_webview/test/data/device_files --test-apk=AndroidWebViewTest

causes the following error for me


E    1.061s Main  Unrecognized error occurred.
Traceback (most recent call last):
  File "build/android/test_runner.py", line 978, in main
    return RunTestsCommand(args)
  File "build/android/test_runner.py", line 805, in RunTestsCommand
    return RunTestsInPlatformMode(args)
  File "build/android/test_runner.py", line 849, in RunTestsInPlatformMode
    args, env, test, infra_error) as test_run:
  File "/usr/local/google/code/clankium/src/build/android/pylib/base/test_run.py", line 34, in __enter__
    self.SetUp()
  File "/usr/local/google/code/clankium/src/build/android/pylib/local/device/local_device_instrumentation_test_run.py", line 148, in SetUp
    self._test_instance.GetDataDependencies())
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/parallelizer.py", line 236, in pMap
    r.pFinish(None)
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/parallelizer.py", line 135, in pFinish
    self._objs.JoinAll()
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/reraiser_thread.py", line 186, in JoinAll
    self._JoinAll(watcher, timeout)
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/reraiser_thread.py", line 158, in _JoinAll
    thread.ReraiseIfException()
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/reraiser_thread.py", line 81, in run
    self._ret = self._func(*self._args, **self._kwargs)
  File "/usr/local/google/code/clankium/src/build/android/pylib/local/device/local_device_test_run.py", line 68, in wrapper
    return f(dev, *args, **kwargs)
  File "/usr/local/google/code/clankium/src/build/android/pylib/local/device/local_device_instrumentation_test_run.py", line 144, in individual_device_set_up
    step()
  File "/usr/local/google/code/clankium/src/build/android/pylib/local/device/local_device_instrumentation_test_run.py", line 119, in push_test_data
    delete_device_stale=True)
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/android/decorators.py", line 57, in timeout_retry_wrapper
    retry_if_func=retry_if_func)
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/timeout_retry.py", line 157, in Run
    error_log_func=error_log_func)
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/reraiser_thread.py", line 186, in JoinAll
    self._JoinAll(watcher, timeout)
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/reraiser_thread.py", line 158, in _JoinAll
    thread.ReraiseIfException()
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/reraiser_thread.py", line 81, in run
    self._ret = self._func(*self._args, **self._kwargs)
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/utils/timeout_retry.py", line 150, in <lambda>
    child_thread = reraiser_thread.ReraiserThread(lambda: func(*args, **kwargs),
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/android/decorators.py", line 47, in impl
    return f(*args, **kwargs)
  File "/usr/local/google/code/clankium/src/third_party/catapult/devil/devil/android/device_utils.py", line 1188, in PushChangedFiles
    assert os.path.isabs(h) and posixpath.isabs(d)
  File "/usr/lib/python2.7/posixpath.py", line 61, in isabs
    return s.startswith('/')
AttributeError: 'generator' object has no attribute 'startswith'





In the following piece of code over in
https://cs.chromium.org/chromium/src/build/android/pylib/local/device/local_device_instrumentation_test_run.py?l=109

def push_test_data():
        device_root = posixpath.join(dev.GetExternalStoragePath(),
                                     'chromium_tests_root')
        host_device_tuples_substituted = [
            (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,
                             delete_device_stale=True)


the variable host_device_tuples_substituted is:

[('/usr/local/google/code/clankium/src/android_webview/test/data/device_files', <generator object <genexpr> at 0x7fa32f40dfa0>)]

which seems to be caused by posixpath.join returning a generator rather than just a file name in


  def SetUp(self):
    def substitute_device_root(d, device_root):
      if not d:
        return device_root
      elif isinstance(d, list):
        return posixpath.join(p if p else device_root for p in d)
      else:
        return d


the values passed to substitute_device_root in this case are
d = [None, 'chrome', 'test', 'data', 'webview']
device_root = /sdcard/chromium_tests_root


Any ideas as to why this is failing for me and not for the bots? 

 
Use out-gn/Debug/bin/run_android_webview_test_apk

Is there documentation somewhere that says use --test_data? We deprecated that last year but clearly didn't fully exterminate it, but it'd be nice to do so.
That binary runs perfectly, thanks.
Status: Fixed (was: Untriaged)
Updated the documentation to match.

Sign in to add a comment