[cmake-developers] set_test_properties ignoring multiple properties

Ben Boeckel ben.boeckel at kitware.com
Tue Mar 8 17:33:27 EST 2016


On Tue, Mar 08, 2016 at 14:36:38 -0700, Kael Dai wrote:
> I have a test that outputs multiple lines and want to use
> set_tests_properties with the PASS_REGULAR_EXPRESSION property to check
> different lines in the output. I've tried doing
> 
> set_tests_properties(test1 PROPERTIES PASS_REGULAR_EXPRESSION "value1"
> PASS_REGULAR_EXPRESSION "value2")
> 
> I've also tried to split up the properties
> 
> set_tests_properties(test1 PROPERTIES PASS_REGULAR_EXPRESSION "value1")
> set_tests_properties(test1 PROPERTIES PASS_REGULAR_EXPRESSION "value2")
> 
> In both cases, ctest is ignoring the test of "value1" and only checking if
> "value2" passes or not.

Right, PASS_REGULAR_EXPRESSION is being set to "value1" and then to
"value2". You can use set_property(TEST test1 APPEND) to append "value2"
to the existing property value (or use "value1;value2" to set it at
once).

> Is there any way to check multiple regular expression on the same test and
> check them all? The documentation for 3.1 seems to suggest you can, but it
> isn't working when building the tests.

If any one matches, the test is considered to have passed. Maybe you
want "value1.*value2;value2.*value1"?

--Ben


More information about the cmake-developers mailing list