Skip to content
Snippets Groups Projects

dune_add_test: allow target name and target file to be different

Merged Stephan Hilb requested to merge stephan.hilb/dune-common:fix/test-target into master

Merge request reports

Pipeline #14829 passed

Pipeline passed for 2dc4154a on stephan.hilb:fix/test-target

Approval is optional
Ready to merge by members who can write to the target branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • OK, I'm guessing the original stuff does not work on windows because the ctest looks for a file named TEST, but in fact the file is named TEST.exe? Or what exactly is the problem with this MR solves?

    Edited by Jö Fahlke
  • Author Contributor

    Let's say I add a target ${TARGET} compiled from a file ${NAME}.cc and I'd like the executable to be ${NAME}:

    add_executable(${TARGET} ${NAME}.cc ...)
    set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${NAME})
    dune_add_test(NAME ${TEST} TARGET ${TARGET} COMMAND ${TARGET})

    Then it won't run the test, since it adds ${TARGET} as a required file instead of ${NAME}. Note that the property COMMAND actually doesn't change anything here.

  • Author Contributor

    The problem is, that the current code expects an executable with the same name as the target, which might not be true.

  • But I guess you have a particular use case where the two differ... Perhaps you could elaborate?

  • Author Contributor

    I structure my tests in folders such as /test/cat/subcat/subsubcat matching the project structure /cat/subcat/subsubcat. A testcase gets created under the target test-cat-subcat-subsubcat-testcase since it needs to be unique, but I'd like to have the executable file read /test/cat/subcat/subsubcat/testcase instead of /test/cat/subcat/subsubcat/test-cat-subcat-subsubcat-testcase which is currently mandatory in dune_add_test().

  • Right, multiple tests based on the same excutable is a problem on unix too.

    And I guess ctest does handle the generator expression, so this should be fine.

  • merged

  • Jö Fahlke mentioned in commit 51b12f19

    mentioned in commit 51b12f19

Please register or sign in to reply
Loading