Skip to content

Draft: Prefix target and test names in dune_add_test with the project name automatically

Simon Praetorius requested to merge feature/prefix-test-names into master

This MR addresses partially the issue #377 about possible name clashes in our test suite, especially if we combine multiple modules into a superbuild or let the modules be consumed by other packages. The MR adds a prefix <packageName>. to all test names and <packaeName>_ to all target names created inside the dune_add_test function.

Note that this might crash the test suite in downstream modules. Sometimes it is necessary to add more property/flags to a target created by dune_add_test. Thus, the new generated target name can now be exported from that command by the additional output parameter OUTPUT_TARGET <targetName>. This is different from the input TARGET parameter. (I would be possible to combine input and output and check whether a given target already exists, but this might not be so ouserfriendly - correct me if I am wrong)

Since this requires a change in downstream modules cmake code, the MR also defined a dune policy DP0001 to prevent from activating this change in downstream modules automatically. The changes thus have only an effect on dune-common if not stated otherwise in downstream modules. In order to do so, the downstream main CMakeLists.txt file needs to add a line

dune_policy(SET DP0001 NEW) # or OLD to just silence the warning

Merge request reports

Loading