-
Notifications
You must be signed in to change notification settings - Fork 236
Expand file tree
/
Copy pathqemu-check.exp
More file actions
117 lines (113 loc) · 2.92 KB
/
Copy pathqemu-check.exp
File metadata and controls
117 lines (113 loc) · 2.92 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/expect -f
#
# This scripts starts QEMU, loads and boots Linux/OP-TEE, then runs
# tests in the guest. The return code is 0 for success, >0 for error.
#
# Options:
# -q Suppress output to stdout (quiet)
# --tests Type of tests to run, values: all, xtest and trusted-keys
# --timeout Timeout for each test (sub)case, in seconds [480]
# --xtest-args Optional arguments to xtest
set bios "../out/bios-qemu/bios.bin"
set cmd1 "cd /mnt/host/build/qemu_v8/xen"
if {[info exists ::env(XEN_FFA)] && $::env(XEN_FFA) == "y"} {
set cmd2 "xl create guest_ffa.cfg"
} else {
set cmd2 "xl create guest.cfg"
}
set cmd3 "xl console domu"
set quiet 0
set xtest_args ""
if {[info exists ::env(RUST_ENABLE)] && $::env(RUST_ENABLE) == "y"} {
set rust_enable 1
} else {
set rust_enable 0
}
# The time required to run some tests (e.g., key generation tests [4007.*])
# can be significant and vary widely -- typically, from about one minute to
# several minutes depending on the host machine.
# The value here should be sufficient to run the whole optee_test suite
# ('xtest') with all testsuites enabled (regression+gp+pkcs11).
set timeout 900
set tests "all"
set basedir [file dirname $argv0]
source $basedir/qemu-check-common.exp
parse_common_args
set cmd "xtest $xtest_args"
# Disable echoing of guest output
log_user 0
# Save guest console output to a file
log_file -a -noappend "serial0.log"
info "Starting QEMU..."
open "serial1.log" "w+"
spawn -open [open "|tail -f serial1.log"]
set teecore $spawn_id
spawn sh -c "$::env(QEMU) $::env(QEMU_CHECK_ARGS)"
expect {
"Kernel panic" {
info "!!! Kernel panic\n"
exit 1
}
timeout {
info "!!! Timeout\n"
exit 1
}
"ogin:"
}
send -- "root\r\r"
expect "# "
info " done, guest is booted"
if {$::env(XEN_BOOT) == "y"} {
info " (Xen Dom0)"
}
info ".\n"
# Toolchain libraries might be here or there
send -- "export LD_LIBRARY_PATH=/lib:/lib/arm-linux-gnueabihf\r"
if {$tests == "all" || $tests == "xtest"} {
info "Running: $cmd...\n"
expect "# "
send -- "$cmd\r"
check_test_result $teecore
}
if {$::env(XEN_BOOT) == "y"} {
info " Booting DomU.\n"
expect "# "
info "Running: $cmd1...\n"
send -- "$cmd1\r"
expect "# "
info "Running: $cmd2...\n"
send -- "$cmd2\r"
expect "# "
info "Running: $cmd3...\n"
send -- "$cmd3\r"
expect {
"Kernel panic" {
info "!!! Kernel panic\n"
exit 1
}
timeout {
info "!!! Timeout\n"
exit 1
}
"login:"
}
send -- "root\r\r"
expect "# "
info " done, DomU is booted.\n"
# Toolchain libraries might be here or there
send -- "export LD_LIBRARY_PATH=/lib:/lib/arm-linux-gnueabihf\r"
expect "# "
if {$tests == "all" || $tests == "xtest"} {
info "Running: $cmd...\n"
send -- "$cmd\r"
check_test_result $teecore
}
}
if {$tests == "all" || $tests == "trusted-keys"} {
# Invoke Trusted Keys tests
source $basedir/trusted-keys.exp
}
if {($tests == "all" || $tests == "rust") && $::rust_enable == 1} {
# Invoke Rust tests
source $basedir/rust.exp
}