forked from mirrors/gecko-dev
Bug 1722483 - Remove emulator lock files if present. r=nalexander
Looks like the emulator doesn't run the cleanup step when running in headless
mode, so we need to remove the lock files manually:
84416e78b4/android/android-emu/android/console.cpp (4016)
Differential Revision: https://phabricator.services.mozilla.com/D120999
This commit is contained in:
parent
510ffc6824
commit
475c203ebc
1 changed files with 16 additions and 3 deletions
|
|
@ -458,7 +458,8 @@ def ensure_android_avd(
|
|||
e = subprocess.CalledProcessError(retcode, cmd)
|
||||
raise e
|
||||
|
||||
config_file_name = os.path.join(avd_home_path, avd_name + ".avd", "config.ini")
|
||||
avd_path = os.path.join(avd_home_path, avd_name + ".avd")
|
||||
config_file_name = os.path.join(avd_path, "config.ini")
|
||||
|
||||
print("Writing config at %s" % config_file_name)
|
||||
|
||||
|
|
@ -474,6 +475,17 @@ def ensure_android_avd(
|
|||
run_prewarm_avd(
|
||||
adb_tool, emulator_tool, env, avd_name, avd_manifest, no_interactive
|
||||
)
|
||||
# When running in headless mode, the emulator does not run the cleanup
|
||||
# step, and thus doesn't delete lock files. On some platforms, left-over
|
||||
# lock files can cause the emulator to not start, so we remove them here.
|
||||
for lock_file in ["hardware-qemu.ini.lock", "multiinstance.lock"]:
|
||||
lock_file_path = os.path.join(avd_path, lock_file)
|
||||
try:
|
||||
os.remove(lock_file_path)
|
||||
print("Removed lock file %s" % lock_file_path)
|
||||
except OSError:
|
||||
# The lock file is not there, nothing to do.
|
||||
pass
|
||||
|
||||
|
||||
def run_prewarm_avd(
|
||||
|
|
@ -509,8 +521,9 @@ def run_prewarm_avd(
|
|||
if not booted:
|
||||
raise NotImplementedError("Could not prewarm emulator")
|
||||
|
||||
# We can kill the emulator now
|
||||
proc.terminate()
|
||||
# Wait until the emulator completely shuts down
|
||||
subprocess.Popen([adb_tool, "emu", "kill"], env=env).wait()
|
||||
proc.wait()
|
||||
|
||||
|
||||
def ensure_android_packages(
|
||||
|
|
|
|||
Loading…
Reference in a new issue