googlecodelabs / android-perf-testing

Automated Performance Testing on Android
https://codelabs.developers.google.com/codelabs/android-perf-testing/
Apache License 2.0
93 stars 39 forks source link

run_perf_tests.py ShellCommandUnresponsiveException #17

Open RicardoBelchior opened 8 years ago

RicardoBelchior commented 8 years ago

when building/running the tests through the command line, a lot of times i'm getting this ShellCommandUnresponsiveException. It doesn't happen all the time, but most of the times.

However if I run the tests independently it runs fine: macbook-pro:android-perf-testing ricardobelchior$ adb shell am instrument -w -r -e annotation com.google.android.perftesting.common.PerfTest -e listener com.google.android.perftesting.TestListener -e disableAnalytics true com.google.android.perftesting.test/android.support.test.runner.AndroidJUnitRunner

In my project i also uncommented MainActivityTest and wrote a similar test for the RecyclerViewActivity. Do you guys know if its some 'timeout' value i should increase or something else ?

macbook-pro:android-perf-testing ricardobelchior$ ./gradlew :app:assembleDebug :app:assembleDebugAndroidTest :app:installDebug :app:installDebugAndroidTest

macbook-pro:android-perf-testing ricardobelchior$ ${ANDROID_HOME}/tools/monkeyrunner ./run_perf_tests.py ./ 192.168.56.101:5555
Writing logs to: ./
Using device_id: 192.168.56.101:5555
Your ANDROID_HOME is set to: /Users/ricardobelchior/Library/Android/sdk
Cleaning data files
Waiting for a device to be connected.
Device connected.
Starting dump permission grant
Starting storage permission grant
Clearing gfxinfo on device
Executing systrace
Starting test
Done systrace logging
Systrace Thread Done
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice] Error executing command: am instrument -w -r -e annotation com.google.android.perftesting.common.PerfTest -e listener com.google.android.perftesting.TestListener -e disableAnalytics true com.google.android.perftesting.test/android.support.test.runner.AndroidJUnitRunner
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.ShellCommandUnresponsiveException
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:503)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:381)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:352)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.ddmlib.Device.executeShellCommand(Device.java:613)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.chimpchat.adb.AdbChimpDevice.shell(AdbChimpDevice.java:274)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.chimpchat.adb.AdbChimpDevice.shell(AdbChimpDevice.java:267)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.chimpchat.adb.AdbChimpDevice.shell(AdbChimpDevice.java:262)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.chimpchat.adb.AdbChimpDevice.instrument(AdbChimpDevice.java:503)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.monkeyrunner.MonkeyDevice.instrument(MonkeyDevice.java:358)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at java.lang.reflect.Method.invoke(Method.java:606)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyObject.__call__(PyObject.java:422)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyObject.__call__(PyObject.java:426)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.__call__(PyMethod.java:139)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.pycode._pyx0.perform_test$1(/Users/ricardobelchior/workspace/android-perf-testing/./run_perf_tests.py:52)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.pycode._pyx0.call_function(/Users/ricardobelchior/workspace/android-perf-testing/./run_perf_tests.py)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyTableCode.call(PyTableCode.java:165)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyFunction.function___call__(PyFunction.java:376)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyFunction.__call__(PyFunction.java:371)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyFunction.__call__(PyFunction.java:366)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyObject._callextra(PyObject.java:527)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at threading$py.run$32(/Users/ricardobelchior/Library/Android/sdk/tools/lib/jython-standalone-2.5.3.jar/Lib/threading.py:170)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at threading$py.call_function(/Users/ricardobelchior/Library/Android/sdk/tools/lib/jython-standalone-2.5.3.jar/Lib/threading.py)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyTableCode.call(PyTableCode.java:165)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyBaseCode.call(PyBaseCode.java:134)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyFunction.__call__(PyFunction.java:317)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.__call__(PyMethod.java:109)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at threading$py._Thread__bootstrap$33(/Users/ricardobelchior/Library/Android/sdk/tools/lib/jython-standalone-2.5.3.jar/Lib/threading.py:223)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at threading$py.call_function(/Users/ricardobelchior/Library/Android/sdk/tools/lib/jython-standalone-2.5.3.jar/Lib/threading.py)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyTableCode.call(PyTableCode.java:165)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyBaseCode.call(PyBaseCode.java:301)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyBaseCode.call(PyBaseCode.java:194)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyFunction.__call__(PyFunction.java:387)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.__call__(PyMethod.java:211)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.__call__(PyMethod.java:201)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.__call__(PyMethod.java:196)
160615 11:18:48.247:S [TestThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.FunctionThread.run(FunctionThread.java:25)
Exception in thread TestThread:Traceback (most recent call last):
  File "/Users/ricardobelchior/Library/Android/sdk/tools/lib/jython-standalone-2.5.3.jar/Lib/threading.py", line 179, in _Thread__bootstrap
    self.run()
  File "/Users/ricardobelchior/Library/Android/sdk/tools/lib/jython-standalone-2.5.3.jar/Lib/threading.py", line 170, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/ricardobelchior/workspace/android-perf-testing/./run_perf_tests.py", line 51, in perform_test
    print device.instrument(test_runner, params)['stream']
NullPointerException: java.lang.NullPointerException
Test Thread Done
Time between test and trace thread completion: 9
Starting adb pull for test files
Starting adb pull for test files

FAIL: Could not find file indicating the test run completed. Check that the TestListener is writing files to external storage

OVERALL: FAILED. See above for more information.
brijesh-runkeeper commented 6 years ago

Running into this issue myself. Any leads?

PaulRashidi commented 6 years ago

Is it possible Android Studio or something else on your system is attempting to connect to the same device via ADB?