1# Zephyr test plan
2
3The following roughly describes how MCUboot is tested on Zephyr.  The
4testing is done with the code in `samples/zephyr`.  These examples
5were written using the FRDM-K64F, but other boards should be similar.
6At this time, however, the partitions are hardcoded in the Makefile
7targets to flash.
8
9Note that the script "run-tests.sh" in that directory is helpful for
10automating the process, and provides simple "y or n" prompts for each
11test case and expected result.
12
13## Building and running.
14
15The tests are build using the various `test-*` targets in
16`samples/zephyr/Makefile`.  For each test, invoke `make` with that
17target:
18
19    $ make test-good-rsa
20
21Begin by doing a full erase, and programming the bootloader itself:
22
23    $ pyocd erase --chip
24    $ make flash_boot
25
26After it resets, look for "main: Starting bootloader", a few debug
27messages, and lastly: "main: Unable to find bootable image".
28
29Then, load hello1:
30
31    $ make flash_hello1
32
33This should print "main: Jumping to the first image slot", and you
34should get an image "hello1".
35
36Note that there are comments with each test target describing the
37intended behavior for each of these steps.  Sometimes an upgrade will
38happen and sometimes it will not.
39
40    $ make flash_hello2
41
42This should print a message: `boot_swap_type: Swap type: test`, and
43you should see "hello2".
44
45Now reset the target::
46
47    $ pyocd commander -c reset
48
49And you should see a revert and "hello1" running.
50
51## Testing that mark ok works
52
53Repeat this, to make sure we can mark the image as OK, and that a
54revert doesn't happen:
55
56    $ make flash_hello1
57    $ make flash_hello2
58
59We should have just booted the hello2.  Mark this as OK:
60
61    $ pyocd flash -a 0x7ffe8 image_ok.bin
62    $ pyocd commander -c reset
63
64And make sure this stays in the "hello2" image.
65
66This step doesn't make sense on the tests where the upgrade doesn't
67happen.
68
69## Testing all configurations
70
71Repeat these steps for each of the `test-*` targest in the Makefile.
72