wolfBoot/tools/unit-tests
Daniele Lacamera 2f53d0d1d9 F-3966: fix hal_flash_erase loop bound in stm32wb.c skipping final partial page
end_address = address + len - 1 (inclusive) combined with p < end_address
(strict less-than) skipped the last page when len % FLASH_PAGE_SIZE == 1.
Use the exclusive form end_address = address + len, mirroring the stm32h5
fix.  Add WOLFBOOT_UNIT_TEST_FLASH_ERASE guards and a new unit test that
proves the regression before the fix and passes after.
2026-06-11 18:02:03 +02:00
..
Makefile F-3966: fix hal_flash_erase loop bound in stm32wb.c skipping final partial page 2026-06-11 18:02:03 +02:00
README.md
…
gpt-sfdisk-test.h
…
target.h
…
txt_filler.h
…
unit-boot-x86_fsp.c
…
unit-common.c
…
unit-delta.c
…
unit-disk.c F-4258: reject GPT partitions whose LBA extent overflows uint64_t 2026-06-10 21:01:16 +02:00
unit-elf-bss-guard.c F-4418: fix BSS-clear collision guard to use mem_size instead of file_size 2026-06-10 21:01:17 +02:00
unit-enc-nvm.c
…
unit-extflash.c
…
unit-fdt.c F-5747: guard fdt_data_size_ and fdt_splice_string_ against off_dt_strings+size_dt_strings uint32_t overflow 2026-06-10 21:01:16 +02:00
unit-fit-fpga.c Add wolfBoot FIT support for loading bitstream 2026-06-09 15:30:27 +02:00
unit-fit-gzip.c
…
unit-flash-erase-h7.c F-5745: fix off-by-one in hal_flash_erase skipping last page when len%PAGE_SIZE!=0 2026-06-10 21:01:16 +02:00
unit-flash-erase-wb.c F-3966: fix hal_flash_erase loop bound in stm32wb.c skipping final partial page 2026-06-11 18:02:03 +02:00
unit-fwtpm-nv-oob.c F-5092: fix off-by-one in fwtpm_nv_read/write/erase offset guard 2026-06-10 21:01:16 +02:00
unit-fwtpm-stub.c
…
unit-gzip.c
…
unit-image.c F-5351: test wolfBoot_open_self_address rejects bad magic with hdr_ok cleared 2026-06-10 21:01:16 +02:00
unit-keygen-xmss-params.c
…
unit-keystore.c
…
unit-linux-loader-e820.c
…
unit-linux-loader-syssize.c
…
unit-loader-tpm-init.c
…
unit-max-space.c
…
unit-mock-flash.c
…
unit-mock-state.c
…
unit-mpusize.c F-5132: complete mpusize() table so MPU stays enabled for >64KB wolfBoot 2026-06-09 15:52:07 +02:00
unit-multiboot.c F-4651: bound multiboot2 header_length to prevent OOB tag walk 2026-06-10 21:01:16 +02:00
unit-nvm.c
…
unit-otp-keystore.c F-4790: clamp OTP pubkey_size in keystore_get_size to prevent OOB read 2026-06-09 15:52:07 +02:00
unit-parser.c
…
unit-pci.c F-4717: reject PCI BARs whose region overruns the pool to prevent cursor wrap 2026-06-10 21:01:16 +02:00
unit-pkcs11_store.c F-4649: erase pkcs11_store object sectors on write-mode open to clear residual key material 2026-06-10 21:01:16 +02:00
unit-policy-create.c
…
unit-policy-sign.c
…
unit-psa_store.c F-4784: erase psa_store object data on write-mode open to clear residual key material 2026-06-10 21:01:16 +02:00
unit-qspi-flash.c
…
unit-rot-auth.c F-4973: clamp TPM-supplied nvPublic.dataSize before NV read-back in rot.c 2026-06-09 15:52:07 +02:00
unit-sdhci-disk-unaligned.c F-4716: reject SDHCI block addresses that overflow 32-bit SD command argument 2026-06-10 21:01:16 +02:00
unit-sdhci-response-bits.c
…
unit-sectorflags.c
…
unit-sign-custom-tlv-le.py F-3970: serialise custom TLV integer values through header_store_u64_le 2026-06-11 17:53:25 +02:00
unit-sign-delta-cert-inv-off.py Address Copilot review comments 2026-06-09 15:52:07 +02:00
unit-sign-delta-tlv.py F-5352: emit 4-byte delta size TLVs from Python signer 2026-06-09 15:50:48 +02:00
unit-sign-encrypted-output.c
…
unit-sign-encrypted-output.mkfrag
…
unit-spi-flash.c
…
unit-store-sbrk.c
…
unit-string.c
…
unit-tpm-api-names.c
…
unit-tpm-blob.c
…
unit-tpm-check-rot-auth.c
…
unit-tpm-rsa-exp.c
…
unit-uart-flash.c
…
unit-update-disk.c Add explicit integrity/authenticity failure tests in update-disk suite 2026-06-09 15:50:14 +02:00
unit-update-flash-hwswap.c F-4411: fix uint32_t->int cast bypassing anti-rollback in hwswap wolfBoot_start 2026-06-11 17:05:27 +02:00
unit-update-flash.c F-4412: add equal-version emergency rollback test to pin >= operator 2026-06-10 21:01:17 +02:00
unit-update-ram-nofixed.c F-3972: add direction-sensitive unit tests for wolfBoot_dualboot_candidate_addr 2026-06-11 17:44:52 +02:00
unit-update-ram-noramboot.c F-4410: fix uint32_t->int cast bypassing anti-rollback in update_ram wolfBoot_start 2026-06-11 17:31:35 +02:00
unit-update-ram.c (tests) ensure update status turns into TESTING after update 2026-06-11 15:36:04 +02:00
unit-x86-paging-oob.c F-5093: fix OOB memset in x86_paging_setup_ptp and non-looping panic 2026-06-10 21:01:16 +02:00

README.md

Unit Test Tools

This uses the "check" unit test framework for C.

You may need to run "apt install check", "yum install check" or "brew install check".

Building

Use make to build.

Expected output

$ ./unit-parser
Running suite(s): wolfBoot
Explicit end of options reached
This field is too large (bigger than the space available in the current header)
This field is too large and would overflow the image header
Illegal address (too high)
Illegal address (too high)
100%: Checks: 2, Failures: 0, Errors: 0