Skip to content

[examples, tests] Refactor examples and tests directory#11

Merged
AlexLanzano merged 1 commit intowolfSSL:mainfrom
AlexLanzano:tests-and-examples-refactor
Mar 2, 2026
Merged

[examples, tests] Refactor examples and tests directory#11
AlexLanzano merged 1 commit intowolfSSL:mainfrom
AlexLanzano:tests-and-examples-refactor

Conversation

@AlexLanzano
Copy link
Member

No description provided.

@AlexLanzano AlexLanzano self-assigned this Mar 2, 2026
Copilot AI review requested due to automatic review settings March 2, 2026 05:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the tests/ and examples/ directories to eliminate duplication and improve maintainability. Previously, each board (STM32WB, PIC32CZ) had its own copy of test code, test infrastructure, and board config. The new structure separates shared test logic by peripheral type, introduces a board abstraction layer (board.h/board.c/Board_Init), and uses preprocessor flags and Makefile wildcards to select board-specific test variants at build time.

Changes:

  • Board support is now centralized in tests/boards/<board>/ and examples/blinky/boards/<board>/, with shared test code in tests/<peripheral>/. Per-board test infrastructure (old tests/stm32wb/, tests/pic32cz/, examples/stm32wb/, examples/pic32cz/) is removed.
  • All test and helper function names are renamed from camelCase (e.g., whalTest_Puts) to snake_PascalCase (e.g., whal_Test_Puts), and test case functions from test_x_y to Test_X_Y.
  • The wolfHAL.h umbrella header is updated to include the new spi and timer headers.

Reviewed changes

Copilot reviewed 55 out of 59 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
wolfHAL/wolfHAL.h Adds spi/spi.h and timer/timer.h includes to the umbrella header
tests/test.h Renames all internal symbols from whalTest_* to whal_Test_*
tests/main.c New shared HW test entry point with preprocessor-gated test dispatch
tests/Makefile New unified Makefile with board selection and per-peripheral source selection
tests/README.md Documents new test structure and build instructions
tests/boards/stm32wb55xx_nucleo/board.*, ivt.c, linker.ld, Makefile.inc Board support files for STM32WB (new location)
tests/boards/pic32cz_curiosity_ultra/board.*, ivt.c, linker.ld, Makefile.inc Board support files for PIC32CZ (new location)
tests/clock/, tests/gpio/, tests/flash/, tests/rng/, tests/timer/ Reorganized peripheral tests, split into generic and platform-specific files
tests/core/main.c, Makefile Renames test_sim target to test_core, updates function names
tests/core/test_bitops.c, test_dispatch.c Renamed test functions to new convention
tests/stm32wb/, tests/pic32cz/ Old per-board test directories removed
examples/blinky/ New canonical blinky example replacing old examples/stm32wb/ and examples/pic32cz/
examples/stm32wb/, examples/pic32cz/ Old example directories removed
.github/workflows/ci.yml CI updated to build new blinky and unified test targets
Comments suppressed due to low confidence (1)

tests/gpio/test_stm32wb_gpio.c:52

  • The platform-specific test entry-point functions (whal_Test_Gpio_Platform, whal_Test_Clock_Platform, whal_Test_Flash_Platform) do not call WHAL_TEST_SUITE_START before running their tests. Since they are called immediately after their generic counterparts in tests/main.c, their test results will be printed without any section header, making the output harder to interpret. Each platform-specific entry point should call WHAL_TEST_SUITE_START with an appropriate label (e.g., "gpio (stm32wb)") to make output consistent and readable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 56 out of 59 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (5)

tests/clock/test_stm32wb_clock.c:37

  • The whal_Test_Clock_Platform, whal_Test_Gpio_Platform, and whal_Test_Flash_Platform functions call WHAL_TEST directly without first calling WHAL_TEST_SUITE_START to label their section in the output. In contrast, all generic test functions (e.g., whal_Test_Clock, whal_Test_Gpio, whal_Test_Flash) properly wrap their tests with WHAL_TEST_SUITE_START/WHAL_TEST_SUITE_END. Without a suite start, platform-specific test results appear in the output with no header, making it hard to identify which module they belong to. Each platform-specific test function should call WHAL_TEST_SUITE_START with an appropriate name (e.g., "clock_platform", "gpio_platform", "flash_platform") before calling any WHAL_TEST.
    tests/clock/test_pic32cz_clock.c:61
  • Same issue as test_stm32wb_clock.c: whal_Test_Clock_Platform does not call WHAL_TEST_SUITE_START before running tests, so its results appear unlabeled in the output. Add a WHAL_TEST_SUITE_START with a descriptive name.
    tests/gpio/test_stm32wb_gpio.c:52
  • Same issue: whal_Test_Gpio_Platform does not call WHAL_TEST_SUITE_START/WHAL_TEST_SUITE_END. Its test results appear in the output without a section header. Add WHAL_TEST_SUITE_START with a descriptive suite name before the WHAL_TEST calls.
    tests/gpio/test_pic32cz_gpio.c:53
  • Same issue: whal_Test_Gpio_Platform does not call WHAL_TEST_SUITE_START/WHAL_TEST_SUITE_END, so its test results appear unlabeled. Add a suite header for consistency with the generic test functions.
    tests/boards/stm32wb55xx_nucleo/board.c:127
  • Board_Deinit in the STM32WB tests board initializes g_whalFlash in Board_Init (line 64) but never calls whal_Flash_Deinit in Board_Deinit. The same asymmetry exists in the PIC32CZ Board_Deinit. While Board_Deinit is not currently called from tests/main.c, this is a latent inconsistency that could cause issues if Board_Deinit is called in the future.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AlexLanzano AlexLanzano force-pushed the tests-and-examples-refactor branch from fb70398 to 84fd7ce Compare March 2, 2026 15:13
@AlexLanzano AlexLanzano merged commit 0da0a5a into wolfSSL:main Mar 2, 2026
2 checks passed
AlexLanzano added a commit that referenced this pull request Mar 2, 2026
[examples, tests] Refactor examples and tests directory
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