Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 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 | |
| 10 | set timeout "$env(QEMU_RUN_TIMER)*2" |
| 11 | set command "$env(HOME)/boot-qemu.sh" |
| 12 | |
| 13 | spawn $command |
| 14 | |
| 15 | expect { |
| 16 | timeout { send_user "\nFailed to boot\n"; exit 1 } |
| 17 | eof { send_user "\nFailure, got EOF"; exit 1 } |
Andrew Geissler | 4290d58 | 2018-01-05 23:34:52 -0600 | [diff] [blame] | 18 | "* login:" |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | send "root\r" |
| 22 | |
| 23 | expect { |
| 24 | timeout { send_user "\nFailed, no login prompt\n"; exit 1 } |
| 25 | eof { send_user "\nFailure, got EOF"; exit 1 } |
| 26 | "Password:" |
| 27 | } |
| 28 | |
| 29 | send "0penBmc\r" |
| 30 | |
| 31 | expect { |
| 32 | timeout { send_user "\nFailed, could not login\n"; exit 1 } |
| 33 | eof { send_user "\nFailure, got EOF"; exit 1 } |
Andrew Geissler | 4290d58 | 2018-01-05 23:34:52 -0600 | [diff] [blame] | 34 | "root@*:~#" |
Andrew Geissler | 0205e8d | 2016-08-10 07:46:19 -0500 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | send_user "OPENBMC-READY\n" |
| 38 | sleep "$env(QEMU_RUN_TIMER)" |
| 39 | send_user "OPENBMC-EXITING\n" |