- added svn props for newly added files
[openocd.git] / testing / testcases.html
1 <html>
2 <head>
3 <title>Test cases</title>
4 </head>
5
6 <body>
7 <H1>Test cases</H1>
8 <H2>Test case results</H2>
9 The test results are stored in seperate documents. One document for
10 each subversion number.
11 <table border="1">
12 <tr><td>Test results</td><td>comment</td></tr>
13 <tr><td><a href="examples/SAM7S256Test/results/607.html">607</a></td><td></td></tr>
14 <tr><td><a href="results/template.html">template</a></td><td>Test results template</td></tr>
15 </table>
16
17 <H2>Vocabulary</H2>
18 <table border="1">
19 <tr>
20 <td width="100">Passed version</td>
21
22 <td>The latest branch and version on which the test is known to pass</td>
23 </tr>
24 <tr>
25 <td width="100">Broken version</td>
26 <td>The latest branch and version on which the test is known to fail. n/a when older than passed version.</td>
27 </tr>
28 <tr>
29 <td width="100">ID</td>
30 <td>A unqiue ID to refer to a test. The unique numbers are maintained in this file. Note that the same test can be run on different hardware/interface. Each combination yields a unique id. </td>
31 </tr>
32 <tr>
33 <td width="100">Test case</td>
34 <td>An atomic entity that describes the operations needed to test a feature or only a part of it. The test case should:
35 <ul>
36 <li>be uniquely identifiable</li>
37 <li>define the complete prerequisites of the test (eg: the target, the interface, the initial state of the system)</li>
38 <li>define the input to be applied to the system in order to execute the test</li>
39 <li>define the expected output</li>
40 <li>contain the output resulted by running the test case</li>
41 <li>contain the result of the test (pass/fail)</li>
42 </ul>
43 </td>
44 </tr>
45 <tr>
46 <td width="100">Test suite</td>
47 <td>A (completable) collection of test cases</td>
48 </tr>
49 <tr>
50 <td width="100">Testing</td>
51 <td>Testing refers to running the test suite for a specific revision of the software,
52 for one or many targets, using one or many JTAG interfaces. Testing should be be stored
53 along with all the other records for that specific revision. For releases, the results
54 can be stored along with the binaries</td>
55 </tr>
56 <tr>
57 <td width="100">Target = ANY</td>
58 <td>Any target can be used for this test</td>
59 </tr>
60 <tr>
61 <td width="100">Interface = ANY</td>
62 <td>Any interface can be used for this test</td>
63 </tr>
64 <tr>
65 <td width="100">Target = "reset_config srst_and_trst"</td>
66 <td>Any target which supports the reset_config above</td>
67 </tr>
68 </table>
69
70 <H1>Test cases</H1>
71
72 <H2>Connectivity</H2>
73 <table border=1>
74 <tr>
75 <td>ID</td>
76 <td>Target</td>
77 <td>Interface</td>
78 <td>Description</td>
79 <td>Initial state</td>
80 <td>Input</td>
81 <td>Expected output</td>
82 <td>Pass/Fail</td>
83 </tr>
84 <tr>
85 <td><a name="CON001"/>CON001</td>
86 <td>ALL</td>
87 <td>ALL</td>
88 <td>Telnet connection</td>
89 <td>Power on, jtag target attached</td>
90 <td>On console, type<br><code>telnet ip port</code></td>
91 <td><code>Open On-Chip Debugger<br>></code></td>
92 <td>PASS/FAIL</td>
93 </tr>
94 <tr>
95 <td><a name="CON002"/>CON002</td>
96 <td>ALL</td>
97 <td>ALL</td>
98 <td>GDB server connection</td>
99 <td>Power on, jtag target attached</td>
100 <td>On GDB console, type<br><code>target remote ip:port</code></td>
101 <td><code>Remote debugging using 10.0.0.73:3333</code></td>
102 <td>PASS/FAIL</td>
103 </tr>
104 </table>
105
106 <H2>Reset</H2>
107 <table border=1>
108 <tr>
109 <td>ID</td>
110 <td>Target</td>
111 <td>Interface</td>
112 <td>Description</td>
113 <td>Initial state</td>
114 <td>Input</td>
115 <td>Expected output</td>
116 <td>Pass/Fail</td>
117 </tr>
118 <tr>
119 <td><a name="RES001"/>RES001</td>
120 <td>Fill in!</td>
121 <td>Fill in!</td>
122 <td>Reset halt on a blank target</td>
123 <td>Erase all the content of the flash</td>
124 <td>Connect via the telnet interface and type <br><code>reset halt</code></td>
125 <td>Reset should return without error and the output should contain<br><code>target state: halted<br>pc = 0</code></td>
126 <td>PASS/FAIL</td>
127 </tr>
128 <tr>
129 <td><a name="RES002"/>RES002</td>
130 <td>Fill in!</td>
131 <td>Fill in!</td>
132 <td>Reset init on a blank target</td>
133 <td>Erase all the content of the flash</td>
134 <td>Connect via the telnet interface and type <br><code>reset init</code></td>
135 <td>Reset should return without error and the output should contain <br><code>executing reset script 'name_of_the_script'</code></td>
136 <td>PASS/FAIL</td>
137 </tr>
138 <tr>
139 <td><a name="RES003"/>RES003</td>
140 <td>Fill in!</td>
141 <td>Fill in!</td>
142 <td>Reset after a power cycle of the target</td>
143 <td>Reset the target then power cycle the target</td>
144 <td>Connect via the telnet interface and type <br><code>reset halt</code> after the power was detected</td>
145 <td>Reset should return without error and the output should contain<br><code>target state: halted</code></td>
146 <td>PASS/FAIL</td>
147 </tr>
148 <tr>
149 <td><a name="RES004"/>RES004</td>
150 <td>ARM7/9,reset_config srst_and_trst</td>
151 <td>ANY</td>
152 <td>Reset halt on a blank target where reset halt is supported</td>
153 <td>Erase all the content of the flash</td>
154 <td>Connect via the telnet interface and type <br><code>reset halt</code></td>
155 <td>Reset should return without error and the output should contain<br><code>target state: halted<br>pc = 0</code></td>
156 <td>PASS/FAIL</td>
157 </tr>
158 <tr>
159 <td><a name="RES005"/>RES005</td>
160 <td>arm926ejs,reset_config srst_and_trst</td>
161 <td>ANY</td>
162 <td>Reset halt on a blank target where reset halt is supported. This target has problems with the reset vector catch being disabled by TRST</td>
163 <td>Erase all the content of the flash</td>
164 <td>Connect via the telnet interface and type <br><code>reset halt</code></td>
165 <td>Reset should return without error and the output should contain<br><code>target state: halted<br>pc = 0</code></td>
166 <td>PASS/FAIL</td>
167 </tr>
168 </table>
169
170 <H2>JTAG Speed</H2>
171 <table border=1>
172 <tr>
173 <td>ID</td>
174 <td>Target</td>
175 <td>Interface</td>
176 <td>Description</td>
177 <td>Initial state</td>
178 <td>Input</td>
179 <td>Expected output</td>
180 <td>Pass/Fail</td>
181 </tr>
182 <tr>
183 <td><a name="SPD001"/>RES001</td>
184 <td>Fill in!</td>
185 <td>Fill in!</td>
186 <td>16MHz on normal operation</td>
187 <td>Reset init the target according to RES002 </td>
188 <td>Exercise a memory access over the JTAG, for example <br><code>mdw 0x0 32</code></td>
189 <td>The command should run without any errors. If any JTAG checking errors happen, the test failed</td>
190 <td>PASS/FAIL</td>
191 </tr>
192 </table>
193
194 <H2>Debugging</H2>
195 <table border=1>
196 <tr>
197 <td>ID</td>
198 <td>Target</td>
199 <td>Interface</td>
200 <td>Description</td>
201 <td>Initial state</td>
202 <td>Input</td>
203 <td>Expected output</td>
204 <td>Pass/Fail</td>
205 </tr>
206 <tr>
207 <td><a name="DBG001"/>DBG001</td>
208 <td>Fill in!</td>
209 <td>Fill in!</td>
210 <td>Load is working</td>
211 <td>Reset init is working, RAM is accesible, GDB server is started</td>
212 <td>On the console of the OS: <br>
213 <code>arm-elf-gdb test_ram.elf</code><br>
214 <code>(gdb) target remote ip:port</code><br>
215 <code>(gdb) load</load>
216 </td>
217 <td>Load should return without error, typical output looks like:<br>
218 <code>
219 Loading section .text, size 0x14c lma 0x0<br>
220 Start address 0x40, load size 332<br>
221 Transfer rate: 180 bytes/sec, 332 bytes/write.<br>
222 </code>
223 </td>
224 <td>PASS/FAIL</td>
225 </tr>
226 <tr>
227 <td><a name="DBG002"/>DBG002</td>
228 <td>Fill in!</td>
229 <td>Fill in!</td>
230 <td>Software breakpoint</td>
231 <td>Load the test_ram.elf application, use instructions from GDB001</td>
232 <td>In the GDB console:<br>
233 <code>
234 (gdb) monitor arm7_9 sw_bkpts enable<br>
235 software breakpoints enabled<br>
236 (gdb) break main<br>
237 Breakpoint 1 at 0xec: file src/main.c, line 71.<br>
238 (gdb) continue<br>
239 Continuing.
240 </code>
241 </td>
242 <td>The software breakpoint should be reached, a typical output looks like:<br>
243 <code>
244 target state: halted<br>
245 target halted in ARM state due to breakpoint, current mode: Supervisor<br>
246 cpsr: 0x000000d3 pc: 0x000000ec<br>
247 <br>
248 Breakpoint 1, main () at src/main.c:71<br>
249 71 DWORD a = 1;
250 </code>
251 </td>
252 <td>PASS/FAIL</td>
253 </tr>
254 <tr>
255 <td><a name="DBG003"/>DBG003</td>
256 <td>Fill in!</td>
257 <td>Fill in!</td>
258 <td>Single step in a RAM application</td>
259 <td>Load the test_ram.elf application, use instructions from GDB001, break in main using the instructions from GDB002</td>
260 <td>In GDB, type <br><code>(gdb) step</code></td>
261 <td>The next instruction should be reached, typical output:<br>
262 <code>
263 (gdb) step<br>
264 target state: halted<br>
265 target halted in ARM state due to single step, current mode: Abort<br>
266 cpsr: 0x20000097 pc: 0x000000f0<br>
267 target state: halted<br>
268 target halted in ARM state due to single step, current mode: Abort<br>
269 cpsr: 0x20000097 pc: 0x000000f4<br>
270 72 DWORD b = 2;
271 </code>
272 </td>
273 <td>PASS/FAIL</td>
274 </tr>
275 <tr>
276 <td><a name="DBG004"/>DBG004</td>
277 <td>Fill in!</td>
278 <td>Fill in!</td>
279 <td>Software break points are working after a reset</td>
280 <td>Load the test_ram.elf application, use instructions from GDB001, break in main using the instructions from GDB002</td>
281 <td>In GDB, type <br><code>
282 (gdb) monitor reset<br>
283 (gdb) load<br>
284 (gdb) continue<br>
285 </code></td>
286 <td>The breakpoint should be reached, typical output:<br>
287 <code>
288 target state: halted<br>
289 target halted in ARM state due to breakpoint, current mode: Supervisor<br>
290 cpsr: 0x000000d3 pc: 0x000000ec<br>
291 <br>
292 Breakpoint 1, main () at src/main.c:71<br>
293 71 DWORD a = 1;
294 </code>
295 </td>
296 <td>PASS/FAIL</td>
297 </tr>
298 <tr>
299 <td><a name="DBG005"/>DBG005</td>
300 <td>Fill in!</td>
301 <td>Fill in!</td>
302 <td>Hardware breakpoint</td>
303 <td>Flash the test_rom.elf application. Make this test after FLA004 has passed</td>
304 <td>Be sure that <code>gdb_memory_map</code> and <code>gdb_flash_program</code> are enabled. In GDB, type <br>
305 <code>
306 (gdb) monitor reset<br>
307 (gdb) load<br>
308 Loading section .text, size 0x194 lma 0x100000<br>
309 Start address 0x100040, load size 404<br>
310 Transfer rate: 179 bytes/sec, 404 bytes/write.<br>
311 (gdb) monitor arm7_9 force_hw_bkpts enable<br>
312 force hardware breakpoints enabled<br>
313 (gdb) break main<br>
314 Breakpoint 1 at 0x100134: file src/main.c, line 69.<br>
315 (gdb) continue<br>
316 </code>
317 </td>
318 <td>The breakpoint should be reached, typical output:<br>
319 <code>
320 Continuing.<br>
321 <br>
322 Breakpoint 1, main () at src/main.c:69<br>
323 69 DWORD a = 1;<br>
324 </code>
325 </td>
326 <td>PASS/FAIL</td>
327 </tr>
328 <tr>
329 <td><a name="DBG006"/>DBG006</td>
330 <td>Fill in!</td>
331 <td>Fill in!</td>
332 <td>Hardware breakpoint is set after a reset</td>
333 <td>Follow the instructions to flash and insert a hardware breakpoint from DBG005</td>
334 <td>In GDB, type <br>
335 <code>
336 (gdb) monitor reset<br>
337 (gdb) monitor reg pc 0x100000<br>
338 pc (/32): 0x00100000<br>
339 (gdb) continue
340 </code>
341 </td>
342 <td>The breakpoint should be reached, typical output:<br>
343 <code>
344 Continuing.<br>
345 <br>
346 Breakpoint 1, main () at src/main.c:69<br>
347 69 DWORD a = 1;<br>
348 </code>
349 </td>
350 <td>PASS/FAIL</td>
351 </tr>
352 <tr>
353 <td><a name="DBG007"/>DBG007</td>
354 <td>Fill in!</td>
355 <td>Fill in!</td>
356 <td>Single step in ROM</td>
357 <td>Flash the test_rom.elf application and set a breakpoint in main, use DBG005. Make this test after FLA004 has passed</td>
358 <td>Be sure that <code>gdb_memory_map</code> and <code>gdb_flash_program</code> are enabled. In GDB, type <br>
359 <code>
360 (gdb) monitor reset<br>
361 (gdb) load<br>
362 Loading section .text, size 0x194 lma 0x100000<br>
363 Start address 0x100040, load size 404<br>
364 Transfer rate: 179 bytes/sec, 404 bytes/write.<br>
365 (gdb) monitor arm7_9 force_hw_bkpts enable<br>
366 force hardware breakpoints enabled<br>
367 (gdb) break main<br>
368 Breakpoint 1 at 0x100134: file src/main.c, line 69.<br>
369 (gdb) continue<br>
370 Continuing.<br>
371 <br>
372 Breakpoint 1, main () at src/main.c:69<br>
373 69 DWORD a = 1;<br>
374 (gdb) step
375 </code>
376 </td>
377 <td>The breakpoint should be reached, typical output:<br>
378 <code>
379 target state: halted<br>
380 target halted in ARM state due to single step, current mode: Supervisor<br>
381 cpsr: 0x60000013 pc: 0x0010013c<br>
382 70 DWORD b = 2;<br>
383 </code>
384 </td>
385 <td>PASS/FAIL</td>
386 </tr>
387 </table>
388
389 <H2>RAM access</H2>
390 Note: these tests are not designed to test/debug the target, but to test functionalities!
391 <table border=1>
392 <tr>
393 <td>ID</td>
394 <td>Target</td>
395 <td>Interface</td>
396 <td>Description</td>
397 <td>Initial state</td>
398 <td>Input</td>
399 <td>Expected output</td>
400 <td>Pass/Fail</td>
401 </tr>
402 <tr>
403 <td><a name="RAM001"/>RAM001</td>
404 <td>Fill in!</td>
405 <td>Fill in!</td>
406 <td>32 bit Write/read RAM</td>
407 <td>Reset init is working</td>
408 <td>On the telnet interface<br>
409 <code> > mww ram_address 0xdeadbeef 16<br>
410 > mdw ram_address 32
411 </code>
412 </td>
413 <td>The commands should execute without error. A clear failure is a memory access exception. The result of running the commands should be a list of 16 locations 32bit long containing 0xdeadbeef.<br>
414 <code>
415 > mww 0x0 0xdeadbeef 16<br>
416 > mdw 0x0 32<br>
417 0x00000000: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef<br>
418 0x00000020: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef<br>
419 0x00000040: e1a00000 e59fa51c e59f051c e04aa000 00080017 00009388 00009388 00009388<br>
420 0x00000060: 00009388 0002c2c0 0002c2c0 000094f8 000094f4 00009388 00009388 00009388<br>
421 </code>
422 </td>
423 <td>PASS/FAIL</td>
424 </tr>
425 <tr>
426 <td><a name="RAM001"/>RAM001</td>
427 <td>Fill in!</td>
428 <td>Fill in!</td>
429 <td>16 bit Write/read RAM</td>
430 <td>Reset init is working</td>
431 <td>On the telnet interface<br>
432 <code> > mwh ram_address 0xbeef 16<br>
433 > mdh ram_address 32
434 </code>
435 </td>
436 <td>The commands should execute without error. A clear failure is a memory access exception. The result of running the commands should be a list of 16 locations 16bit long containing 0xbeef.<br>
437 <code>
438 > mwh 0x0 0xbeef 16<br>
439 > mdh 0x0 32<br>
440 0x00000000: beef beef beef beef beef beef beef beef beef beef beef beef beef beef beef beef<br>
441 0x00000020: 00e0 0000 021c 0000 0240 0000 026c 0000 0288 0000 0000 0000 0388 0000 0350 0000<br>
442 >
443 </code>
444 </td>
445 <td>PASS/FAIL</td>
446 </tr>
447 <tr>
448 <td><a name="RAM003"/>RAM003</td>
449 <td>Fill in!</td>
450 <td>Fill in!</td>
451 <td>8 bit Write/read RAM</td>
452 <td>Reset init is working</td>
453 <td>On the telnet interface<br>
454 <code> > mwb ram_address 0xab 16<br>
455 > mdb ram_address 32
456 </code>
457 </td>
458 <td>The commands should execute without error. A clear failure is a memory access exception. The result of running the commands should be a list of 16 locations 8bit long containing 0xab.<br>
459 <code>
460 > mwh 0x0 0x0 16<br>
461 > mwb ram_address 0xab 16<br>
462 > mdb ram_address 32<br>
463 0x00000000: ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<br>
464 >
465 </code>
466 </td>
467 <td>PASS/FAIL</td>
468 </tr>
469 </table>
470
471
472
473 <H2>Flash access</H2>
474 <table border=1>
475 <tr>
476 <td>ID</td>
477 <td>Target</td>
478 <td>Interface</td>
479 <td>Description</td>
480 <td>Initial state</td>
481 <td>Input</td>
482 <td>Expected output</td>
483 <td>Pass/Fail</td>
484 </tr>
485 <tr>
486 <td><a name="FLA001"/>FLA001</td>
487 <td>Fill in!</td>
488 <td>Fill in!</td>
489 <td>Flash probe</td>
490 <td>Reset init is working</td>
491 <td>On the telnet interface:<br>
492 <code> > flash probe 0</code>
493 </td>
494 <td>The command should execute without error. The output should state the name of the flash and the starting address. An example of output:<br>
495 <code>flash 'ecosflash' found at 0x01000000</code>
496 </td>
497 <td>PASS/FAIL</td>
498 </tr>
499 <tr>
500 <td><a name="FLA002"/>FLA002</td>
501 <td>Fill in!</td>
502 <td>Fill in!</td>
503 <td>flash fillw</td>
504 <td>Reset init is working, flash is probed</td>
505 <td>On the telnet interface<br>
506 <code> > flash fillw 0x1000000 0xdeadbeef 16
507 </code>
508 </td>
509 <td>The commands should execute without error. The output looks like:<br>
510 <code>
511 wrote 64 bytes to 0x01000000 in 11.610000s (0.091516 kb/s)
512 </code><br>
513 To verify the contents of the flash:<br>
514 <code>
515 > mdw 0x1000000 32<br>
516 0x01000000: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef<br>
517 0x01000020: deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef deadbeef<br>
518 0x01000040: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff<br>
519 0x01000060: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
520 </code>
521 </td>
522 <td>PASS/FAIL</td>
523 </tr>
524 <tr>
525 <td><a name="FLA003"/>FLA003</td>
526 <td>Fill in!</td>
527 <td>Fill in!</td>
528 <td>Flash erase</td>
529 <td>Reset init is working, flash is probed</td>
530 <td>On the telnet interface<br>
531 <code> > flash erase_address 0x1000000 0x2000
532 </code>
533 </td>
534 <td>The commands should execute without error.<br>
535 <code>
536 erased address 0x01000000 length 8192 in 4.970000s
537 </code>
538 To check that the flash has been erased, read at different addresses. The result should always be 0xff.
539 <code>
540 > mdw 0x1000000 32<br>
541 0x01000000: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff<br>
542 0x01000020: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff<br>
543 0x01000040: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff<br>
544 0x01000060: ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
545 </code>
546 </td>
547 <td>PASS/FAIL</td>
548 </tr>
549 <tr>
550 <td><a name="FLA004"/>FLA004</td>
551 <td>Fill in!</td>
552 <td>Fill in!</td>
553 <td>Loading to flash from GDB</td>
554 <td>Reset init is working, flash is probed, connectivity to GDB server is working</td>
555 <td>Start GDB using a ROM elf image, eg: arm-elf-gdb test_rom.elf. <br>
556 <code>
557 (gdb) target remote ip:port<br>
558 (gdb) monitor reset<br>
559 (gdb) load<br>
560 Loading section .text, size 0x194 lma 0x100000<br>
561 Start address 0x100040, load size 404<br>
562 Transfer rate: 179 bytes/sec, 404 bytes/write.
563 (gdb) monitor verify_image path_to_elf_file
564 </code>
565 </td>
566 <td>The output should look like:<br>
567 <code>
568 verified 404 bytes in 5.060000s
569 </code><br>
570 The failure message is something like:<br>
571 <code>Verify operation failed address 0x00200000. Was 0x00 instead of 0x18</code>
572 </td>
573 <td>PASS/FAIL</td>
574 </tr>
575 </table>
576
577 </body>
578 </html>