Skip to content

test(sysrap): convert stree_load_test to ctest and harden GDML-fixture coverage#405

Open
plexoos wants to merge 3 commits into
mainfrom
unwrap-csg
Open

test(sysrap): convert stree_load_test to ctest and harden GDML-fixture coverage#405
plexoos wants to merge 3 commits into
mainfrom
unwrap-csg

Conversation

@plexoos

@plexoos plexoos commented Jul 8, 2026

Copy link
Copy Markdown
Member

Turn sysrap/tests/stree_load_test.cc into a regular CMake/ctest target that builds stree directly from a checked-in
GDML fixture, and harden its broad inspection modes so they run safely on the small default geometry.

Why

stree_load_test was previously a developer-only helper with shell-script setup and external geometry assumptions. That
made it hard to run in CI and brittle when exercised against a minimal fixture.

This change makes the test self-contained, ctest-friendly, and more robust across geometries.

What Changed

  • register stree_load_test as a normal CMake/ctest target in sysrap/tests/CMakeLists.txt
  • construct stree in-process from a checked-in GDML fixture via U4GDML and U4Tree
  • use tests/geom/sphere_leak.gdml as the default fixture geometry
  • restore 'N' support in stree::pick_lvid_ordinal_node(...) so full-node lookups continue to work with existing callers
  • harden TEST=ALL and related inspection paths to skip geometry-specific probes when the default fixture does not provide the expected solid names
  • make MOI/TMPFOLD-dependent paths degrade gracefully instead of aborting
  • clamp small-vector scans and guard factor-dependent probes for tiny fixture geometries
  • clean up stale test-runner references/comments

Result

stree_load_test can now be run directly under ctest without external shell setup, and TEST=ALL no longer aborts on
the default small GDML fixture.

Validation

  • ctest --test-dir build -R SysRapTest.stree_load_test
  • TEST=ALL ctest --test-dir build -R SysRapTest.stree_load_test -V

plexoos added 3 commits July 7, 2026 20:54
- build stree_load_test with CMake and register it in ctest
- construct stree directly from a checked-in GDML fixture via U4
- remove the old bash runner and update related references
Restore support for ridx_type 'N' in stree::pick_lvid_ordinal_node so callers can query the full nds vector again.

This aligns the public selector with the rest of stree, which still uses 'N' for full structural-node searches, and prevents TEST=ALL style sweeps from aborting when they exercise the existing full-node path.
Make stree_load_test degrade gracefully when it runs against the small default GDML fixture instead of a JUNO-scale geometry.

- skip soname-dependent probes when the requested solids are absent
- treat missing MOI and TMPFOLD context as skippable test setup, not hard failures
- clamp small-vector AABB scans to valid bounds
- skip factor dumps when the current geometry has no factors

This keeps TEST=ALL useful as a portability sweep while preserving the richer branches for geometries that provide the expected names and structure.
Copilot AI review requested due to automatic review settings July 8, 2026 18:58
@plexoos plexoos added the test label Jul 8, 2026
@plexoos plexoos self-assigned this Jul 8, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d7f308fe7d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

foreach(SRC ${STREE_GDML_TEST_SOURCE})
get_filename_component(TGT ${SRC} NAME_WE)
add_executable(${TGT} ${SRC})
target_compile_definitions(${TGT} PRIVATE STREE_LOAD_TEST_DEFAULT_GDML="${CMAKE_SOURCE_DIR}/tests/geom/sphere_leak.gdml")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use the project source dir for the GDML fixture

When Simphony is included from another project with add_subdirectory() and that parent enables tests, this points at the parent's tests/geom/sphere_leak.gdml rather than Simphony's fixture; CMake documents CMAKE_SOURCE_DIR as the top-level source tree. In that context the new ctest target is compiled with a non-existent default GDML path, so U4GDML::Read returns null and the default desc run later dereferences st. Use this project's source directory (for example PROJECT_SOURCE_DIR here) or a path relative to CMAKE_CURRENT_SOURCE_DIR instead.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 turns sysrap/tests/stree_load_test.cc into a ctest-managed executable that can build a stree directly from a checked-in GDML fixture (via U4/Geant4), and hardens multiple “broad inspection” code paths so they don’t abort on the small default fixture geometry.

Changes:

  • Register stree_load_test as a standard CMake/ctest target and compile in a default GDML fixture path.
  • Update stree_load_test to construct stree from GDML in-process (and add multiple guards/skips for fixture-limited geometries and env-dependent modes).
  • Restore 'N' support in stree::pick_lvid_ordinal_node(...) to enable full-node lookups.

Reviewed changes

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

File Description
sysrap/tests/stree_load_test.cc Converts to a ctest-friendly executable that loads stree from a GDML fixture and adds multiple safety guards/skips.
sysrap/tests/CMakeLists.txt Adds a dedicated ctest target for stree_load_test with a compiled-in default GDML fixture path and U4 linkage.
sysrap/stree.h Restores/extends pick_lvid_ordinal_node to accept 'N' for full nds searches.
CSG/CSGImport.h Removes a large header comment block (documentation cleanup).

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

Comment on lines 1000 to 1004
{
stree_load_test t;
OPTICKS_LOG(argc, argv);

stree_load_test t(argc, argv);
return t.main();
Comment on lines 864 to 865
const glm::tmat4x4<double>& gtd = st->gtd[nidx] ;
std::cout << "gtd\n" << stra<double>::Desc(m2w) << "\n" ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants