# CTest –show-only interaction with CTEST\_CUSTOM\_POST\_TEST

**URL:** https://discourse.cmake.org/t/ctest-show-only-interaction-with-ctest-custom-post-test/3418
**Category:** Development
**Created:** [May 26, 2021, 2:25pm UTC](https://discourse.cmake.org/t/ctest-show-only-interaction-with-ctest-custom-post-test/3418 "2021-05-26T14:25:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rleigh](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/9de053/32.png) [@rleigh](https://discourse.cmake.org/u/rleigh)
#### Post date: [May 26, 2021, 2:25pm UTC](https://discourse.cmake.org/t/ctest-show-only-interaction-with-ctest-custom-post-test/3418/1 "2021-05-26T14:25:04Z")

</div>

Hi folks,

I originally posted this to the usage forum, but didn’t get any response ([post](https://discourse.cmake.org/t/ctest-show-only-interaction-with-ctest-custom-post-test/3309)). 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`:

```auto
  "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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 26, 2021, 5:28pm UTC](https://discourse.cmake.org/t/ctest-show-only-interaction-with-ctest-custom-post-test/3418/2 "2021-05-26T17:28:49Z")

</div>

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.
