forked from hamishcoleman/debian-minimal-builder
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.expect
executable file
·50 lines (40 loc) · 1.13 KB
/
test.expect
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
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env expect
#
# Use the "expect" tool to test that we actually can boot to userspace
#
set config_pass [lindex $argv 0]
if {$config_pass eq ""} {
set config_pass "unknown"
}
proc qemu_stop {} {
global pid
send "\x01x"
exec kill $pid
close
wait
}
proc bad { errorcode message } {
puts "\n\n"
puts "ERROR: $message\n"
qemu_stop
exit $errorcode
}
log_user 1
set timeout 60
set pid [spawn make test_run]
expect "Calibrating delay loop" {} timeout {bad 1 "Starting kernel"}
expect "Freeing initrd memory" {} timeout {bad 1 "Loading initrd"}
expect "Starting Ramdisk System" {} timeout {bad 1 "Starting /init"}
expect "Welcome to " {} timeout {bad 1 "Starting systemd"}
expect login {send root\r} timeout {bad 1 "login prompt"}
expect assword {send $config_pass\r} timeout {bad 1 "password prompt"}
expect {
root@ramdisk {send "who am i\r"}
"Login incorrect" {bad 1 "Incorrect password"}
timeout {bad 1 "Login success"}
}
expect "root ttyS0" {} timeout {bad 1 "Try a command"}
puts "\n\n"
puts "OK\n"
qemu_stop
exit 0