more functional general tester; better signal handling and details in xv6 tester
This commit is contained in:
@@ -1,29 +1,38 @@
|
||||
#! /usr/bin/env expect
|
||||
|
||||
proc shutdown {} {
|
||||
# send command to halt qemu (ctrl-a x)
|
||||
# https://stackoverflow.com/questions/27050473/how-to-send-ctrl-a-then-d-in-expect
|
||||
send "\x01"; send "x"
|
||||
# make sure to wait for it all to stop
|
||||
# (without this, script was terminating before qemu quit -> bad)
|
||||
expect eof
|
||||
}
|
||||
|
||||
# turn off timeout (perhaps make this flexible later)
|
||||
set timeout -1
|
||||
|
||||
# build and launch xv6 on qemu
|
||||
spawn make qemu-nox
|
||||
spawn make [lindex $argv 0] -f [lindex $argv 1] qemu-nox
|
||||
|
||||
trap {
|
||||
shutdown
|
||||
exit 0
|
||||
} SIGINT
|
||||
|
||||
# wait for initial prompt
|
||||
expect "init: starting sh\r"
|
||||
expect "$ "
|
||||
|
||||
# send command as per command line
|
||||
send "$argv\r"
|
||||
send "[lindex $argv 2]\r"
|
||||
|
||||
# wait for it to be done
|
||||
expect "$ "
|
||||
|
||||
# send command to halt qemu (ctrl-a x)
|
||||
# how to do so found here:
|
||||
# https://stackoverflow.com/questions/27050473/how-to-send-ctrl-a-then-d-in-expect
|
||||
send "\x01"; send "x"
|
||||
|
||||
# make sure to wait for it all to stop
|
||||
# (without this, script was terminating before qemu quit -> bad)
|
||||
interact
|
||||
# shutdown qemu properly (avoid runaways)
|
||||
shutdown
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user