Skip to content

Unify client/server and NVM setup/teardown#313

Draft
padelsbach wants to merge 1 commit intowolfSSL:mainfrom
padelsbach:padelsbach/client-server-test-unify
Draft

Unify client/server and NVM setup/teardown#313
padelsbach wants to merge 1 commit intowolfSSL:mainfrom
padelsbach:padelsbach/client-server-test-unify

Conversation

@padelsbach
Copy link
Contributor

@padelsbach padelsbach commented Mar 18, 2026

First pass unification of repetitious test code. Net reduction is about 600 lines.

To ensure that this does not significantly alter the test flows, I generated a coverage comparison script. The output below shows effectively the same level of coverage in the unit tests between this branch and main.

➜ /git/experiments/hsm-coverage/compare_coverage.sh /git/wolfHSM/coverage_out/main_summary.txt /git/wolfHSM/coverage_out/padelsbach_client-server-test-unify_summary.txt
==============================================================================
  Coverage Comparison
  Baseline: main
  Target:   padelsbach_client-server-test-unify
==============================================================================

--- Files with changed coverage ---

  File                                       Coverage        Delta    Exec           Lines
  -----------------------------------------------------------------------------------------------
  /git/wolfHSM/src/wh_server_crypto.c         83% ->  83%  (+0%)  exec: 2184->2181  lines: 2630->2627
  /git/wolfHSM/src/wh_server_keystore.c       84% ->  84%  (+0%)  exec: 792->792  lines: 938->936

--- Summary totals ---

                         Baseline     Target      Delta
  ----------------------------------------------------
  Total lines               14255      14250         -5
  Lines executed            11964      11961         -3
  Line coverage               83%        83%        +0%

  Files in baseline: 43
  Files in target:   43

Copy link
Contributor

@bigbrett bigbrett left a comment

Choose a reason for hiding this comment

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

womp womp no malloc allowed :(

return WH_ERROR_BADARGS;
}

setup = malloc(sizeof(*setup));
Copy link
Contributor

Choose a reason for hiding this comment

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

I unfortunately never informed you about the critical requirement that we don't malloc inside wolfHSM .

So while this would be wonderful to do, we can't :/

Gonna need to skin the cat another way. That said, pretty sure we don't need variably sized buffers for anything in our test harness - could we get away with default macro configuration structs?

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.

2 participants