android-test
android-test copied to clipboard
Making emulator-launcher Python2/3 compatible
Overview
A set of commits aimed to make the Python code under tools/android/emulator/ compatible with Python2 and Python3.
Proposed Changes
This PR includes changes proposed in https://github.com/android/android-test/pull/379 (by @jin), automatically futurizing using py2to3, and additional manual changes.
Still does not work. This is where I am:
INFO: Analyzed 3 targets (28 packages loaded, 1383 targets configured).
INFO: Found 3 test targets...
ERROR: /home/menny/dev/spotify/client/src/test/java/com/spotify/app/exampleapp/BUILD.bazel:41:39: Creating Android image for //src/test/java/com/spotify/app/exampleapp:default_26_x86 [for host] failed: (Exit 1): unified_launcher_head_py3 failed: error executing command bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3 '--action=boot' '--density=233' '--memory=1500' '--cache=32' '--vm_size=256' ... (remaining 17 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox unified_launcher_head_py3 failed: error executing command bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3 '--action=boot' '--density=233' '--memory=1500' '--cache=32' '--vm_size=256' ... (remaining 17 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/unified_launcher.py:755: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
config.readfp(filehandle)
W0402 00:18:41.317975 140282333488960 unified_launcher.py:979] Cannot find runfiles (via env vars). Defaulting to $CWD.
W0402 00:18:41.318398 140282333488960 unified_launcher.py:979] Cannot find runfiles (via env vars). Defaulting to $CWD.
9490 blocks
29246 blocks
I0402 00:18:42.589810 140282333488960 emulated_device.py:718] Making sdcard on the fly due to a nonstandard size
I0402 00:18:42.883148 140282333488960 emulated_device.py:289] Emulator type: 2
I0402 00:18:42.898872 140282333488960 emulated_device.py:1791] Executing: ['/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/external/androidsdk/emulator/emulator', '-ports', '18532,22036', '-skin', '480x800', '-timezone', 'America/Los_Angeles', '-cache', 'cache.img', '-memory', '1500', '-sdcard', 'sdcard.img', '-ramdisk', 'ramdisk.img', '-partition-size', '2047', '-no-snapshot-save', '-verbose', '-unix-pipe', 'sockets/qemu.mgmt', '-unix-pipe', 'sockets/device-forward-server', '-unix-pipe', 'sockets/tar-pull-server', '-unix-pipe', 'sockets/exec-server', '-unix-pipe', 'sockets/tar-push-server', '-unix-pipe', 'sockets/h2o', '-writable-system', '-show-kernel', '-engine', 'qemu2', '-kernel', 'kernel-ranchu', '-system', 'system.img', '-feature', 'AllowSnapshotMigration', '-feature', '-GLDMA', '-feature', '-OnDemandSnapshotLoad', '-vendor', 'vendor.img', '-data', 'userdata-qemu.img', '-encryption-key', 'encryptionkey.img', '-gpu', 'swiftshader_indirect', '-no-audio', '-no-boot-anim', '-selinux', 'permissive', '-fixed-scale', '-netdelay', 'none', '-netspeed', 'full', '-avd', 'mobile_ninjas.adb.22036', '-qemu', '-enable-kvm', '-L', '/tmp/tmppt26rms4android-emulator-launch/bios', '-append', 'enable_test_harness=1']
I0402 00:18:42.900997 140282333488960 emulated_device.py:1825] Launching emulator in: /tmp/tmppt26rms4android-emulator-launch/images/session
I0402 00:18:42.901297 140282333488960 emulated_device.py:1831] Write emulator log to /tmp/emulator_am1eq6bu.log
I0402 00:18:42.901979 140282333488960 emulated_device.py:2400] system: False pm: False adb: False sdcard: False boot_complete: False launcher: False pipes: False current step attempts: 0 total attempts: 0
I0402 00:18:42.902358 140282333488960 emulated_device.py:3946] Checking if adb is listening.
I0402 00:18:43.156985 140282333488960 emulated_device.py:2400] system: False pm: False adb: False sdcard: False boot_complete: False launcher: False pipes: False current step attempts: 1 total attempts: 1
I0402 00:18:43.157532 140282333488960 emulated_device.py:3892] Emulator log below ==================================================
I0402 00:18:43.157712 140282333488960 emulated_device.py:3893] Emulator log end ==================================================
I0402 00:18:43.158019 140282333488960 emulated_device.py:3892] watchdog.out below ==================================================
I0402 00:18:43.158167 140282333488960 emulated_device.py:3893] watchdog.out end ==================================================
I0402 00:18:43.158396 140282333488960 emulated_device.py:3892] watchdog.err below ==================================================
I0402 00:18:43.002389 140282333488960 emulated_device.py:1976] Starting pipe services.
I0402 00:18:43.158533 140282333488960 emulated_device.py:3893] watchdog.err end ==================================================
Traceback (most recent call last):
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 1130, in <module>
app.run(main)
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/absl_py/absl/app.py", line 262, in run
_run_main(main, argv)
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/absl_py/absl/app.py", line 227, in _run_main
sys.exit(main(argv))
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 1100, in main
EntryPoint(reporter)
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 908, in EntryPoint
_FirstBootAtBuildTimeOnly(
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 364, in _FirstBootAtBuildTimeOnly
device.StartDevice(enable_display=False, # Will be ignored.
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/emulated_device.py", line 1266, in StartDevice
self._StartEmulator(timer, net_type, new_process_group, window_scale,
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/emulated_device.py", line 1839, in _StartEmulator
self._PollEmulatorStatus(timer, loading_from_snapshot=loading_from_snapshot)
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/emulated_device.py", line 2412, in _PollEmulatorStatus
self._EnsureEmuRunning()
File "/home/menny/.cache/bazel/_bazel_menny/af40d3e221f4f1f4d13022ff525f8710/sandbox/linux-sandbox/14/execroot/spotify/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3.runfiles/android_test_support/tools/android/emulator/emulated_device.py", line 3919, in _EnsureEmuRunning
raise Exception('Emulator has died, exit status %d, signal %d' %
Exception: Emulator has died, exit status 1, signal 0
If you want to add certificates to the emulator, Please install MCrypt library using sudo apt-get install python-mcrypt .
ERROR: /home/menny/dev/spotify/client/src/test/java/com/spotify/app/exampleapp/BUILD.bazel:39:29 Middleman _middlemen/src_Stest_Sjava_Scom_Sspotify_Sapp_Sexampleapp_Sexample_Uapp_Utest-runfiles failed: (Exit 1): unified_launcher_head_py3 failed: error executing command bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3 '--action=boot' '--density=233' '--memory=1500' '--cache=32' '--vm_size=256' ... (remaining 17 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox unified_launcher_head_py3 failed: error executing command bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head_py3 '--action=boot' '--density=233' '--memory=1500' '--cache=32' '--vm_size=256' ... (remaining 17 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
INFO: Elapsed time: 4.631s, Critical Path: 2.56s
INFO: 8 processes: 8 internal.