# CTEST\_CUSTOM\_POST\_TEST runs when doing "ctest -N"

**URL:** https://discourse.cmake.org/t/ctest-custom-post-test-runs-when-doing-ctest-n/5066
**Category:** Usage
**Tags:** tool:ctest
**Created:** [February 19, 2022, 11:54am UTC](https://discourse.cmake.org/t/ctest-custom-post-test-runs-when-doing-ctest-n/5066 "2022-02-19T11:54:50Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![janhieber](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@janhieber](https://discourse.cmake.org/u/janhieber)
#### Post date: [February 19, 2022, 11:54am UTC](https://discourse.cmake.org/t/ctest-custom-post-test-runs-when-doing-ctest-n/5066/1 "2022-02-19T11:54:50Z")

</div>

I use `CTEST_CUSTOM_POST_TEST` in `CTestCustom.cmake` to do postprocessing of tests.

My problem is that these commands are even executed when I do `ctest -N` to list available tests.

Is this intended? Is there a ways to prevent this?

---

<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: [February 20, 2022, 2:17pm UTC](https://discourse.cmake.org/t/ctest-custom-post-test-runs-when-doing-ctest-n/5066/2 "2022-02-20T14:17:58Z")

</div>

I don’t see a way to prevent it. It doesn’t seem intended, but I also see zero tests for this behavior either…

Cc: @brad.king @zackgalbreath

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [February 22, 2022, 8:57pm UTC](https://discourse.cmake.org/t/ctest-custom-post-test-runs-when-doing-ctest-n/5066/3 "2022-02-22T20:57:40Z")

</div>

I’d welcome a fix to not run post-test processing when we don’t actually run the tests.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [February 22, 2022, 9:12pm UTC](https://discourse.cmake.org/t/ctest-custom-post-test-runs-when-doing-ctest-n/5066/4 "2022-02-22T21:12:58Z")

</div>

This was also reported as [CMake Issue 23254](https://gitlab.kitware.com/cmake/cmake/-/issues/23254).

---

<div class="post-metadata">

### Author: ![janhieber](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@janhieber](https://discourse.cmake.org/u/janhieber)
#### Post date: [February 25, 2022, 12:30pm UTC](https://discourse.cmake.org/t/ctest-custom-post-test-runs-when-doing-ctest-n/5066/5 "2022-02-25T12:30:59Z")

</div>

Thanks for the fast answer!  
I no chose a different way and execute my post-processing in a test script wrapper.
