CTest –show-only interaction with CTEST_CUSTOM_POST_TEST

Hi folks,

I originally posted this to the usage forum, but didn’t get any response (post). However, this looks very much like an unintended bug, so I’d like to run this past you.

I’ve had failures running ctest within CLion. It turns out this is due to an interaction between “–show-only=json-v1” and “CTEST_CUSTOM_POST_TEST”:

ctest --show-only=json-v1:

  "version" :
  {
    "major" : 1,
    "minor" : 0
  }
}------------------------------------------------------------------------------
GCC Code Coverage Report

As you can see, the JSON output was fine, but it was concatenated with the script I use to provide global coverage metrics (for all tests run) as a post-test action.

Should ctest be running post-test actions when “show-only”? Is that a bug or an intentional design choice?

Is there any way of disabling post-test script execution when running --show-only? Alternatively, is there any way of determining that I am running in “show only” mode within the post-test script, so I can skip output in this situation either within CTestCustom.cmake or my post-test script?

Internally, I can see that ctest has a Quiet member variable, but I don’t see this propagated to the script environment, nor any self-test-related variable? Is this the case? Should this execution behaviour setting be propagated to the script environment if this is not already the case?

Many thanks,
Roger

State tracking in CTest isn’t the greatest. I have no idea if it is intended (it’s probably just an artifact of organic changes over time), but not munging the output together should at least be done.