Skip to content

Split whTest_Flash() out of the NVM flash tests - #559

Merged
bigbrett merged 1 commit into
wolfSSL:mainfrom
kojiws:split-flash-test
Nov 5, 2026
Merged

bigbrett merged 1 commit into
wolfSSL:mainfrom
kojiws:split-flash-test

Conversation

@kojiws

@kojiws kojiws commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Description

This PR supersedes #557.

whTest_Flash() checks a port's whFlashCb flash driver and is meant to run on the target.
It lived in wh_test_nvm_flash.c, so linking it also pulled in that file's RAM-simulated flash: 2 MB of static buffers.
That does not fit targets with small local RAM.

Changes

  • Move whTest_Flash() unchanged to new test/wh_test_flash.c / test/wh_test_flash.h. It depends only on wh_flash.h and wh_flash_unit.h, with no ramsim and no server guard.
  • wh_test_nvm_flash.c includes the new header and still calls whTest_Flash() on the ramsim and POSIX file backends.
  • Drop the whTest_FlashCfg() prototype from wh_test_nvm_flash.h. It had no implementation; ports now include wh_test_flash.h instead.

Testing

  • make run with NOCRYPTO=1
  • make run with NOCRYPTO=1 ASAN=1 NVM_FLASH_CRC=1
  • Linked wh_test_flash.c alone with wh_flash_unit.c, wh_flash_ramsim.c and a small main(), without server or client defines. It passes, and the only test symbol in the binary is whTest_Flash.

Copilot AI balanced review requested due to automatic review settings November 5, 2026 01:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the standalone flash-test extraction.

No open issues 🎉

What changed in this PR

Separates the low-level flash driver test from the NVM flash suite so embedded targets can link it without pulling in 2 MB of RAM-simulation buffers.

Changes:

  • Moves whTest_Flash() unchanged into a standalone source file without a server guard.
  • Keeps the NVM suite’s RAM-simulator and POSIX-backend calls using the new header.
  • Replaces the unimplemented whTest_FlashCfg() declaration with the actual whTest_Flash() API in the standalone header.
File Description
test/​wh_test_nvm_flash.h Removes the unimplemented whTest_FlashCfg() declaration.
test/​wh_test_nvm_flash.c Includes the new header and removes the extracted function body.
test/​wh_test_flash.h Declares the standalone flash test and documents its destructive behavior.
test/​wh_test_flash.c Houses the unchanged flash test independently of the NVM suite.

Review effort: Balanced

@bigbrett
bigbrett merged commit a1b8641 into wolfSSL:main Nov 5, 2026
26 checks passed
@kojiws
kojiws deleted the split-flash-test branch November 6, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants