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