eth-cscs / DLA-Future

DLA-Future
https://eth-cscs.github.io/DLA-Future/master/
BSD 3-Clause "New" or "Revised" License
64 stars 14 forks source link

CMake problem with C_API tests and config.h dynamic file #1115

Closed albestro closed 6 months ago

albestro commented 7 months ago

test/unit/c_api/eigensolver contains two different tests

and both relies on the same test/unit/c_api/eigensolver/config.h.

This file is dynamically generated at configure time by each one of the test target above https://github.com/eth-cscs/DLA-Future/blob/e564e88ba775c28530a73fedbbb05a2ca010789a/cmake/DLAF_AddTest.cmake#L211-L213

So, it gets called two times to generate just one file. This is a problem, since it should generate two different files, each one customised for the related target.

https://github.com/eth-cscs/DLA-Future/blob/e564e88ba775c28530a73fedbbb05a2ca010789a/test/include/dlaf_c_test/config.h.in#L20-L28

Instead, in the end just the last one that is generated (at configure time) is used, i.e. gen_eigensolver (because it is listed as last entry).

This was discovered by @rasolca who was getting these two tests rebuilt each time the CMake project was reconfigured. This does not apply to the other similar test (cholesky c_api) because it does not compete with anyone else on that file.

@RMeli not sure if this has any impact on tests.

RMeli commented 7 months ago

Ooof, well spotted! This issue should have no impact on the tests, since PIKA_EXTRA_ARGS_LIST_CAPI is the same for both targets. The only "problem" is that the name passed to pika and DLAF (first element of *_argv) is wrong for one target (the first one).