Skip to content

Phase 1: Build modernization and test fixes#26

Merged
papawattu merged 10 commits intomasterfrom
phase1/build-modernize
Mar 16, 2026
Merged

Phase 1: Build modernization and test fixes#26
papawattu merged 10 commits intomasterfrom
phase1/build-modernize

Conversation

@papawattu
Copy link
Copy Markdown
Collaborator

Summary

Modernize the build system and fix all test failures as the first phase of a 3-phase restructure plan.

Test Fixes

  • Fix 4 test failures across test_phev_core (bad checksums + misuse of decode return value) and test_phev_register (missing case 0x2f in phev_core_unencodedIncomingMessage silently dropped START_RESP messages)
  • Split monolithic test_runner into 6 per-suite CTest executables via phev_add_test() helper
  • Add individual run_*.c runner files for each suite
  • Additional fixes: VIN null-terminator, null guards in phev_register, missing includes

Build Modernization

  • Add CMakePresets.json with dev/release/ci presets
  • Fix GitHub Actions CI to actually run tests (was only doing docker build, never docker run)
  • Update Dockerfile to use cmake presets
  • Remove dead files: .travis.yml, runtests.bat, .gitmodules (submodules don't exist), PHEV - Sheet1.csv, splint.cmake
  • Expand .gitignore with IDE, CMake, and OS patterns
  • Add .clang-format documenting existing code style
  • Add TODO.md tracking the 3-phase restructure plan
  • Update AGENTS.md to reflect current project state

Test Results

All 6 suites pass (150 tests total, 0 failures):

  • test_phev_core (52), test_phev_pipe (18), test_phev_service (56), test_phev_model (8), test_phev (2), test_phev_register (14)

Fix 4 test failures across 2 suites:

- phev_core: fix doubleMessage checksums and split-test logic that used
  decode return value (1=success) as byte offset instead of data[1]+2
- phev_core: add missing case 0x2f (START_RESP) to
  phev_core_unencodedIncomingMessage, which caused start response
  messages to be silently dropped by the splitter
- phev_register: fix start_ack and end_to_end tests (same 0x2f root cause)
- phev_register: rework test setup (memset srvCtx, reset state vars)

Split monolithic test_runner into 6 per-suite CTest executables via
phev_add_test() helper in test/CMakeLists.txt. Add individual run_*.c
runner files for each suite.

Additional fixes:
- phev_pipe: VIN null-terminator fix
- phev_register: null guard for settings.ctx, merge REG_DISP and
  REGISTRATION_COMPLETE handling, null-check errorHandler before call
- test_phev.c, test_phev_service.c: add missing msg_utils.h includes
Provides standardized build configurations:
- dev: Debug + tests + compile_commands.json (daily development)
- release: Release without tests (production builds)
- ci: Release + tests + compile_commands.json (CI pipeline)

Usage: cmake --preset dev && cmake --build --preset dev && ctest --preset dev
The stub macro was a no-op placeholder. The WANT_SPLINT option was
already removed from CMakeLists.txt in a prior commit. Only AGENTS.md
still references it and will be updated separately.
The previous workflow only ran 'docker build' which never executes
the Dockerfile CMD. Tests never ran in CI.

Replace with native cmake preset-based workflow:
configure (--preset ci) → build → ctest.
Also upgrade actions/checkout from v2 to v4.
Replace manual cmake flags with --preset ci for configure, build,
and test stages. Keeps the Dockerfile as a self-contained way to
build and test the project in a clean environment.
- .travis.yml: Travis CI is no longer used; replaced by GitHub Actions
- runtests.bat: Windows docker helper, superseded by CMake presets
- .gitmodules: referenced non-existent external/ submodules; deps are
  now handled via FetchContent or vendored directly
- PHEV - Sheet1.csv: protocol register reference spreadsheet, not
  part of the build or runtime
Add CMakeUserPresets.json, compile_commands.json, common IDE dirs
(.idea), editor swap files, and OS metadata files.
Documents the project's 4-space indent, Allman braces, middle
pointer alignment conventions. Not enforced automatically — intended
for editor integration and manual use.
Documents what has been done in Phase 1 and what remains for Phase 2
(test migration) and Phase 3 (directory restructure). Includes the
test audit findings: 75 of 220 test functions are never wired.
Rewrite to reflect current project state:
- CMakePresets.json for build configuration
- Per-suite test runners (6 CTest targets)
- FetchContent for cJSON and Unity
- Vendored msg-core sources
- .clang-format for style documentation
- CI runs tests natively via cmake presets
- Remove stale splint, submodule, and monolithic-runner references
- Document the 75 unwired tests and orphaned test files
@papawattu papawattu merged commit e6a8b9e into master Mar 16, 2026
1 check passed
@papawattu papawattu deleted the phase1/build-modernize branch March 16, 2026 12:54
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.

1 participant