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

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

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:

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. :smiley: 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.

2 Likes

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

1 Like