fix: ensure tests get valid LD_LIBRARY_PATH and JANA_PLUGIN_PATH#505
Open
wdconinc wants to merge 1 commit into
Open
fix: ensure tests get valid LD_LIBRARY_PATH and JANA_PLUGIN_PATH#505wdconinc wants to merge 1 commit into
wdconinc wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates CMake/CTest configuration so plugin- and library-related tests can run successfully from the build tree by setting runtime environment variables and aligning output locations.
Changes:
- Adds
ENVIRONMENTto multipleadd_test()entries to setJANA_PLUGIN_PATHandLD_LIBRARY_PATH. - Adjusts plugin library output directory to a consistent build-tree plugins folder.
- Updates
add_jana_test/add_jana_library/add_jana_pluginmacros to attach runtime environment configuration to tests.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugins/janadot/CMakeLists.txt | Sets test environment so janadot plugin tests can find plugins/libs in build tree |
| src/plugins/JTest/CMakeLists.txt | Sets test environment so JTest can find plugins/libs in build tree |
| src/examples/tutorial_with_lightweight_datamodel/05_csv_file_writer/CMakeLists.txt | Uses built jana target for the test and sets env for plugin/lib discovery |
| src/examples/tutorial_with_lightweight_datamodel/02_random_hit_source/CMakeLists.txt | Sets env for plugin/lib discovery for the example smoketest |
| src/examples/misc/Tutorial/CMakeLists.txt | Sets env for plugin/lib discovery for the example test |
| src/examples/misc/TimesliceExample/CMakeLists.txt | Sets env for plugin/lib discovery for PODIO-dependent example tests |
| src/examples/misc/RootDatamodelExample/CMakeLists.txt | Adds env even though the test is disabled, keeping configuration consistent |
| src/examples/misc/EventGroupExample/CMakeLists.txt | Sets env for plugin/lib discovery for the example test |
| src/examples/misc/DstExample/CMakeLists.txt | Sets env for plugin/lib discovery for the example test |
| cmake/AddJanaTest.cmake | Changes test command invocation and sets LD_LIBRARY_PATH for tests |
| cmake/AddJanaPlugin.cmake | Sets plugin library output dir and attaches env to plugin tests |
| cmake/AddJanaLibrary.cmake | Attaches LD_LIBRARY_PATH env to library tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| install(TARGETS ${test_target_name} RUNTIME DESTINATION bin) | ||
|
|
||
| add_test(NAME ${test_target_name} COMMAND ${CMAKE_INSTALL_PREFIX}/bin/${test_target_name}) | ||
| add_test(NAME ${test_target_name} COMMAND ${test_target_name}) |
| BUILD_WITH_INSTALL_RPATH TRUE | ||
| INSTALL_RPATH_USE_LINK_PATH TRUE | ||
| INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/${INSTALL_NAMESPACE}/plugins" | ||
| LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/JANA/plugins" |
Comment on lines
+104
to
+106
| set_tests_properties(${library_name}_tests PROPERTIES | ||
| ENVIRONMENT "LD_LIBRARY_PATH=$<TARGET_FILE_DIR:${library_name}>:$<TARGET_FILE_DIR:jana2_shared_lib>:$ENV{LD_LIBRARY_PATH}" | ||
| ) |
Comment on lines
13
to
+18
| add_test(NAME examples-lw-00-smoketest COMMAND jana -Pplugins=lw_random_hit_source -Pjana:nevents=10) | ||
|
|
||
| set_tests_properties(examples-lw-00-smoketest PROPERTIES LABELS "examples") | ||
| set_tests_properties(examples-lw-00-smoketest PROPERTIES | ||
| LABELS "examples" | ||
| ENVIRONMENT "JANA_PLUGIN_PATH=${CMAKE_BINARY_DIR}/lib/JANA/plugins;LD_LIBRARY_PATH=$<TARGET_FILE_DIR:jana2_shared_lib>:$ENV{LD_LIBRARY_PATH}" | ||
| ) |
Comment on lines
10
to
16
| COMMAND ${CMAKE_INSTALL_PREFIX}/bin/jana -Pplugins=TimesliceExample -Puse_timeslices=0 -Pjana:nevents=10 events.root) | ||
| set_tests_properties(jana-example-timeslices-simple-tests PROPERTIES | ||
| ENVIRONMENT "JANA_PLUGIN_PATH=${CMAKE_BINARY_DIR}/lib/JANA/plugins;LD_LIBRARY_PATH=$<TARGET_FILE_DIR:jana2_shared_lib>:$ENV{LD_LIBRARY_PATH}" | ||
| ) | ||
|
|
||
| add_test(NAME jana-example-timeslices-complex-tests | ||
| COMMAND ${CMAKE_INSTALL_PREFIX}/bin/jana -Pplugins=TimesliceExample -Puse_timeslices=1 -Pjana:nevents=10 timeslices.root) |
Comment on lines
+7
to
+8
| set_tests_properties(jana-plugin-jtest-tests PROPERTIES | ||
| ENVIRONMENT "JANA_PLUGIN_PATH=${CMAKE_BINARY_DIR}/lib/JANA/plugins;LD_LIBRARY_PATH=$<TARGET_FILE_DIR:jana2_shared_lib>:$ENV{LD_LIBRARY_PATH}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR ensures that the test environment gets the correct (build-time) LD_LIBRARY_PATH and JANA_PLUGIN_PATH so tests don't use stale installed versions.