Respect path order of DL_PATHS in catch_discover_tests#2878
Merged
horenmar merged 1 commit intocatchorg:develfrom Aug 13, 2024
Merged
Respect path order of DL_PATHS in catch_discover_tests#2878horenmar merged 1 commit intocatchorg:develfrom
horenmar merged 1 commit intocatchorg:develfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #2878 +/- ##
==========================================
+ Coverage 91.10% 91.11% +0.01%
==========================================
Files 198 198
Lines 8493 8493
==========================================
+ Hits 7737 7738 +1
+ Misses 756 755 -1 |
288a50d to
18b84a4
Compare
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.
Description
In
catch_discover_testsfunction, theDL_PATHSopition is used to specify the directories of the dependent shared libraries. The specified paths are used in the function to setup the environment for (1) retrieving the list of test cases from the text executable and for (2) executing the tests.With current implementation, given
DL_PATHSis specified, the prepared execution environments are inconsistent between (1) and (2), and the order of the paths specified by theDL_PATHSfor searching libraries is not respected as well.This PR tweak the
catch_discover_tests_implfunction, so that the execution environments are made consistent and the order of the search paths specified byDL_PATHSare respected.Detail
Current behavior
The code for modifing the execution environment for (1) is shown as below, where the original value of environment variable is discarded and its value is overwrited by the specified
DL_PATHS.The code for modifing the execution environment for (2) is shown as follows, the paths in the
DL_PATHSare transformed to the perform thepath_list_prependcommand for each specified path in order, which resulting in the order of searchingDL_PATHSbeing reversed, and follows the searching order of the original values from the environment.For example, when running on Windows, the environment variable for searching dependent shared libraries is
PATH(i.e.dl_paths_variable_nameis setted toPATH).Given
PATH=/path/to/dir/C;/path/to/dir/D, andDL_PATHS=/path/to/dir/A;/path/to/dir/BWe could see that under the current implementation,
PATH=/path/to/dir/A;/path/to/dir/BPATH=/path/to/dir/B;/path/to/dir/A;/path/to/dir/C;/path/to/dir/DWhich are inconsistent, and the specified order is not respected.
Proposed behavior
The code for (1) is modified such that the
DL_PATHSis prepend before the original paths, instead of overwriting the original values.The code for (2) has been modified so that the commands in
environment_modificationsfollow a "first path, last prepend" order. This ensures that the finding procedure would first search the paths inDL_PATHSwith the specified order, followed by the paths from the original environment.For example, given that
PATH=/path/to/dir/C;/path/to/dir/D, andDL_PATHS=/path/to/dir/A;/path/to/dir/BWith the proposed implementation, the modified environment for (1) and (2) becomes:
PATH=/path/to/dir/A;/path/to/dir/B;/path/to/dir/C;/path/to/dir/DThe paths order are respected and the execution environments are made consistent.