-
Notifications
You must be signed in to change notification settings - Fork 219
/
rust.exp
181 lines (166 loc) · 3.13 KB
/
rust.exp
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/usr/bin/expect -f
#
# This script test OP-TEE rust examples. The return code is 0 for
# success, >0 for error.
#
set timeout 60
info "Test Rust example applications:\n"
info "Running acipher-rs...\n"
send -- "acipher-rs 256 teststring\r"
expect {
-re "Success decrypt the above ciphertext as (\\d+) bytes plain text:" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running aes-rs...\n"
send -- "aes-rs\r"
expect {
-re "Prepare encode operation.*Encode buffer from TA.*Clear text and decoded text match" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running authentication-rs...\n"
send -- "authentication-rs\r"
expect {
-re "Clear text and decoded text match.*Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running big_int-rs...\n"
send -- "big_int-rs\r"
expect {
"Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running diffie_hellman-rs...\n"
send -- "diffie_hellman-rs\r"
expect {
-re "get key (\\d+) pair as public:.*private.*Derived share key as.*Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running digest-rs...\n"
send -- "digest-rs message1 message2\r"
expect {
-re "Get message hash as:.*Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running hello_world-rs...\n"
send -- "hello_world-rs\r"
expect {
-re "original value is 29.*inc value is 129.*dec value is 29.*Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running hotp-rs...\n"
send -- "hotp-rs\r"
expect {
-re "Get HOTP.*Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running random-rs...\n"
send -- "random-rs\r"
expect {
-re "Generate random UUID: \[a-z0-9]*-\[a-z0-9]*-\[a-z0-9]*-\[a-z0-9]*.*Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running secure_storage-rs...\n"
send -- "secure_storage-rs\r"
expect {
-re "We're done, close and release TEE resources" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running supp_plugin-rs...\n"
send -- "supp_plugin-rs\r"
expect {
-re "invoke commmand finished" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running time-rs...\n"
send -- "time-rs\r"
expect {
"Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
expect "# "
info "Running signature_verification-rs...\n"
# This one can take up to 6 minutes when CFG_CORE_DEBUG_CHECK_STACKS=y
# (3-4 minutes is common on my machine)
set timeout 400
send -- "signature_verification-rs\r"
expect {
"Success" {
info "Test success\n"
}
timeout {
info "!!! Timeout: Test failed\n"
exit 1
}
}
info "Rust examples tested successfully\n"