Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for when specified snippet class does not exist #30

Open
xpconanfan opened this issue Feb 1, 2017 · 2 comments
Open
Assignees

Comments

@xpconanfan
Copy link
Collaborator

xpconanfan commented Feb 1, 2017

If the snippet manifest's meta-data has classes that don't exist, say:

    <meta-data
        android:name="mobly-snippets"
        android:value="com.my.snippet.DoesNotExist" />

Snippet simply crashes on launching with no proper error message:

$ snippet_shell.py com.my.snippet
INFO:root:Stopping snippet apk with: am instrument -w -e action stop com.my.snippet/com.google.android.mobly.snippet.SnippetRunner
INFO:root:Launching snippet apk with: am instrument -e action start -e port 3429 com.my.snippet/com.google.android.mobly.snippet.SnippetRunner
Traceback (most recent call last):
  File "/usr/local/bin/snippet_shell.py", line 10, in <module>
    execfile(__file__)
  File "/usr/local/google/home/angli/Developer/mobly/tools/snippet_shell.py", line 65, in <module>
    SnippetShell(args.package[0]).main(args.serial)
  File "/usr/local/google/home/angli/Developer/mobly/mobly/controllers/android_device_lib/jsonrpc_shell_base.py", line 86, in main
    self.start_console()
  File "/usr/local/google/home/angli/Developer/mobly/mobly/controllers/android_device_lib/jsonrpc_shell_base.py", line 71, in start_console
    self._start_services(console_env)
  File "/usr/local/google/home/angli/Developer/mobly/tools/snippet_shell.py", line 42, in _start_services
    self._ad.load_snippet(name='snippet', package=self._package)
  File "/usr/local/google/home/angli/Developer/mobly/mobly/controllers/android_device.py", line 566, in load_snippet
    self._start_jsonrpc_client(client, host_port, device_port)
  File "/usr/local/google/home/angli/Developer/mobly/mobly/controllers/android_device.py", line 608, in _start_jsonrpc_client
    client.connect(port=host_port)
  File "/usr/local/google/home/angli/Developer/mobly/mobly/controllers/android_device_lib/jsonrpc_client_base.py", line 212, in connect
    resp = self._cmd(cmd, uid)
  File "/usr/local/google/home/angli/Developer/mobly/mobly/controllers/android_device_lib/jsonrpc_client_base.py", line 242, in _cmd
    return self._client.readline()
  File "/usr/lib/python2.7/socket.py", line 447, in readline
    data = self._sock.recv(self._rbufsize)
socket.error: [Errno 104] Connection reset by peer
@dthkao
Copy link
Contributor

dthkao commented Feb 1, 2017

I see a different error but same root cause:
mobly.controllers.android_device_lib.jsonrpc_client_base.AppStartError: com.package.name failed to start on <serial>.

@xpconanfan
Copy link
Collaborator Author

xpconanfan commented May 5, 2017

After the recent client change, a class does not exist error on the server side causes the client to hang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants