Skip to content

Commit bfe9e4f

Browse files
committed
Added update+powerfail test for DISABLE_BACKUP
1 parent 37d92fd commit bfe9e4f

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

.github/workflows/test-powerfail-simulator.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,31 @@ jobs:
416416
- name: Run update-revert test with power failures (AES128 DELTA)
417417
run: |
418418
tools/scripts/sim-update-powerfail-resume.sh
419+
420+
# TEST with backup disabled
421+
- name: make clean
422+
run: |
423+
make distclean
424+
- name: Select config with backup disabled
425+
run: |
426+
cp config/examples/sim-nobackup.config .config
427+
428+
- name: Build tools
429+
run: |
430+
make -C tools/keytools && make -C tools/bin-assemble
431+
432+
- name: Build wolfboot.elf
433+
run: |
434+
make clean && make test-sim-internal-flash-with-update
435+
436+
- name: Run sunny day update test (AES128 DELTA)
437+
run: |
438+
tools/scripts/sim-sunnyday-update.sh
439+
440+
- name: Rebuild wolfboot.elf
441+
run: |
442+
make clean && make test-sim-internal-flash-with-update
443+
444+
- name: Run update test with DISABLE_BACKUP and powefail
445+
run: |
446+
tools/scripts/sim-update-powerfail-resume-nobackup.sh
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ARCH=sim
2+
TARGET=sim
3+
SIGN?=ED25519
4+
HASH?=SHA256
5+
WOLFBOOT_SMALL_STACK?=1
6+
SPI_FLASH=0
7+
DEBUG=1
8+
SPMATH?=0
9+
DISABLE_BACKUP=1
10+
11+
# sizes should be multiple of system page size
12+
WOLFBOOT_PARTITION_SIZE=0x40000
13+
WOLFBOOT_SECTOR_SIZE=0x1000
14+
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80000
15+
# if on external flash, it should be multiple of system page size
16+
WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x100000
17+
WOLFBOOT_PARTITION_SWAP_ADDRESS=0x180000
18+
19+
# required for keytools
20+
WOLFBOOT_FIXED_PARTITIONS=1
21+
22+
# For debugging XMALLOC/XFREE
23+
#CFLAGS_EXTRA+=-DWOLFBOOT_DEBUG_MALLOC
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
V=`./wolfboot.elf update_trigger get_version 2>/dev/null`
3+
if [ "x$V" != "x1" ]; then
4+
echo "Failed first boot with update_trigger"
5+
exit 1
6+
fi
7+
8+
./wolfboot.elf powerfail 0 get_version 2>/dev/null
9+
./wolfboot.elf powerfail 15000 get_version 2>/dev/null
10+
./wolfboot.elf powerfail 18000 get_version 2>/dev/null
11+
./wolfboot.elf powerfail 1a000 get_version 2>/dev/null
12+
# fail on the last sector to stop the encrypt key save and state update
13+
./wolfboot.elf powerfail 3e000 get_version 2>/dev/null
14+
# may not trigger on non NVM_FLASH_WRITEONCE
15+
V=`./wolfboot.elf powerfail 3f000 get_version` 2>/dev/null
16+
if [ "x$V" != "x2" ]; then
17+
V=`./wolfboot.elf get_version 2>/dev/null`
18+
# if we failed on the final boot state write we need to double fallback
19+
if [ "x$V" == "x1" ]; then
20+
V=`./wolfboot.elf get_version 2>/dev/null`
21+
fi
22+
fi
23+
24+
if [ "x$V" != "x2" ]; then
25+
echo "Failed update (V: $V)"
26+
exit 1
27+
fi
28+
29+
echo Test successful.
30+
exit 0

0 commit comments

Comments
 (0)