| #!/usr/bin/expect -f | |
| # Set the timeout to 10 seconds | |
| set timeout 10 | |
| # Capture CLI arguments and forward them to vm_shell.sh | |
| set extra_args $argv | |
| # Spawn the vm_shell.sh command | |
| spawn $env(ANDROID_BUILD_TOP)/packages/modules/Virtualization/android/vm/vm_shell.sh start-microdroid --auto-connect -- {*}$extra_args | |
| # Look for the expected output | |
| expect { | |
| "payload is ready" { | |
| send_user "\nSUCCESS: Microdroid payload is ready.\n" | |
| exit 0 | |
| } | |
| timeout { | |
| send_user "\nTIMEOUT: Timed out after 10 seconds waiting for 'payload is ready'.\n" | |
| exit 1 | |
| } | |
| eof { | |
| send_user "\nERROR: Process ended unexpectedly before 'payload is ready' was seen.\n" | |
| exit 1 | |
| } | |
| } |