Skip to content

tests: Add novaGround testing, hardware simulation, and the support for bench testing - #17

Draft
Awesome-Ace22 wants to merge 18 commits into
devfrom
tests/novaground-test-suite
Draft

Awesome-Ace22 wants to merge 18 commits into
devfrom
tests/novaground-test-suite

Conversation

@Awesome-Ace22

@Awesome-Ace22 Awesome-Ace22 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What and why

This pull request introduces significant improvements to the build system, testing, and simulation support for the project. It adds a new hardware-free build mode for CI and development, improves documentation for simulated hardware, and enhances testability and script portability. The most important changes are grouped below.

Build system and simulation improvements:

  • Added a new Meson build option hardware to allow building only hardware-independent code and tests, enabling CI and laptop builds without requiring Pi-specific libraries. The build now produces a novaMock executable that runs the full application on simulated hardware, with scenario files controlling simulated sensors and faults. (meson_options.txt, meson.build, docs/simulation.md, docs/setup.md) [1] [2] [3] [4] [5] [6]

  • Refactored the build system to split core, simulated, and real hardware code, and to only link hardware-dependent libraries when needed. The novaMock executable and its smoke test are now only built and run if dependencies are available. (meson.build) [1] [2] [3]

Continuous Integration and testing:

  • Enhanced CI workflow to add shell linting (shellcheck), contract testing for scripts, BATS tests for scripts, and a new core-tests job that builds and tests hardware-free code on multiple architectures and with sanitizers. (.github/workflows/pr-checks.yml)

  • Improved script testability by allowing all paths in nova-pi.sh and run.sh to be redirected to a scratch root via the NOVA_PI_ROOT environment variable. This enables safe testing without touching the real Pi. (nova-pi.sh, run.sh) [1] [2] [3] [4]

Codebase cleanup and modernization:

  • Updated the GPIO controller to use the new DigitalIo interface instead of the old GPIO_Manager, improving abstraction and compatibility with simulated hardware. (src/controllers/gpio_controller.cpp, src/controllers/gpio_controller.hpp) [1] [2] [3]

  • Improved the main control loops to support cooperative cancellation via std::stop_token, and replaced busy-waiting with interruptible sleeps, making the code more robust and responsive to shutdown requests. (src/controllers/loops.cpp) [1] [2] [3]

Other improvements:

  • Ensured all shell and BATS scripts use LF line endings for compatibility. (.gitattributes)

Closes UTATRocketry/Nova-Collected#4

How was this tested?

  • 1 Unit / Automated Test - CI
  • 2 Simulator Test - testing procedure with the hardware simulators
  • 3 Bench Test - testing procedure on the dev stack, with some real hardware
  • 4 Integration Test - full engine test procedure, real hardware, no propellants

Hardware impact

  • None - UI, docs or tooling only
  • Changes how a sensor is read, converted or shown
  • Changes how an actuator is commanded, or safety rules, interlocks, timeouts or sequencing → add the hardware-risk label; a lead must approve
  • Changes a message format, MQTT topic or FAS protocol that another repo depends on → title needs !, link the matching PRs:

Checklist

  • Targets dev (or main for a release/hotfix, or with a reason given above)
  • Branch is up to date ("Update branch" button)
  • No station config/calibrations, data files, secrets, .env files or build output committed
  • README/docs updated if behaviour changed

#16)

This pull request introduces a major refactor to support simulated
hardware for development and CI, adds comprehensive documentation for
the simulation mode, and improves the architecture and testability of
the codebase. The most significant changes are the introduction of the
`novaMock` build (the real application running on simulated hardware), a
clear separation between hardware interfaces and implementations, and
improved test coverage with scenario-driven simulation. Additionally,
the PR updates build scripts, documentation, and controller interfaces
to enable these features.

**Simulation and Build System Enhancements:**

- Added a new `novaMock` executable that runs the real application logic
on simulated hardware, using a scenario-driven simulator for DAQ,
relays, servos, and GPIO, making it possible to build and test on non-Pi
systems and in CI. The build system (`meson.build`) now conditionally
builds `novaMock` and its integration test if dependencies are
available.
[[1]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L15-R133)
[[2]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L90-R189)
[[3]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L122-L143)
[[4]](diffhunk://#diff-1da7a27709d11ac16eef3de8e46ed10672b7b1d63a790ffbcbd23a94b19efdcbL127-R143)
- Updated the build process to separate core, simulated, and real
hardware code, and only require hardware-specific libraries when
building for real hardware.
[[1]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L15-R133)
[[2]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L90-R189)

**Documentation Improvements:**

- Added a new `docs/simulation.md` describing how the simulated hardware
works, how to use scenario files to drive tests, and how to run tests in
CI or on a laptop. Updated `docs/setup.md` to clarify the purpose and
capabilities of `novaMock`.
[[1]](diffhunk://#diff-e3501cd20d40eb121af21a267e97e556d196388980cca1559af350fa957c131cR1-R74)
[[2]](diffhunk://#diff-4ca53116333428d7d34e6d2a9a64069655c8c37d5d36b856320ac1a0c4cb9b23L89-R89)

**Controller and Interface Refactoring:**

- Refactored controller classes (`GpioController`, `RelayController`) to
depend on abstract interfaces (`DigitalIo`, `RelayBank`) instead of
hardware-specific implementations, improving modularity and enabling
simulation.
[[1]](diffhunk://#diff-6a7261f77069ec7be4b56cc46a2241c11cf5040a218ddd5fff0961519b89c290L7-R11)
[[2]](diffhunk://#diff-6a7261f77069ec7be4b56cc46a2241c11cf5040a218ddd5fff0961519b89c290L30-R39)
[[3]](diffhunk://#diff-667fe70f66ffdb7b045df42e085eb3458c684ad8055d65edb994d754d76cd3adL6-R17)
[[4]](diffhunk://#diff-8fee36982e6354b6d3e6fc59537c3350327c4c079874b21d76f1ba2ef2c240ccL7-R7)
[[5]](diffhunk://#diff-bad323bc8e99a2dc677000108e7d7448d9d1926280bd472d2490c25fd7617778L9-R21)

**Sampling and Loop Improvements:**

- Replaced previous sampling loops with new, interruptible loops that
support cooperative cancellation via `std::stop_token`, improving
shutdown behavior and testability. Added new `sampler.cpp` with
single-sample and loop functions for DAQ and GPIO, supporting both real
and simulated hardware.
[[1]](diffhunk://#diff-78a0ea2dacbb59812e5d3478ae1ae30b459dddb4811dda33ca498352ea126942R9-R25)
[[2]](diffhunk://#diff-78a0ea2dacbb59812e5d3478ae1ae30b459dddb4811dda33ca498352ea126942L62-R83)
[[3]](diffhunk://#diff-78a0ea2dacbb59812e5d3478ae1ae30b459dddb4811dda33ca498352ea126942L84-L97)
[[4]](diffhunk://#diff-c6ca818f433b97cf971263d08271e737ddf6e709b666b26a2d14c99f14afd402R5-L18)
[[5]](diffhunk://#diff-6e26440c0e67464783c82dbccc2774e79c72e0a01bb1b3eabdb923a985923761R1-R100)

**Testing and CI Integration:**

- Added an integration test (`novamock_smoke`) that runs the full
application on simulated hardware, verifies telemetry and data logging,
and runs automatically in CI if dependencies are present.
[[1]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L15-R133)
[[2]](diffhunk://#diff-1da7a27709d11ac16eef3de8e46ed10672b7b1d63a790ffbcbd23a94b19efdcbL127-R143)

These changes collectively enable robust simulation, testing, and
development workflows without requiring physical hardware.

- Simulation and build system:
- Added `novaMock` target and scenario-driven simulated hardware;
updated `meson.build` and CI to support simulation and integration
testing.
[[1]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L15-R133)
[[2]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L90-R189)
[[3]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L122-L143)
[[4]](diffhunk://#diff-1da7a27709d11ac16eef3de8e46ed10672b7b1d63a790ffbcbd23a94b19efdcbL127-R143)
- Documentation:
- Added `docs/simulation.md` and updated `docs/setup.md` to explain
simulation and usage.
[[1]](diffhunk://#diff-e3501cd20d40eb121af21a267e97e556d196388980cca1559af350fa957c131cR1-R74)
[[2]](diffhunk://#diff-4ca53116333428d7d34e6d2a9a64069655c8c37d5d36b856320ac1a0c4cb9b23L89-R89)
- Controller refactor:
- Changed controllers to use abstract interfaces (`DigitalIo`,
`RelayBank`) for better modularity and simulation support.
[[1]](diffhunk://#diff-6a7261f77069ec7be4b56cc46a2241c11cf5040a218ddd5fff0961519b89c290L7-R11)
[[2]](diffhunk://#diff-6a7261f77069ec7be4b56cc46a2241c11cf5040a218ddd5fff0961519b89c290L30-R39)
[[3]](diffhunk://#diff-667fe70f66ffdb7b045df42e085eb3458c684ad8055d65edb994d754d76cd3adL6-R17)
[[4]](diffhunk://#diff-8fee36982e6354b6d3e6fc59537c3350327c4c079874b21d76f1ba2ef2c240ccL7-R7)
[[5]](diffhunk://#diff-bad323bc8e99a2dc677000108e7d7448d9d1926280bd472d2490c25fd7617778L9-R21)
- Sampling/loop improvements:
- Introduced interruptible, stop-token based sampling loops and
refactored sampling logic for testability and simulation.
[[1]](diffhunk://#diff-78a0ea2dacbb59812e5d3478ae1ae30b459dddb4811dda33ca498352ea126942R9-R25)
[[2]](diffhunk://#diff-78a0ea2dacbb59812e5d3478ae1ae30b459dddb4811dda33ca498352ea126942L62-R83)
[[3]](diffhunk://#diff-78a0ea2dacbb59812e5d3478ae1ae30b459dddb4811dda33ca498352ea126942L84-L97)
[[4]](diffhunk://#diff-c6ca818f433b97cf971263d08271e737ddf6e709b666b26a2d14c99f14afd402R5-L18)
[[5]](diffhunk://#diff-6e26440c0e67464783c82dbccc2774e79c72e0a01bb1b3eabdb923a985923761R1-R100)
- Testing:
- Added scenario-driven integration test for `novaMock` and improved
test coverage in CI.
[[1]](diffhunk://#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4L15-R133)
[[2]](diffhunk://#diff-1da7a27709d11ac16eef3de8e46ed10672b7b1d63a790ffbcbd23a94b19efdcbL127-R143)
@Awesome-Ace22 Awesome-Ace22 added hardware-risk Can move hardware: actuators, safety rules, interlocks, timeouts, sequencing needs-hardware-test Waiting for a Bench (3) or Integration (4) test labels Nov 6, 2026
@Awesome-Ace22 Awesome-Ace22 changed the title Tests/novaground test suite tests: Add novaGround testing, hardware simulation, and the support for bench testing Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hardware-risk Can move hardware: actuators, safety rules, interlocks, timeouts, sequencing needs-hardware-test Waiting for a Bench (3) or Integration (4) test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add novaGround tests and the support for bench testing

1 participant