Skip to content

Commit ddf74c6

Browse files
authored
Add notes on implementation of tests (ARMmbed#101)
* Add notes on implementation of tests * add comment about active header location * Add component diagram and more detail on testapp flow
1 parent 5ec5d35 commit ddf74c6

File tree

1 file changed

+74
-1
lines changed

1 file changed

+74
-1
lines changed

docs/test-plan.md

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
11. Given corrupted active firmware, does not boot into firmware.
3737
12. Given corrupted active firmware, valid firmware candidate of older version, always perform update.
3838

39-
### Overall size (< 32K)
39+
### Overall size
4040

4141
13. Test that the compiled binary does not exeed 32K limit
4242

@@ -71,3 +71,76 @@
7171

7272
- SOTP
7373
- Insecure Example RoT
74+
75+
### Firmware Header Location options
76+
77+
- Contiguous with active application region
78+
- In a separate erase sector
79+
80+
### Design of Testing Infrastructure
81+
82+
Write mbed-bootloader-cliapp which abstracts ARM_UC_PAAL layer into python API. Using [mbed-clitest](https://github.com/ARMmbed/mbed-clitest) we will have the following capability:
83+
- inject firmware candidate onto the device regardless of the storage type
84+
- Specify the slot, version, hash of each candidate
85+
- Pass any firmware blob from the host side
86+
- Get current active firmware version and hash
87+
88+
In addition, the following custom functionality should also be implemented:
89+
- Reboot device
90+
91+
The mbed-bootloader-cliapp should track the dependencies and build options in mbed-cloud-client as close as possible.
92+
93+
This will cover the following testcases:
94+
- [Firmware update](#firmware-update)
95+
- [Rollback protection](#rollback-protection)
96+
- [Multiple candidates](#multiple-candidates)
97+
- [Integrity check of firmware candidates](#integrity-check-of-firmware-candidates)
98+
- [Integrity check of active firmware](#integrity-check-of-active-firmware)
99+
- [Successful update](#successful-update)
100+
- [Forward to Application](#forward-to-application)
101+
102+
Component Diagram
103+
```
104+
+------------------------+
105+
| host side: clitest |
106+
+------------------------+
107+
| serial link
108+
+----------+ +------------------------+
109+
|bootloader| | mbed-bootloader-cliapp |
110+
+----------+ +------------------------+
111+
+-------------------------------------+
112+
|Update Client PAAL API |
113+
+-------------------------------------+
114+
+-------------------------------------+
115+
|Physical Storage |
116+
+-------------------------------------+
117+
```
118+
119+
mbed-bootloader-cliapp Flow
120+
121+
1. Build mbed-bootloader
122+
1. Build mbed-bootloader-cliapp with the same RoT and PAAL options
123+
1. Combine bootloader with mbed-bootloader-cliapp with approperate headers
124+
1. Run Clitest on host side, it will detect mbed-bootloader-cliapp booting up successfully
125+
1. Run python clittest test case which sets up a number of firmware candidates
126+
1. python test case calls reboot, bootloader performs update
127+
1. host side keeps monitoring the serial output to confirm the bootloader is behaving as expected
128+
129+
For the following test cases, the flow need to be adapted:
130+
- [Rollback protection](#rollback-protection)
131+
- Inject firmware using a old time stamp in testapp
132+
- [Integrity check of firmware candidates](#integrity-check-of-firmware-candidates)
133+
- Inject firmware blob that is tampered and does not match with hash
134+
- [Integrity check of active firmware](#integrity-check-of-active-firmware)
135+
- Tamper with the combined binary before flashing to device
136+
137+
[Power Cut](#power-cut) can continue to be performed using the current mbedgt infrastructure.
138+
139+
[Overall size](#overall-size) Can be checked as a Jenkins step
140+
141+
[Integrity check of active firmware](#integrity-check-of-active-firmware) Need to tamper with combined firmware using custom script before flashing to device. Need custom script to monitor serial output to determine the bootloader have done the right thing. Or instrument the bootloader source code with mbedgt and make sure the bootloader goes into the right state.
142+
143+
Notes:
144+
- Bootloader binaries can be built as a first step in Jenkins for all possible configurations
145+
- Cli testapp can live in https://github.com/ARMmbed/mbed-bootloader-tests. Using the mbed-os TEST folder structure, multiple binaries can be built with one repo. Hence there should be at least the bootlaoder-cliapp and a dummy firmware candidate. The dummy firmware candidate may implement functions to get active hash.
146+
- Tests can be run in parallel on raas so as to not impact the testing time.

0 commit comments

Comments
 (0)