[cmake][dune_add_test] Set test property to depend on existence of target
If the target was not found in the current state the test fails. With this patch the ctest states "Not Run" and the name of the missing target.
Instead of
Start 4: test_stokes2cni_advection
4/5 Test #4: test_stokes2cni_advection ........***Failed 0.04 sec
it now prints the more informative
Start 4: test_stokes2cni_advection
Unable to find required file: test_stokes2cni
4/5 Test #4: test_stokes2cni_advection .........***Not Run 0.00 sec
Fixes #100 (closed).
Merge request reports
Activity
mentioned in issue #100 (closed)
I always assumed that failing was intended. "Not run" sounds a little bit like "skipped", i.e. you are missing optional dependencies that are required to run that test. Failing to build the tests seems like a user error -- i.e. there should be an error reported. Will "not run" still lead to ctest exiting with non-zero status?
Or does this maybe lead to ctest being able to automatically build the test in question, perhaps with some extra command line option? That would make this definitely worthwhile.
Oh, I think I get it now.
This is about the case when the test is run through a complicated command, like !405 (merged). If the test simply runs the target, cmake already reports "***Not run", is that right?
So this would simply lead to uniform behaviour, whether the test is run through a script or not, correct?
mentioned in commit 27af4005
mentioned in commit 468d6951
mentioned in merge request !413 (merged)
mentioned in merge request !557 (merged)
mentioned in commit 1abc2328
mentioned in commit 6ba9e6dc