blob: 94855955d2fd510f34dbdc4e02d72cc6625ab397 [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 {
7 Name string
8 Tests []OneTest
9}{
10 {
11 Name: "Good RSA",
12 Tests: []OneTest{
13 {
14 Commands: [][]string{
15 {"make", "test-good-rsa"},
16 {"make", "flash_boot"},
17 },
18 Expect: "Unable to find bootable image",
19 },
20 {
21 Commands: [][]string{
22 {"make", "flash_hello1"},
23 },
24 Expect: "Hello World from hello1",
25 },
26 {
27 Commands: [][]string{
28 {"make", "flash_hello2"},
29 },
30 Expect: "Hello World from hello2",
31 },
32 {
33 Commands: [][]string{
34 {"pyocd", "commander", "-c", "reset"},
35 },
36 Expect: "Hello World from hello1",
37 },
38 },
39 },
40 {
41 Name: "Good ECDSA",
42 Tests: []OneTest{
43 {
44 Commands: [][]string{
45 {"make", "test-good-ecdsa"},
46 {"make", "flash_boot"},
47 },
48 Expect: "Unable to find bootable image",
49 },
50 {
51 Commands: [][]string{
52 {"make", "flash_hello1"},
53 },
54 Expect: "Hello World from hello1",
55 },
56 {
57 Commands: [][]string{
58 {"make", "flash_hello2"},
59 },
60 Expect: "Hello World from hello2",
61 },
62 {
63 Commands: [][]string{
64 {"pyocd", "commander", "-c", "reset"},
65 },
66 Expect: "Hello World from hello1",
67 },
68 },
69 },
70 {
71 Name: "Overwrite",
72 Tests: []OneTest{
73 {
74 Commands: [][]string{
75 {"make", "test-overwrite"},
76 {"make", "flash_boot"},
77 },
78 Expect: "Unable to find bootable image",
79 },
80 {
81 Commands: [][]string{
82 {"make", "flash_hello1"},
83 },
84 Expect: "Hello World from hello1",
85 },
86 {
87 Commands: [][]string{
88 {"make", "flash_hello2"},
89 },
90 Expect: "Hello World from hello2",
91 },
92 {
93 Commands: [][]string{
94 {"pyocd", "commander", "-c", "reset"},
95 },
96 Expect: "Hello World from hello2",
97 },
98 },
99 },
100 {
101 Name: "Bad RSA",
102 Tests: []OneTest{
103 {
104 Commands: [][]string{
105 {"make", "test-bad-rsa-upgrade"},
106 {"make", "flash_boot"},
107 },
108 Expect: "Unable to find bootable image",
109 },
110 {
111 Commands: [][]string{
112 {"make", "flash_hello1"},
113 },
114 Expect: "Hello World from hello1",
115 },
116 {
117 Commands: [][]string{
118 {"make", "flash_hello2"},
119 },
120 Expect: "Hello World from hello1",
121 },
122 {
123 Commands: [][]string{
124 {"pyocd", "commander", "-c", "reset"},
125 },
126 Expect: "Hello World from hello1",
127 },
128 },
129 },
130 {
131 Name: "Bad RSA",
132 Tests: []OneTest{
133 {
134 Commands: [][]string{
135 {"make", "test-bad-ecdsa-upgrade"},
136 {"make", "flash_boot"},
137 },
138 Expect: "Unable to find bootable image",
139 },
140 {
141 Commands: [][]string{
142 {"make", "flash_hello1"},
143 },
144 Expect: "Hello World from hello1",
145 },
146 {
147 Commands: [][]string{
148 {"make", "flash_hello2"},
149 },
150 Expect: "Hello World from hello1",
151 },
152 {
153 Commands: [][]string{
154 {"pyocd", "commander", "-c", "reset"},
155 },
156 Expect: "Hello World from hello1",
157 },
158 },
159 },
160 {
161 Name: "No bootcheck",
162 Tests: []OneTest{
163 {
164 Commands: [][]string{
165 {"make", "test-no-bootcheck"},
166 {"make", "flash_boot"},
167 },
168 Expect: "Unable to find bootable image",
169 },
170 {
171 Commands: [][]string{
172 {"make", "flash_hello1"},
173 },
174 Expect: "Hello World from hello1",
175 },
176 {
177 Commands: [][]string{
178 {"make", "flash_hello2"},
179 },
180 Expect: "Hello World from hello1",
181 },
182 {
183 Commands: [][]string{
184 {"pyocd", "commander", "-c", "reset"},
185 },
186 Expect: "Hello World from hello1",
187 },
188 },
189 },
190 {
191 Name: "Wrong RSA",
192 Tests: []OneTest{
193 {
194 Commands: [][]string{
195 {"make", "test-wrong-rsa"},
196 {"make", "flash_boot"},
197 },
198 Expect: "Unable to find bootable image",
199 },
200 {
201 Commands: [][]string{
202 {"make", "flash_hello1"},
203 },
204 Expect: "Hello World from hello1",
205 },
206 {
207 Commands: [][]string{
208 {"make", "flash_hello2"},
209 },
210 Expect: "Hello World from hello1",
211 },
212 {
213 Commands: [][]string{
214 {"pyocd", "commander", "-c", "reset"},
215 },
216 Expect: "Hello World from hello1",
217 },
218 },
219 },
220 {
221 Name: "Wrong ECDSA",
222 Tests: []OneTest{
223 {
224 Commands: [][]string{
225 {"make", "test-wrong-ecdsa"},
226 {"make", "flash_boot"},
227 },
228 Expect: "Unable to find bootable image",
229 },
230 {
231 Commands: [][]string{
232 {"make", "flash_hello1"},
233 },
234 Expect: "Hello World from hello1",
235 },
236 {
237 Commands: [][]string{
238 {"make", "flash_hello2"},
239 },
240 Expect: "Hello World from hello1",
241 },
242 {
243 Commands: [][]string{
244 {"pyocd", "commander", "-c", "reset"},
245 },
246 Expect: "Hello World from hello1",
247 },
248 },
249 },
250}
251
252type OneTest struct {
253 Commands [][]string
254 Expect string
255}