#!/usr/bin/expect -- # # Run qemu-system and check we can boot and shutdown # if {[llength $argv] == 0} { send_user "Usage: boot.expect \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