CTest --show-only interaction with CTEST_CUSTOM_POST_TEST

Hi folks,

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