0

Catch2 can add label to each test case,e.g

testf.cpp:

TEST_CASE("test function","[part-1]")

Then using the command line, we can specify only to run part-1

./testf [part-1]

So my question is how to achieve the same effect when using ctest. I know ctest may have its own way to label the test cases. But is it possible to just utilize the catch2 label?

I've tried

ctest -C [part-1]

But it doesn't work

starball
  • 20,030
  • 7
  • 43
  • 238
qiu
  • 13
  • 4

1 Answers1

0

You use -L <regex> or --label-regex <regex> to specify label regexes to match. Ex. for what you showed, ctest -L '\[part-1\]'. See also -E <regex>, --exclude-regex <regex> ("This option tells CTest to NOT run the tests whose names match the given regular expression.") and -LE <regex>, --label-exclude <regex> ("This option tells CTest to NOT run the tests whose labels match the given regular expression.") and the label matching docs.

starball
  • 20,030
  • 7
  • 43
  • 238