1#!/usr/bin/expect
2#
3# Launch QEMU and verify we can login then sleep for defined amount of time
4# before exiting
5#
6#  Requires following env variables be set:
7#   QEMU_RUN_TIMER  Amount of time to run the QEMU instance
8#   HOME            Location of scripts
9
10set timeout "$env(QEMU_RUN_TIMER)*2"
11set command "$env(HOME)/boot-qemu.sh"
12
13spawn $command
14
15expect {
16  timeout { send_user "\nFailed to boot\n"; exit 1 }
17  eof { send_user "\nFailure, got EOF"; exit 1 }
18  "qemuarm login:"
19}
20
21send "root\r"
22
23expect {
24  timeout { send_user "\nFailed, no login prompt\n"; exit 1 }
25  eof { send_user "\nFailure, got EOF"; exit 1 }
26  "Password:"
27}
28
29send "0penBmc\r"
30
31expect {
32  timeout { send_user "\nFailed, could not login\n"; exit 1 }
33  eof { send_user "\nFailure, got EOF"; exit 1 }
34  "root@qemuarm:~#"
35}
36
37send_user "OPENBMC-READY\n"
38sleep "$env(QEMU_RUN_TIMER)"
39send_user "OPENBMC-EXITING\n"
40