Initial prototype of test refactor#331
Conversation
6bd9195 to
1f06444
Compare
e3b29f6 to
5d9dc00
Compare
5c4e0e2 to
4b6bfe6
Compare
bigbrett
left a comment
There was a problem hiding this comment.
Overall,as discussed, looks great. A few things I wanted to point out and some architectural questions that should be addressed.
Also, can we get a code coverage comparison set up in CI so we can track the coverage metrics between existing test and new harness?
|
@padelsbach oh and also, a section of the new README.md mapping old test constructs -> new test constructs would be valuable for people who need to understand the migration. Both discussing key differences at a high level, as well as mapping each individual test from its old location to its new location (this last part can be an AI table - prefer some human input for the first part) |
770e6ab to
976fdca
Compare
bigbrett
left a comment
There was a problem hiding this comment.
Great start on the framework. This is at like 90% for me but dont want to delay getting it in, since it wont break anything. Opening up to others for investigation and thoughts.
There was a problem hiding this comment.
Pull request overview
This PR introduces an initial “test-refactor” prototype alongside the existing test/ suite, including a portable test registry + group runner, a POSIX threaded harness with shared client/server setup, and updated CI workflows for build/test and coverage (including tracefile merge support).
Changes:
- Add a new portable test runner/registry (
wh_test_list*,wh_test_groups*) with skip-stub support via weak symbols. - Add a POSIX test port that brings up a server thread + client thread with shared mem-transport buffers, plus initial migrated tests.
- Update GitHub Actions coverage to run a matrix of builds emitting JSON tracefiles and merge them into an HTML report; add equivalent workflows for the refactor suite.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
test/Makefile |
Adds a coverage-json target to emit gcovr JSON tracefiles for CI matrix merging. |
test-refactor/wh_test_port.h |
Defines per-port reset hooks invoked between tests. |
test-refactor/wh_test_list.h |
Declares the test registry types and the weak-stub mechanism for skipped tests. |
test-refactor/wh_test_list.c |
Central registry of tests grouped into Misc/Server/Client arrays. |
test-refactor/wh_test_groups.h |
Declares portable group entrypoints + summary/tally helpers. |
test-refactor/wh_test_groups.c |
Implements group iteration, standardized result printing, and final summary. |
test-refactor/server/wh_test_cert.c |
Adds a server-side cert-manager verification suite. |
test-refactor/README.md |
Documents how to run/add ports/tests and migration mapping from test/. |
test-refactor/posix/wh_test_posix_server.h |
POSIX server bring-up API for the refactor harness. |
test-refactor/posix/wh_test_posix_server.c |
Implements POSIX server init/cleanup (flash/NVM/crypto/transport/server). |
test-refactor/posix/wh_test_posix_main.c |
Threaded POSIX driver running Misc inline, then Server, then Client against live server loop. |
test-refactor/posix/wh_test_posix_client.h |
POSIX client bring-up API for the refactor harness. |
test-refactor/posix/wh_test_posix_client.c |
Implements POSIX client init/cleanup and CommInit handshake using shared mem transport. |
test-refactor/posix/wh_test_nvm_flash.c |
POSIX-only NVM/flash unit tests (invoked as port-specific tests). |
test-refactor/posix/wh_test_flash_ramsim.c |
POSIX-only RamSim flash tests (invoked as port-specific tests). |
test-refactor/posix/Makefile |
Build/run/coverage targets for the POSIX refactor test port. |
test-refactor/misc/wh_test_dma.c |
Adds DMA allow-list boundary/overflow unit tests (gated on WOLFHSM_CFG_DMA). |
test-refactor/Makefile |
Top-level forwarder to run the POSIX refactor port via make check etc. |
test-refactor/client-server/wh_test_wolfcrypt.c |
Runs the upstream wolfCrypt test suite through a live wolfHSM client (gated). |
test-refactor/client-server/wh_test_server_info.c |
Client-side server-info query test. |
test-refactor/client-server/wh_test_echo.c |
Client-side echo round-trip test. |
test-refactor/client-server/wh_test_crypto.c |
Client-side SHA256/AES-CBC/ECC round-trips routed via WH_DEV_ID. |
.gitignore |
Ignores test-suite.log output. |
.github/workflows/code-coverage.yml |
Converts legacy coverage to matrix tracefiles + merge job producing a combined HTML report. |
.github/workflows/code-coverage-refactor.yml |
Adds refactor coverage workflow mirroring the legacy matrix/merge model. |
.github/workflows/build-and-test-refactor.yml |
Adds CI build-and-test coverage across multiple refactor build flag combinations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
af2fda7 to
9f39a4b
Compare
9f39a4b to
45b717b
Compare
bigbrett
left a comment
There was a problem hiding this comment.
Merging since I don't want this to linger, and it lives along-side the real tests until we move everything over.
@billphipps @AlexLanzano @rizlik I recommend you review this retroactively and keep abreast of the subsequent additions as they come in so that you dont have to do it all at the last minute when the migration decision happens.
Refactor top level test modules with the following:
See more in the README.md