Skip to content

Dune test macro broken for skipped test

Commit a225b2da introduces a new handling for setting the test command, which apparently fixes something on Windows. However this commit breaks the following, in my opinion valid usage:

dune_add_test(NAME bla
              SOURCES bla.cc
              COMMAND ./bla
              CMAKE_GUARD HAVE_BLA)

If this test is skipped the command will be ./bla but it is set as TARGET_FILE which yields the following error:

-- Configuring done
CMake Error at DuneTestMacros.cmake:398 (_add_test):
  Error evaluating generator expression:

    $<TARGET_FILE:./bla>

Even worse, this will also happen if the test is executed via a script -- a very common usage:

-- Configuring done
CMake Error at DuneTestMacros.cmake:398 (_add_test):
  Error evaluating generator expression:

    $<TARGET_FILE:/home/bla/mytestscript.py>

For example the Dumux build suite currently fails with dune master on configure because of these cases: https://git.iws.uni-stuttgart.de/buildbot/#/builders/2/builds/38

Edited by Timo Koch