Skip to content

feat: add unit/integration tests for tools and geocad and run them in linux-eic-shell CI#52

Open
Copilot wants to merge 5 commits into
mainfrom
copilot/add-integration-and-unit-tests
Open

feat: add unit/integration tests for tools and geocad and run them in linux-eic-shell CI#52
Copilot wants to merge 5 commits into
mainfrom
copilot/add-integration-and-unit-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 17, 2026

Summary

Adds unit and integration tests for the npdet_to_step geometry tool and the GeoCad library, and wires them into the linux-eic-shell CI workflow.

Changes

CI (.github/workflows/linux-eic-shell.yml)

  • Enable -DUSE_GEOCAD=ON in the cmake configure step so the geocad library and its tests are built
  • Run ctest in the build matrix before installing, with --output-on-failure and --no-tests=error

Build system

  • Move include(CTest) to the top-level CMakeLists.txt (required for add_test to work correctly)
  • Wire test subdirectories into the geocad and tools CMake builds

npdet_to_step tool (src/tools/)

  • Extract CLI argument parsing from npdet_to_step.cxx into npdet_to_step_cli.cxx / npdet_to_step_cli.h to separate main() from the parsing logic
  • Unit test for settings helpers (unit_settings.cxx): verifies ensure_step_extension handles various filename inputs
  • Integration tests:
    • tools_integration_npdet_to_step_help: verifies the help subcommand prints the expected description
    • tools_integration_npdet_to_step_missing_input: verifies an appropriate error message is printed when a non-existent compact file is supplied (uses PASS_REGULAR_EXPRESSION rather than WILL_FAIL to avoid the CTest property-inversion issue when combining those two properties)

GeoCad library (src/geocad/)

  • Unit test for partial-tree extraction (unit_partial_tree.cxx)
  • Integration test for STEP file creation from a synthetic TGeo geometry (integration_create_step.cxx)

Copilot AI requested a review from wdconinc May 17, 2026 17:31
@wdconinc wdconinc changed the title Add unit and integration tests for tools and geocad feat: add unit and integration tests for tools and geocad May 17, 2026
@wdconinc
Copy link
Copy Markdown
Contributor

@copilot Wire the testing into the linux-eic-shell CI workflow as part of the build job matrix. DD4hep and OpenCascade will be available (enable GEOCAD build option if not already enabled).

Agent-Logs-Url: https://github.com/eic/npsim/sessions/521280b1-bee0-40cd-9c14-d1d77a96b1c1

Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 17, 2026

@copilot Wire the testing into the linux-eic-shell CI workflow as part of the build job matrix. DD4hep and OpenCascade will be available (enable GEOCAD build option if not already enabled).

Updated in 8a92bb9: the linux-eic-shell build matrix job now configures CMake with -DUSE_GEOCAD=ON, builds, runs ctest --test-dir build --output-on-failure --no-tests=error, and then installs.

Copilot AI changed the title feat: add unit and integration tests for tools and geocad feat: add unit/integration tests for tools and geocad and run them in linux-eic-shell CI May 17, 2026
Comment thread src/tools/tests/CMakeLists.txt
Agent-Logs-Url: https://github.com/eic/npsim/sessions/c4b5c244-df29-484e-8c4c-3ec21cc984a8

Co-authored-by: wdconinc <4656391+wdconinc@users.noreply.github.com>
Copilot AI requested a review from wdconinc May 17, 2026 18:04
…put test

WILL_FAIL TRUE fails when npdet_to_step exits with code 0 (ROOT atexit
handlers override return 1 from main). Use PASS_REGULAR_EXPRESSION to
verify the error message is printed instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@wdconinc wdconinc marked this pull request as ready for review May 18, 2026 00:01
Copilot AI review requested due to automatic review settings May 18, 2026 00:01
Copy link
Copy Markdown
Contributor

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

Adds unit and integration tests for the npdet_to_step CLI tool and the GeoCad library, refactors npdet_to_step.cxx to separate CLI parsing into its own translation unit, and wires the new tests into the linux-eic-shell CI workflow (with -DUSE_GEOCAD=ON and a ctest step).

Changes:

  • Refactor: split argument parsing out of npdet_to_step.cxx into npdet_to_step_cli.{h,cxx} and move the .stp-suffix helper into settings.h as ensure_step_extension.
  • New tests: unit_settings, tools_integration_npdet_to_step_help/_missing_input for tools; unit_partial_tree and integration_create_step for geocad.
  • Build/CI: hoist include(CTest) to top-level CMake, wire tests/ subdirectories under BUILD_TESTING, enable USE_GEOCAD and run ctest in the eic-shell workflow.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
CMakeLists.txt Add top-level include(CTest) to enable testing globally.
.github/workflows/linux-eic-shell.yml Configure with -DUSE_GEOCAD=ON, build, then run ctest before install.
src/tools/CMakeLists.txt Add npdet_to_step_cli.cxx to executable and add tests subdir under BUILD_TESTING.
src/tools/src/npdet_to_step.cxx Slim main(); delegate parsing to cmdline_settings and use new ensure_step_extension helper.
src/tools/src/npdet_to_step_cli.{h,cxx} New TU containing CLI parsing/help-page logic extracted from npdet_to_step.cxx.
src/tools/src/settings.h Add inline ensure_step_extension helper for .stp suffix handling.
src/tools/tests/CMakeLists.txt Replace simple Catch test with unit_settings and two npdet_to_step integration tests using PASS_REGULAR_EXPRESSION.
src/tools/tests/unit_settings.cxx Unit test for ensure_step_extension covering several filename shapes.
src/tools/tests/simple.cxx Remove obsolete Catch-based placeholder test.
src/geocad/CMakeLists.txt Add tests subdir under BUILD_TESTING.
src/geocad/tests/CMakeLists.txt Define unit/integration test executables linked against GeoCad and register add_test.
src/geocad/tests/unit_partial_tree.cxx Exercise TOCCToStep::OCCPartialTreeCreation on a synthetic TGeo tree.
src/geocad/tests/integration_create_step.cxx Build a synthetic TGeo geometry, run TGeoToStep::CreateGeometry, and verify a non-empty .stp file.

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

@wdconinc wdconinc linked an issue May 18, 2026 that may be closed by this pull request
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.

Note: this repo needs CI.

3 participants