summaryrefslogtreecommitdiff
path: root/ubuntu/scripts/qemu-stress.expect
blob: fdab3a2881154ad6eda8a2680200e2c6996bda8b (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
30
31
32
33
34
35
36
37
38
#!/usr/bin/expect --
#
# Run qemu-system and spawn the stress benchmark
#

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

set exit_status 0
set timeout 20
spawn {*}$argv
expect "buildroot login: "
send -- "root\r"
expect "# "
set timeout 40
send -- "stress --cpu 4 --io 4 --vm 2 --vm-bytes 64M -d 2 --hdd-bytes 32M --timeout 30s\r"
expect {
    "successful run completed in *s" { expect "# "; send "# found success\n" }
    timeout { send "# time waiting for stress to finish\n"; set exit_status 1 }
}
expect "# "
set timeout 10
send -- "echo \$?\r"
expect {
    "0\r\r" { send "# found success\n" }
    "1\r\r" { send "# found failure\n"; set exit_status 2 }
    timeout { send "# time out looking for result\n"; set exit_status 3 }
}
expect "# "
send -- "halt -d 5\r"
expect "reboot: System halted"
send -- "c"
expect "(qemu) "
send -- "quit\r"
expect eof
exit $exit_status