's'
This commit is contained in:
@@ -195,6 +195,58 @@ def wait_tcp_port(host, port, timeout_sec, interval=1.0):
|
||||
return False
|
||||
|
||||
|
||||
def local_post_diagnose(container_runtime, name, port, settle_sec):
|
||||
"""On the Docker host: container status, logs, adb, short logcat."""
|
||||
print_color(
|
||||
"\n========== --diagnose (local): waiting {}s ==========".format(settle_sec),
|
||||
bcolors.YELLOW,
|
||||
)
|
||||
time.sleep(settle_sec)
|
||||
serial = "127.0.0.1:{}".format(port)
|
||||
print_color("--- {} ps -a ---".format(container_runtime), bcolors.GREEN)
|
||||
subprocess.run(
|
||||
[container_runtime, "ps", "-a", "--filter", "name={}".format(name), "--no-trunc"],
|
||||
check=False,
|
||||
)
|
||||
print_color("--- {} inspect ---".format(container_runtime), bcolors.GREEN)
|
||||
subprocess.run(
|
||||
[
|
||||
container_runtime,
|
||||
"inspect",
|
||||
"--format",
|
||||
"status={{.State.Status}} exit={{.State.ExitCode}} err={{.State.Error}}",
|
||||
name,
|
||||
],
|
||||
check=False,
|
||||
)
|
||||
print_color("--- {} logs (tail 120) ---".format(container_runtime), bcolors.GREEN)
|
||||
subprocess.run([container_runtime, "logs", "--tail", "120", name], check=False)
|
||||
print_color("--- adb ---", bcolors.GREEN)
|
||||
subprocess.run(["adb", "connect", serial], check=False)
|
||||
subprocess.run(["adb", "devices", "-l"], check=False)
|
||||
subprocess.run(["adb", "-s", serial, "shell", "getprop", "sys.boot_completed"], check=False)
|
||||
print_color("--- adb logcat (display/GLES, last 80 lines) ---", bcolors.GREEN)
|
||||
subprocess.run(
|
||||
[
|
||||
"adb",
|
||||
"-s",
|
||||
serial,
|
||||
"logcat",
|
||||
"-d",
|
||||
"-t",
|
||||
"80",
|
||||
"*:S",
|
||||
"SurfaceFlinger:V",
|
||||
"EGL:V",
|
||||
"OpenGLRenderer:V",
|
||||
"redroid:V",
|
||||
"AndroidRuntime:E",
|
||||
],
|
||||
check=False,
|
||||
)
|
||||
print_color("========== end --diagnose ==========\n", bcolors.YELLOW)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Launch a redroid container with a tested native bridge configuration."
|
||||
@@ -240,10 +292,11 @@ def main():
|
||||
)
|
||||
parser.add_argument(
|
||||
"--gpu-mode",
|
||||
default="auto",
|
||||
default="guest",
|
||||
help=(
|
||||
"androidboot.redroid_gpu_mode: auto=host if /dev/dri exists else guest (default); "
|
||||
"guest=software GLES; host=GPU (adds --device for each DRI node when present)"
|
||||
"androidboot.redroid_gpu_mode: default guest (stable on headless). "
|
||||
"auto=guest unless REDROID_USE_HOST_GPU=1 and DRI exists, then host. "
|
||||
"host=GPU (adds --device per DRI node when present)"
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -307,6 +360,18 @@ def main():
|
||||
"If it never opens, print container logs. Use 90 when debugging failed adb connect."
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--diagnose",
|
||||
action="store_true",
|
||||
help="After start: wait, then print docker ps/inspect/logs + adb + logcat (same host as Docker)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--diagnose-settle",
|
||||
type=int,
|
||||
default=15,
|
||||
metavar="SEC",
|
||||
help="Seconds to sleep before --diagnose probes (default 15)",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
image = args.image
|
||||
@@ -407,6 +472,8 @@ def main():
|
||||
|
||||
subprocess.run(cmd, check=True)
|
||||
print_color("Container started as {}".format(name), bcolors.GREEN)
|
||||
if args.diagnose:
|
||||
local_post_diagnose(args.container, name, args.port, args.diagnose_settle)
|
||||
if args.wait_tcp > 0:
|
||||
print_color(
|
||||
"Waiting up to {}s for 127.0.0.1:{} (adbd TCP) ...".format(args.wait_tcp, args.port),
|
||||
|
||||
Reference in New Issue
Block a user