Skip to content

Commit 7ec89be

Browse files
tomchyrlubos
authored andcommitted
tests: Add clang-format switches
Add clang-format switches in SUIT storage tests. Ref: NCSDK-29626 Signed-off-by: Tomasz Chyrowicz <[email protected]>
1 parent 1e65489 commit 7ec89be

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

tests/subsys/suit/storage_nrf54h20/src/test_common.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <suit_storage_mpi.h>
99
#include "test_common.h"
1010

11+
/* clang-format off */
1112
/* RFC4122 uuid5(uuid.NAMESPACE_DNS, 'nordicsemi.com') */
1213
static uint8_t nordic_vid[] = {
1314
0x76, 0x17, 0xda, 0xa5, 0x71, 0xfd, 0x5a, 0x85,
@@ -69,6 +70,7 @@ uint8_t nvv_sample[64] = {
6970
0x6a, 0x65, 0xbe, 0x14, 0xcb, 0x2e, 0x83, 0x6a,
7071
0x3b, 0xc9, 0xfd, 0x87, 0xf6, 0xde, 0x79, 0x05,
7172
};
73+
/* clang-format on */
7274

7375
void erase_area_nordic(void)
7476
{
@@ -166,13 +168,15 @@ void write_area_app_nvv(void)
166168

167169
void write_empty_area_app(void)
168170
{
171+
/* clang-format off */
169172
/* Digest of the content defined in assert_empty_mpi_area_app(). */
170173
uint8_t app_digest[] = {
171174
0xd6, 0xc4, 0x94, 0x17, 0xb1, 0xca, 0x0a, 0x67,
172175
0x14, 0xdc, 0xde, 0x2b, 0x40, 0x01, 0x0c, 0xb7,
173176
0x49, 0x6d, 0x05, 0xdf, 0x7f, 0x8c, 0x8b, 0x1b,
174177
0x98, 0x14, 0x09, 0x7e, 0x9d, 0x62, 0xc8, 0xe1,
175178
};
179+
/* clang-format on */
176180

177181
/* Write the digest of application area filled with 0xFF */
178182
const struct device *fdev = SUIT_PLAT_INTERNAL_NVM_DEV;
@@ -187,13 +191,15 @@ void write_empty_area_app(void)
187191

188192
void write_empty_area_rad(void)
189193
{
194+
/* clang-format off */
190195
/* Digest of the content defined in assert_empty_mpi_area_rad(). */
191196
uint8_t rad_digest[] = {
192197
0xd1, 0x69, 0xf6, 0x75, 0x42, 0x29, 0xc2, 0x00,
193198
0xba, 0x48, 0x38, 0xa3, 0x8e, 0x48, 0x94, 0xc0,
194199
0x3c, 0x47, 0xce, 0x89, 0x39, 0xdb, 0x4b, 0x7a,
195200
0x11, 0xc2, 0x24, 0x92, 0x1b, 0x98, 0x25, 0x21,
196201
};
202+
/* clang-format on */
197203

198204
/* Write the digest of radio area filled with 0xFF */
199205
const struct device *fdev = SUIT_PLAT_INTERNAL_NVM_DEV;
@@ -208,6 +214,7 @@ void write_empty_area_rad(void)
208214

209215
void write_area_app_root(void)
210216
{
217+
/* clang-format off */
211218
uint8_t mpi_root[] = {
212219
0x01, /* version */
213220
0x01, /* downgrade prevention disabled */
@@ -230,6 +237,7 @@ void write_area_app_root(void)
230237
0x2b, 0x17, 0x45, 0x90, 0x16, 0xe1, 0xc7, 0xf5,
231238
0xc1, 0xdc, 0x3f, 0xb4, 0x58, 0x96, 0x1e, 0x44,
232239
};
240+
/* clang-format on */
233241

234242
/* Write the sample application area (just the root MPI) and corresponding digest */
235243
const struct device *fdev = SUIT_PLAT_INTERNAL_NVM_DEV;
@@ -248,6 +256,7 @@ void write_area_app_root(void)
248256

249257
void write_area_rad(void)
250258
{
259+
/* clang-format off */
251260
uint8_t mpi_rad[] = {
252261
0x01, /* version */
253262
0x01, /* downgrade prevention disabled */
@@ -270,6 +279,7 @@ void write_area_rad(void)
270279
0x17, 0x42, 0x32, 0xf7, 0x03, 0x9f, 0xf8, 0xa4,
271280
0x8d, 0x52, 0xc6, 0x8d, 0xea, 0xdc, 0x33, 0x3b,
272281
};
282+
/* clang-format on */
273283

274284
/* Write the sample radio area (just one MPI entry) and corresponding digest */
275285
const struct device *fdev = SUIT_PLAT_INTERNAL_NVM_DEV;
@@ -289,6 +299,7 @@ void write_area_nordic_root(void)
289299
{
290300
uintptr_t mpi_root_backup_offset =
291301
SUIT_STORAGE_NORDIC_OFFSET + SUIT_STORAGE_RAD_MPI_SIZE + SUIT_STORAGE_DIGEST_SIZE;
302+
/* clang-format off */
292303
uint8_t mpi_root[] = {
293304
0x01, /* version */
294305
0x01, /* downgrade prevention disabled */
@@ -311,6 +322,7 @@ void write_area_nordic_root(void)
311322
0x2b, 0x17, 0x45, 0x90, 0x16, 0xe1, 0xc7, 0xf5,
312323
0xc1, 0xdc, 0x3f, 0xb4, 0x58, 0x96, 0x1e, 0x44,
313324
};
325+
/* clang-format on */
314326

315327
/* Write the sample application backup area (just the root MPI) and corresponding digest */
316328
const struct device *fdev = SUIT_PLAT_INTERNAL_NVM_DEV;
@@ -331,6 +343,7 @@ void write_area_nordic_root(void)
331343
void write_area_nordic_rad(void)
332344
{
333345
uintptr_t mpi_rad_backup_offset = SUIT_STORAGE_NORDIC_OFFSET;
346+
/* clang-format off */
334347
uint8_t mpi_rad[] = {
335348
0x01, /* version */
336349
0x01, /* downgrade prevention disabled */
@@ -353,6 +366,7 @@ void write_area_nordic_rad(void)
353366
0x17, 0x42, 0x32, 0xf7, 0x03, 0x9f, 0xf8, 0xa4,
354367
0x8d, 0x52, 0xc6, 0x8d, 0xea, 0xdc, 0x33, 0x3b,
355368
};
369+
/* clang-format on */
356370

357371
/* Write the sample radio backup area (just one MPI entry) and corresponding digest */
358372
const struct device *fdev = SUIT_PLAT_INTERNAL_NVM_DEV;
@@ -373,6 +387,7 @@ void write_area_nordic_old_root(void)
373387
{
374388
uintptr_t mpi_root_backup_offset =
375389
SUIT_STORAGE_NORDIC_OFFSET + SUIT_STORAGE_RAD_MPI_SIZE + SUIT_STORAGE_DIGEST_SIZE;
390+
/* clang-format off */
376391
uint8_t mpi_root[] = {
377392
0x01, /* version */
378393
0x01, /* downgrade prevention disabled */
@@ -394,6 +409,7 @@ void write_area_nordic_old_root(void)
394409
0x96, 0x28, 0xc2, 0x0c, 0x69, 0xe5, 0xf5, 0x23,
395410
0x0c, 0x92, 0xd6, 0x2d, 0x36, 0x69, 0x27, 0x58,
396411
};
412+
/* clang-format on */
397413

398414
/* Write the sample application backup area (just the root MPI with altered class) and
399415
* corresponding digest
@@ -416,6 +432,7 @@ void write_area_nordic_old_root(void)
416432
void write_area_nordic_old_rad(void)
417433
{
418434
uintptr_t mpi_rad_backup_offset = SUIT_STORAGE_NORDIC_OFFSET;
435+
/* clang-format off */
419436
uint8_t mpi_rad[] = {
420437
0x01, /* version */
421438
0x01, /* downgrade prevention disabled */
@@ -437,6 +454,7 @@ void write_area_nordic_old_rad(void)
437454
0x6f, 0x1f, 0x82, 0x16, 0x28, 0xae, 0x68, 0x71,
438455
0xc3, 0xc1, 0x8e, 0x5b, 0xb9, 0xf0, 0x2f, 0xdd,
439456
};
457+
/* clang-format on */
440458

441459
/* Write the sample radio backup area (just the sample MPI with altered class) and
442460
* corresponding digest
@@ -520,7 +538,7 @@ void assert_sample_root_rad_class(void)
520538
zassert_equal(class_infos_len, 5,
521539
"Invalid number of supported manifest classes (%d != %d).", class_infos_len,
522540
5);
523-
/* ... and the sample application root manifest class is supported */
541+
/* ... and the sample radio recovery manifest class is supported */
524542
zassert_mem_equal(class_infos[3].vendor_id, nordic_vid, sizeof(nordic_vid));
525543
zassert_mem_equal(class_infos[3].class_id, rad_cid, sizeof(rad_cid));
526544
zassert_equal(class_infos[3].role, SUIT_MANIFEST_RAD_RECOVERY,
@@ -534,6 +552,7 @@ void assert_sample_root_rad_class(void)
534552

535553
void assert_empty_mpi_area_app(uint8_t *addr, size_t size)
536554
{
555+
/* clang-format off */
537556
uint8_t empty_mpi_app[] = {
538557
/* 0xFF * 240 */
539558
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -572,6 +591,7 @@ void assert_empty_mpi_area_app(uint8_t *addr, size_t size)
572591
0x49, 0x6d, 0x05, 0xdf, 0x7f, 0x8c, 0x8b, 0x1b,
573592
0x98, 0x14, 0x09, 0x7e, 0x9d, 0x62, 0xc8, 0xe1,
574593
};
594+
/* clang-format on */
575595

576596
zassert_equal(size, sizeof(empty_mpi_app), "Incorrect application area size (0x%x != 0x%x)",
577597
size, sizeof(empty_mpi_app));
@@ -582,6 +602,7 @@ void assert_empty_mpi_area_app(uint8_t *addr, size_t size)
582602

583603
void assert_valid_mpi_area_app(uint8_t *addr, size_t size)
584604
{
605+
/* clang-format off */
585606
uint8_t valid_mpi_app[] = {
586607
0x01, /* version */
587608
0x01, /* downgrade prevention disabled */
@@ -627,6 +648,7 @@ void assert_valid_mpi_area_app(uint8_t *addr, size_t size)
627648
0x2b, 0x17, 0x45, 0x90, 0x16, 0xe1, 0xc7, 0xf5,
628649
0xc1, 0xdc, 0x3f, 0xb4, 0x58, 0x96, 0x1e, 0x44,
629650
};
651+
/* clang-format on */
630652

631653
zassert_equal(size, sizeof(valid_mpi_app), "Incorrect application area size (0x%x != 0x%x)",
632654
size, sizeof(valid_mpi_app));
@@ -637,6 +659,7 @@ void assert_valid_mpi_area_app(uint8_t *addr, size_t size)
637659

638660
void assert_empty_mpi_area_rad(uint8_t *addr, size_t size)
639661
{
662+
/* clang-format off */
640663
uint8_t empty_mpi_rad[] = {
641664
/* 0xFF * 144 */
642665
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -663,6 +686,7 @@ void assert_empty_mpi_area_rad(uint8_t *addr, size_t size)
663686
0x3c, 0x47, 0xce, 0x89, 0x39, 0xdb, 0x4b, 0x7a,
664687
0x11, 0xc2, 0x24, 0x92, 0x1b, 0x98, 0x25, 0x21,
665688
};
689+
/* clang-format on */
666690

667691
zassert_equal(size, sizeof(empty_mpi_rad), "Incorrect radio area size (0x%x != 0x%x)", size,
668692
sizeof(empty_mpi_rad));
@@ -673,6 +697,7 @@ void assert_empty_mpi_area_rad(uint8_t *addr, size_t size)
673697

674698
void assert_valid_mpi_area_rad(uint8_t *addr, size_t size)
675699
{
700+
/* clang-format off */
676701
uint8_t valid_mpi_rad[] = {
677702
0x01, /* version */
678703
0x01, /* downgrade prevention disabled */
@@ -706,6 +731,7 @@ void assert_valid_mpi_area_rad(uint8_t *addr, size_t size)
706731
0x17, 0x42, 0x32, 0xf7, 0x03, 0x9f, 0xf8, 0xa4,
707732
0x8d, 0x52, 0xc6, 0x8d, 0xea, 0xdc, 0x33, 0x3b,
708733
};
734+
/* clang-format on */
709735

710736
zassert_equal(size, sizeof(valid_mpi_rad), "Incorrect radio area size (0x%x != 0x%x)", size,
711737
sizeof(valid_mpi_rad));

0 commit comments

Comments
 (0)