CTest - using shortcuts for various CTestTestfile.cmake tests

I can not find how to indicate tags. It should be something like

ADD_TEST( FirstTest RunSomeProgram "withArguments" )
SET_TESTS_PROPERTIES( FirstTest PROPERTIES LABEL "TESTLABEL" )

Can someone tell me how I can set one of these tags, which can be accessed with

ctest -S someScript -L TESTLABEL
+4
source share
1 answer

You are close - the test property is called LABELS, not LABEL.

There are several ways to set tags; the one you selected (using set_tests_properties) has a slight error. Signature:

set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)

, . , , "" CMake, , :

set_tests_properties(FirstTest PROPERTIES LABELS "TESTLABEL;UnitTest;FooModule")

set(Labels TESTLABEL UnitTest FooModule)
set_tests_properties(FirstTest PROPERTIES LABELS "${Labels}")  # Quotes essential


, , set_property:

set_property(TEST FirstTest PROPERTY LABELS TESTLABEL UnitTest FooModule)

set_property(TEST FirstTest PROPERTY LABELS ${Labels})  # No quotes needed

, .

+8

Source: https://habr.com/ru/post/1546594/


All Articles