log output
This commit is contained in:
parent
29132f5a58
commit
3eb02591d4
1 changed files with 48 additions and 35 deletions
|
|
@ -115,45 +115,58 @@ def worker(emu: str, apklist: list[str], out_folder: Path, script: Path):
|
||||||
continue
|
continue
|
||||||
folder.mkdir(parents=True)
|
folder.mkdir(parents=True)
|
||||||
|
|
||||||
# Start emulator with wipped data
|
with (
|
||||||
proc = subprocess.Popen(
|
(folder / "emu.out").open("w") as fp_emu_stdout,
|
||||||
[
|
(folder / "emu.err").open("w") as fp_emu_stderr,
|
||||||
EMULATOR,
|
(folder / "analysis.out").open("w") as fp_anly_stdout,
|
||||||
"-avd",
|
(folder / "analysis.err").open("w") as fp_anly_stderr,
|
||||||
emu,
|
):
|
||||||
"-wipe-data",
|
|
||||||
"-no-window",
|
|
||||||
"-no-metrics",
|
|
||||||
"-debug-init", # dunno why but sometime needed
|
|
||||||
"-ports",
|
|
||||||
f"{console_port},{adb_port}",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
subprocess.run([ADB, "-s", f"emulator-{console_port}", "wait-for-device"])
|
|
||||||
|
|
||||||
# Run script
|
# Start emulator with wipped data
|
||||||
subprocess.run(
|
proc = subprocess.Popen(
|
||||||
["bash", str(script), apk, f"emulator-{console_port}", str(folder)],
|
|
||||||
env=script_env,
|
|
||||||
)
|
|
||||||
|
|
||||||
# stop emulator
|
|
||||||
try:
|
|
||||||
subprocess.run(
|
|
||||||
[
|
[
|
||||||
ADB,
|
EMULATOR,
|
||||||
"-s",
|
"-avd",
|
||||||
f"emulator-{console_port}",
|
emu,
|
||||||
"emu",
|
"-wipe-data",
|
||||||
"kill",
|
"-no-window",
|
||||||
|
"-no-metrics",
|
||||||
|
"-debug-init", # dunno why but sometime needed
|
||||||
|
"-ports",
|
||||||
|
f"{console_port},{adb_port}",
|
||||||
],
|
],
|
||||||
timeout=3,
|
stdout=fp_emu_stdout,
|
||||||
|
stderr=fp_emu_stderr,
|
||||||
)
|
)
|
||||||
except subprocess.TimeoutExpired:
|
subprocess.run(
|
||||||
pass
|
[ADB, "-s", f"emulator-{console_port}", "wait-for-device"],
|
||||||
if proc.poll() is None:
|
stdout=fp_anly_stdout,
|
||||||
proc.kill()
|
stderr=fp_anly_stderr,
|
||||||
time.sleep(3)
|
)
|
||||||
|
|
||||||
|
# Run script
|
||||||
|
subprocess.run(
|
||||||
|
["bash", str(script), apk, f"emulator-{console_port}", str(folder)],
|
||||||
|
env=script_env,
|
||||||
|
)
|
||||||
|
|
||||||
|
# stop emulator
|
||||||
|
try:
|
||||||
|
subprocess.run(
|
||||||
|
[
|
||||||
|
ADB,
|
||||||
|
"-s",
|
||||||
|
f"emulator-{console_port}",
|
||||||
|
"emu",
|
||||||
|
"kill",
|
||||||
|
],
|
||||||
|
timeout=3,
|
||||||
|
)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
pass
|
||||||
|
if proc.poll() is None:
|
||||||
|
proc.kill()
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
|
|
||||||
def run(apklist: list[str], out_folder: Path, script: Path):
|
def run(apklist: list[str], out_folder: Path, script: Path):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue