# Possible to exclude ctest label from "default" ctest execution?

**URL:** https://discourse.cmake.org/t/possible-to-exclude-ctest-label-from-default-ctest-execution/10392
**Category:** Usage
**Tags:** tool:ctest
**Created:** [March 18, 2024, 2:38pm UTC](https://discourse.cmake.org/t/possible-to-exclude-ctest-label-from-default-ctest-execution/10392 "2024-03-18T14:38:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mathomp4](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathomp4/32/176_2.png) [@mathomp4](https://discourse.cmake.org/u/mathomp4)
#### Post date: [March 18, 2024, 2:38pm UTC](https://discourse.cmake.org/t/possible-to-exclude-ctest-label-from-default-ctest-execution/10392/1 "2024-03-18T14:38:03Z")

</div>

I was wondering if it is possible to exclude some ctest labels from the “default” ctest execution. That is when I run:

```auto
ctest

```

it would _not_ run some tests?

I ask because in our code we have some tests that are “big”. For example, one test uses 216 cores and on our cluster, we often have that many cores when we run interactively because our full model will need it.

We have a label for this, let’s call it `BIG` here, so when we do our CI we do:

```auto
ctest -LE 'BIG'...

```

and so we don’t blow up the CI instance. (Note: we don’t use this for CI at all, but ctest is so nice and we have like 50 tests that we’ve added with ctest that has helped a lot in keeping things from breaking in edge cases.)

But, this layer is often developed on laptops and `mpirun -oversubscribe -np 216` is not usually a happy time for a laptop. 😃 But we sort of have muscle memory to run `ctest` rather than always remembering the `-LE` bit.

So, I wondered, is there a way to make a label not run with `ctest` unless explicitly asked for? We’d much prefer to just run BIG tests on our cluster when needed but by default run our quick ones.

I can think of ways to do this via cmake `option()` but I don’t want to make whether some tests are built a build-time decision since, well, the test builds. It just can’t run on some machines.

---

<div class="post-metadata">

### Author: ![kisielk](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kisielk/32/2765_2.png) [@kisielk](https://discourse.cmake.org/u/kisielk)
#### Post date: [March 19, 2024, 11:34pm UTC](https://discourse.cmake.org/t/possible-to-exclude-ctest-label-from-default-ctest-execution/10392/2 "2024-03-19T23:34:56Z")

</div>

Use test presets in `CMakePresets.json` and the exclude feature, and then run `ctest --preset MyPreset`
