summaryrefslogtreecommitdiff
path: root/ubuntu/scripts/qemu-edk2-boot.expect
blob: 62300b0cf8f876c02115a7d4c1587ec589fffe5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/expect --
#
# Run qemu-system and check we can boot and shutdown
#

if {[llength $argv] == 0} {
  send_user "Usage: boot.expect <qemu invocation>\n"
  exit 1
}

set timeout 180
spawn {*}$argv
expect {
    "buildroot login: " { send -- "root\r" }
    timeout { send "# boot failed"; exit 1 }
}


expect "# "
send -- "uname -a\r"
expect "# "
set timeout 10
send -- "halt -d 5\r"
expect {
    "reboot: System halted" { send -- "c"; expect "(qemu) "; send -- "quit\r" }
    timeout { send "# shutdown failed"; exit 2 }
}
expect eof
exit 0