wolfBoot/tools/unit-tests
Daniele Lacamera e5bb64a59a unit-tests: fix asm stripping, clean, and gitignore
The versal host copy deleted every asm statement, including the three
with output operands, leaving reads of uninitialised automatics -- at
-O0 an infinite loop in hal_delay_us(). Rewrite those three into
assignments from a host counter and only delete asm with an empty
output field; a new rule guard fails the build if any asm survives,
so a future one cannot be silently dropped.

clean now removes the 17 generated sources and the conditionally-built
tests, and .gitignore covers all 125 test binaries plus the generated
sources -- a full build left 30 untracked files before. The gnu-efi
skip announces itself like the adjacent multilib probe.
2026-08-18 09:50:42 +02:00
..
cc26x2_ti_stub tests: cover cc26x2 flash error propagation 2026-08-17 15:59:35 +02:00
mcxa_fsl_stub F-5963: fix over-advance of address/len in unaligned hal_flash_write (kinetis.c, mcxa.c, mcxw.c) 2026-07-02 14:47:38 +02:00
Makefile unit-tests: fix asm stripping, clean, and gitignore 2026-08-18 09:50:42 +02:00
README.md
arm_cmse.h F-7389: arm_tee: reject Secure .base in zero-length PSA iovecs 2026-08-04 07:02:53 +02:00
gpt-sfdisk-test.h
target.h
txt_filler.h
unit-ahci-unlock-panic.c F-6129: zeroize disk-unlock secret before the state-mismatch panic in sata_unlock_disk 2026-07-02 14:18:03 +02:00
unit-arm-tee-psa-ipc.c F-7389: arm_tee: reject Secure .base in zero-length PSA iovecs 2026-08-04 07:02:53 +02:00
unit-ata-security-passphrase-zeroize.c F-5968: zeroize disk-unlock passphrase from static ATA command buffer 2026-07-02 14:27:04 +02:00
unit-aurix-erased-fill.c F-9737: fill AURIX erased-page buffers with the erased word value 2026-08-18 05:10:00 +02:00
unit-boot-x86_fsp.c
unit-common.c
unit-delta.c F-5965: skip wb_diff match candidates whose offset MSB collides with ESC 2026-07-02 14:35:07 +02:00
unit-diagnostics.c Diagnostics: move to next sector when last record is broken 2026-07-02 17:53:12 +02:00
unit-dice-token-size.c Add wolfCOSE DICE attestation 2026-08-06 09:44:52 +02:00
unit-disk.c
unit-efi-x86-open-image.c F-9739: test the 64-bit EFI file-size guard in open_kernel_image 2026-08-18 05:19:06 +02:00
unit-elf-bss-guard.c fix broken unit test 2026-06-16 16:11:10 -06:00
unit-enc-nvm.c Fix hwswap fallback CI regressions 2026-07-02 18:57:55 +02:00
unit-extflash.c F-7992: bound staged ciphertext in ext_flash_encrypt_write() 2026-08-11 09:29:53 +02:00
unit-fdt.c fdt: break loop compatibles when no NUL-terminator is found 2026-07-02 09:23:18 +02:00
unit-fit-fpga.c
unit-fit-gzip.c 6593 - Bound uncompressed FIT subimage copy by staging buffer size 2026-07-14 17:44:26 +02:00
unit-flash-erase-c0.c F-3963: fix hal_flash_erase loop bound in stm32c0.c skipping final partial page 2026-06-11 18:16:48 +02:00
unit-flash-erase-g0.c F-3964: fix hal_flash_erase loop bound in stm32g0.c skipping final partial page 2026-06-11 18:13:30 +02:00
unit-flash-erase-h7.c
unit-flash-erase-l0.c F-3965: fix hal_flash_erase loop bound in stm32l0.c skipping final partial page 2026-06-11 18:08:22 +02:00
unit-flash-erase-mcxw.c mcxw: extend the erase length when rounding the start down 2026-08-12 13:21:08 +02:00
unit-flash-erase-u3.c F-3962: fix hal_flash_erase loop bound in stm32u3.c skipping final partial page 2026-06-11 18:23:51 +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-flash-write-cc26x2.c tests: cover cc26x2 flash error propagation 2026-08-17 15:59:35 +02:00
unit-flash-write-mcxa.c hal: advance source index in aligned flash-write fast path 2026-07-02 17:01:08 +02:00
unit-flash-write-nrf52.c nrf52/nrf5340/stm32l0: fix the 32-bit fast path in hal_flash_write 2026-08-12 13:20:56 +02:00
unit-flash-write-same51.c F-5964: fix stale in-word offset in hal_flash_write byte-wise path (samr21/same51) 2026-07-02 15:57:54 +02:00
unit-flash-write-samr21.c F-5964: fix stale in-word offset in hal_flash_write byte-wise path (samr21/same51) 2026-07-02 15:57:54 +02:00
unit-fwtpm-nv-oob.c
unit-fwtpm-stub.c
unit-gzip.c
unit-image-elf-scatter.c F-6126: add mutation-pinning test coverage for wolfBoot_check_flash_image_elf 2026-07-02 15:46:24 +02:00
unit-image.c Authenticate raw device tree via signed HDR_DEVICE_TREE_DIGEST TLV (Fenrir #7998) 2026-08-13 08:39:22 +02:00
unit-imx-rt-cache-align.c F-6399: fix imx_rt DCACHE invalidation to include down-alignment offset 2026-07-02 15:13:28 +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-ls1028a-xspi-write.c ls1028a: wait for the NOR program/erase cycle to finish 2026-08-18 09:10:13 +02:00
unit-max-space.c
unit-mock-flash.c libwolfboot: propagate the head-block write failure 2026-08-12 13:20:56 +02:00
unit-mock-state.c
unit-mpusize.c
unit-multiboot.c
unit-nvm-cache-scrub.c F-9765: scrub NVM_CACHE after the trailer read-modify-write helpers 2026-08-18 05:57:21 +02:00
unit-nvm.c Address PR #815 review comments 2026-07-02 19:20:34 +02:00
unit-otp-keystore-gen-zeroize.c F-6408: zeroize UDS from OTP keystore generator's heap and stack buffers 2026-07-02 14:56:48 +02:00
unit-otp-keystore.c F-3734: add unit tests for magic check and item_count boundary in flash_otp_keystore 2026-06-11 19:13:49 +02:00
unit-p1021-fcm-bytes.c p1021: read the full page so the bad-block marker is valid 2026-08-18 09:05:33 +02:00
unit-p1021-qe-firmware.c F-9759: bound P1021 QE microcode offsets and length to the NAND buffer 2026-08-18 03:04:27 +02:00
unit-parser.c
unit-pci.c 6561 - Restore upper 64-bit BAR register on pci_program_bar error paths 2026-07-14 17:44:26 +02:00
unit-pic32-pfswap.c 6560 - Clear PFSWAP bit in pic32_fcw_pfswap_set read-modify-write 2026-07-21 19:33:40 +02:00
unit-pkcs11-nsc-zeroize.c F-6875: pkcs11: zeroize NSC bounce buffers before freeing them 2026-08-04 08:26:17 +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-6407: zeroize static cached_sector after each flash commit in psa_store 2026-07-02 14:03:24 +02:00
unit-qspi-flash.c F-7382: clip QSPI page program transfers at the device page boundary 2026-08-11 12:54:36 +02:00
unit-rot-auth.c
unit-sdhci-disk-unaligned.c
unit-sdhci-dma-error.c sdhci: fix silent read failures and unbootable warm reset with UHS-I cards 2026-08-11 15:37:56 -07:00
unit-sdhci-response-bits.c
unit-sdhci-uhs-recover.c sdhci: roll back the UHS one-shot with the registers 2026-08-18 09:19:13 +02:00
unit-sdhci-wait-busy.c F-7984: bound the SDHCI busy waits with a finite timeout 2026-08-18 04:53:27 +02:00
unit-sectorflags.c
unit-sign-custom-tlv-large.py fix bad max value in test print 2026-07-22 16:26:58 -06:00
unit-sign-custom-tlv-le.py F-6127: fix custom-TLV 8-byte value saturation in arg2num 2026-07-02 15:28:09 +02:00
unit-sign-custom-tlv-pubkey-der.py Check key len for truncation; add unit test 2026-07-30 15:38:11 +02:00
unit-sign-delta-basehash-cleanup.py F-8006: return errors from delta base-hash validation in sign tool 2026-08-11 09:13:31 +02:00
unit-sign-delta-cert-inv-off.py
unit-sign-delta-tlv.py
unit-sign-dts.py Authenticate raw device tree via signed HDR_DEVICE_TREE_DIGEST TLV (Fenrir #7998) 2026-08-13 08:39:22 +02:00
unit-sign-encrypted-output.c
unit-sign-encrypted-output.mkfrag
unit-sign-header-failure.c F-7053: sign: propagate make_header() failure to the exit status 2026-08-04 08:16:53 +02:00
unit-sign-hybrid-keyload.c F-8003: separate decoded key objects for hybrid signers 2026-08-11 09:25:54 +02:00
unit-spi-flash.c
unit-stm32l5-write.c stm32l5/u5: program the whole flash unit in one PG window 2026-08-18 08:41:26 +02:00
unit-stm32u5-write.c stm32l5/u5: program the whole flash unit in one PG window 2026-08-18 08:41:26 +02:00
unit-store-sbrk.c
unit-string.c
unit-t10xx-dts-memac.c F-7052: bound the fman-memac cell-index before indexing phydevs 2026-08-18 04:05:35 +02:00
unit-t10xx-qe-firmware.c F-8000: bound T10xx QE microcode offsets to the declared image 2026-08-18 05:00:02 +02:00
unit-t2080-fman-loader.c F-9762: validate the T2080 FMan firmware container before upload 2026-08-18 05:28:59 +02:00
unit-ti-hercules-write.c ti_hercules: wait for the FSM before the second program 2026-08-18 09:07:23 +02:00
unit-tpm-advio-zeroize.c F-8007: wipe TPM advanced-IO staging buffers in TPM2_IoCb() 2026-08-11 12:23:09 +02:00
unit-tpm-api-names.c
unit-tpm-blob.c F-3738: fix policySz uint16_t underflow in wolfBoot_unseal_blob for short policy 2026-06-11 18:30:49 +02:00
unit-tpm-check-rot-auth.c
unit-tpm-mfgid-eh-zeroize.c F-7069: clear the EH authValue from the stack in wolfBoot_tpm2_get_timestamp 2026-08-11 12:59:01 +02:00
unit-tpm-nsc-cert.c F-7065: tpm: snapshot NS length in wolfBoot_tpm2_read_cert veneer 2026-08-04 08:07:18 +02:00
unit-tpm-rsa-exp.c F-6402: add negative tests pinning wolfBoot_check_rot digest comparison 2026-07-02 14:10:44 +02:00
unit-uart-flash.c
unit-update-disk-fit.c update_disk: use wc_ForceZero() in the DISK_ENCRYPT helpers 2026-08-11 13:59:06 +02:00
unit-update-disk-oob.c update_disk.c: enforce bound over memcpy 2026-06-23 17:28:25 +02:00
unit-update-disk.c update_disk: use wc_ForceZero() in the DISK_ENCRYPT helpers 2026-08-11 13:59:06 +02:00
unit-update-flash-hwswap.c Fix hwswap fallback CI regressions 2026-07-02 18:57:55 +02:00
unit-update-flash.c libwolfboot: propagate the head-block write failure 2026-08-12 13:20:56 +02:00
unit-update-ram-enc.c test/ram-enc: add exact-max and one-block-over boundary tests 2026-06-18 11:26:15 +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-uboot.c F-7985: enter legacy uImage at ih_ep when it differs from ih_load 2026-08-11 12:16:39 +02:00
unit-update-ram.c zynqmp: wolfBoot ZynqMP FSBL with signed FIT Linux boot and EL3 security (eFuse/PUF/AES-CSU) 2026-07-22 11:56:40 +02:00
unit-va416x0-fram.c F-7051: return the hal_status_t unmodified from FRAM_Erase 2026-08-18 03:32:21 +02:00
unit-versal-ext-write.c F-7981: keep Versal ext_flash_write Page Programs inside a NOR page 2026-08-18 04:43:13 +02:00
unit-versal-qspi-dma.c F-7982: chunk oversized unaligned RX through the temp DMA buffer in Versal qspi_transfer 2026-08-18 02:15:44 +02:00
unit-wolfhsm_flash_hal.c Add WOLFCRYPT_TZ_WOLFHSM TrustZone engine for STM32H5 2026-06-24 15:49:43 -07:00
unit-x86-paging-oob.c
unit-xspi-tfd-index.c 6588 - Index LS1028A XSPI TX FIFO by word instead of by byte 2026-07-21 19:33:40 +02:00
unit-zynq-erase-loop.c F-7980: reset the command index per sector in Zynq ext_flash_erase 2026-08-18 01:50:23 +02:00
unit-zynq-ext-write.c F-7979: keep Zynq ext_flash_write Page Programs inside a NOR page 2026-08-18 04:21:04 +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