1

テストを自動化するスクリプトを作成しています: Android デバイスの内部メモリをいっぱいにします。スクリプトは Python で記述されており、monkeyrunner を使用してデバイスに接続し、コマンドを発行しています。
これを行うには、ダミー ファイルを作成する必要があります。このコマンドを使用する場合:

subprocess.call('adb shell dd if=/dev/zero of=/storage/sdcard0/dummy/dummy_file bs=1000000000 count=1', shell = True)

できます。ダミーファイルが作成されます。しかし、私は以下を使用したいと思います:

device.shell('dd if=/dev/zero of=/storage/sdcard0/dummy/dummy_file bs=1000000000 count=1')

同じことをする必要があります。しかし、後者は機能せず、これを生成します:

Importing modules
Waiting for connection
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] Error executing command: dd if=/dev/zero of=/storage/sdcard0/dummy/dummy2 bs=1000000000 count=1
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.ShellCommandUnresponsiveException
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:408)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.ddmlib.Device.executeShellCommand(Device.java:453)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.chimpchat.adb.AdbChimpDevice.shell(AdbChimpDevice.java:269)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.monkeyrunner.MonkeyDevice.shell(MonkeyDevice.java:217)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at java.lang.reflect.Method.invoke(Method.java:597)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyObject.__call__(PyObject.java:355)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.__call__(PyMethod.java:215)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyMethod.__call__(PyMethod.java:206)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyObject.__call__(PyObject.java:397)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyObject.__call__(PyObject.java:401)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.pycode._pyx0.f$0(/home/gabriel/android/git/androidqa/prebuilt/monkeyrunner/InternalStorage/int_storage_fill.py:57)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.pycode._pyx0.call_function(/home/gabriel/android/git/androidqa/prebuilt/monkeyrunner/InternalStorage/int_storage_fill.py)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyTableCode.call(PyTableCode.java:165)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.PyCode.call(PyCode.java:18)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.Py.runCode(Py.java:1197)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.core.__builtin__.execfile_flags(__builtin__.java:538)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:156)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77)
121003 16:54:32.383:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]   at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)

このエラーが発生する理由を知っている人はいますか?

4

1 に答える 1

1

AdbChimpDeviceTimeoutExceptionシェルコマンドが一定時間内に終了せず、ddコマンドがこの制限を超えている場合に生成します。別の方法に固執する必要がありsubprocessます。

デフォルトのタイムアウトは 5 秒です。

于 2012-10-03T14:58:24.670 に答える