blob: bd26a5342c8e0310a8d11058a13220825c7a8011 [file] [log] [blame]
David Brown5e8dbb92020-09-09 13:17:38 -06001// Package mcutests
2package mcutests // github.com/JuulLabs-OSS/mcuboot/samples/zephyr/mcutests
3
4// The main driver of this consists of a series of tests. Each test
5// then contains a series of commands and expect results.
6var Tests = []struct {
David Brownc997a602020-09-09 17:06:21 -06007 Name string
8 ShortName string
9 Tests []OneTest
David Brown5e8dbb92020-09-09 13:17:38 -060010}{
11 {
David Brownc997a602020-09-09 17:06:21 -060012 Name: "Good RSA",
13 ShortName: "good-rsa",
David Brown5e8dbb92020-09-09 13:17:38 -060014 Tests: []OneTest{
15 {
16 Commands: [][]string{
17 {"make", "test-good-rsa"},
18 {"make", "flash_boot"},
19 },
20 Expect: "Unable to find bootable image",
21 },
22 {
23 Commands: [][]string{
24 {"make", "flash_hello1"},
25 },
26 Expect: "Hello World from hello1",
27 },
28 {
29 Commands: [][]string{
30 {"make", "flash_hello2"},
31 },
32 Expect: "Hello World from hello2",
33 },
34 {
35 Commands: [][]string{
36 {"pyocd", "commander", "-c", "reset"},
37 },
38 Expect: "Hello World from hello1",
39 },
40 },
41 },
42 {
David Brownc997a602020-09-09 17:06:21 -060043 Name: "Good ECDSA",
44 ShortName: "good-ecdsa",
David Brown5e8dbb92020-09-09 13:17:38 -060045 Tests: []OneTest{
46 {
47 Commands: [][]string{
48 {"make", "test-good-ecdsa"},
49 {"make", "flash_boot"},
50 },
51 Expect: "Unable to find bootable image",
52 },
53 {
54 Commands: [][]string{
55 {"make", "flash_hello1"},
56 },
57 Expect: "Hello World from hello1",
58 },
59 {
60 Commands: [][]string{
61 {"make", "flash_hello2"},
62 },
63 Expect: "Hello World from hello2",
64 },
65 {
66 Commands: [][]string{
67 {"pyocd", "commander", "-c", "reset"},
68 },
69 Expect: "Hello World from hello1",
70 },
71 },
72 },
73 {
David Brownc997a602020-09-09 17:06:21 -060074 Name: "Overwrite",
75 ShortName: "overwrite",
David Brown5e8dbb92020-09-09 13:17:38 -060076 Tests: []OneTest{
77 {
78 Commands: [][]string{
79 {"make", "test-overwrite"},
80 {"make", "flash_boot"},
81 },
82 Expect: "Unable to find bootable image",
83 },
84 {
85 Commands: [][]string{
86 {"make", "flash_hello1"},
87 },
88 Expect: "Hello World from hello1",
89 },
90 {
91 Commands: [][]string{
92 {"make", "flash_hello2"},
93 },
94 Expect: "Hello World from hello2",
95 },
96 {
97 Commands: [][]string{
98 {"pyocd", "commander", "-c", "reset"},
99 },
100 Expect: "Hello World from hello2",
101 },
102 },
103 },
104 {
David Brownc997a602020-09-09 17:06:21 -0600105 Name: "Bad RSA",
106 ShortName: "bad-rsa-upgrade",
David Brown5e8dbb92020-09-09 13:17:38 -0600107 Tests: []OneTest{
108 {
109 Commands: [][]string{
110 {"make", "test-bad-rsa-upgrade"},
111 {"make", "flash_boot"},
112 },
113 Expect: "Unable to find bootable image",
114 },
115 {
116 Commands: [][]string{
117 {"make", "flash_hello1"},
118 },
119 Expect: "Hello World from hello1",
120 },
121 {
122 Commands: [][]string{
123 {"make", "flash_hello2"},
124 },
125 Expect: "Hello World from hello1",
126 },
127 {
128 Commands: [][]string{
129 {"pyocd", "commander", "-c", "reset"},
130 },
131 Expect: "Hello World from hello1",
132 },
133 },
134 },
135 {
David Brownc997a602020-09-09 17:06:21 -0600136 Name: "Bad RSA",
137 ShortName: "bad-ecdsa-upgrade",
David Brown5e8dbb92020-09-09 13:17:38 -0600138 Tests: []OneTest{
139 {
140 Commands: [][]string{
141 {"make", "test-bad-ecdsa-upgrade"},
142 {"make", "flash_boot"},
143 },
144 Expect: "Unable to find bootable image",
145 },
146 {
147 Commands: [][]string{
148 {"make", "flash_hello1"},
149 },
150 Expect: "Hello World from hello1",
151 },
152 {
153 Commands: [][]string{
154 {"make", "flash_hello2"},
155 },
156 Expect: "Hello World from hello1",
157 },
158 {
159 Commands: [][]string{
160 {"pyocd", "commander", "-c", "reset"},
161 },
162 Expect: "Hello World from hello1",
163 },
164 },
165 },
166 {
David Brownc997a602020-09-09 17:06:21 -0600167 Name: "No bootcheck",
168 ShortName: "no-bootcheck",
David Brown5e8dbb92020-09-09 13:17:38 -0600169 Tests: []OneTest{
170 {
171 Commands: [][]string{
172 {"make", "test-no-bootcheck"},
173 {"make", "flash_boot"},
174 },
175 Expect: "Unable to find bootable image",
176 },
177 {
178 Commands: [][]string{
179 {"make", "flash_hello1"},
180 },
181 Expect: "Hello World from hello1",
182 },
183 {
184 Commands: [][]string{
185 {"make", "flash_hello2"},
186 },
187 Expect: "Hello World from hello1",
188 },
189 {
190 Commands: [][]string{
191 {"pyocd", "commander", "-c", "reset"},
192 },
193 Expect: "Hello World from hello1",
194 },
195 },
196 },
197 {
David Brownc997a602020-09-09 17:06:21 -0600198 Name: "Wrong RSA",
199 ShortName: "wrong-rsa",
David Brown5e8dbb92020-09-09 13:17:38 -0600200 Tests: []OneTest{
201 {
202 Commands: [][]string{
203 {"make", "test-wrong-rsa"},
204 {"make", "flash_boot"},
205 },
206 Expect: "Unable to find bootable image",
207 },
208 {
209 Commands: [][]string{
210 {"make", "flash_hello1"},
211 },
212 Expect: "Hello World from hello1",
213 },
214 {
215 Commands: [][]string{
216 {"make", "flash_hello2"},
217 },
218 Expect: "Hello World from hello1",
219 },
220 {
221 Commands: [][]string{
222 {"pyocd", "commander", "-c", "reset"},
223 },
224 Expect: "Hello World from hello1",
225 },
226 },
227 },
228 {
David Brownc997a602020-09-09 17:06:21 -0600229 Name: "Wrong ECDSA",
230 ShortName: "wrong-ecdsa",
David Brown5e8dbb92020-09-09 13:17:38 -0600231 Tests: []OneTest{
232 {
233 Commands: [][]string{
234 {"make", "test-wrong-ecdsa"},
235 {"make", "flash_boot"},
236 },
237 Expect: "Unable to find bootable image",
238 },
239 {
240 Commands: [][]string{
241 {"make", "flash_hello1"},
242 },
243 Expect: "Hello World from hello1",
244 },
245 {
246 Commands: [][]string{
247 {"make", "flash_hello2"},
248 },
249 Expect: "Hello World from hello1",
250 },
251 {
252 Commands: [][]string{
253 {"pyocd", "commander", "-c", "reset"},
254 },
255 Expect: "Hello World from hello1",
256 },
257 },
258 },
259}
260
261type OneTest struct {
262 Commands [][]string
263 Expect string
264}