<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 16, 2019 at 11:36 PM Sergei Nikulov <<a href="mailto:sergey.nikulov@gmail.com">sergey.nikulov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">><br>
> On Tue, Apr 16, 2019 at 10:07 PM Sergei Nikulov <<a href="mailto:sergey.nikulov@gmail.com" target="_blank">sergey.nikulov@gmail.com</a>> wrote:<br>
>><br>
>> Hello All,<br>
>><br>
>> Has anybody knows how FIXTURES_SETUP/FIXTURES_CLEANUP should work with<br>
>> --repeat-until-fail <n> option?<br>
>><br>
>> My expectation, if I requesting a test run for example 10 times, the<br>
>> sequence should be as follows:<br>
>><br>
>> fixture_setup, then test, then fixture_cleanup repeats 10 times<br>
>><br>
>> But in practice, I've got following sequence<br>
>><br>
>> 1. fixture_setup runs 10 times<br>
>> 2. test runs 10 times<br>
>> 3. fixture_cleanup runs 10 times<br>
>><br>
>> Is it expected behavior?<br>
>> I'm using ctest version 3.14.2<br>
><br>
><br>
> The documentation for the --repeat-until-fail option says "Require each test to run <n> times without failing in order to pass". A fixture setup or cleanup test is still a test, so they will also be run <n> times. The logic that implements repeating tests sets up a counter on each test and it runs that test <n> times before marking that test as complete. This is why you see fixture_setup run 10 times, then test runs 10 times and lastly fixture_cleanup runs 10 times.<br>
><br>
<br>
I understand that fixture is still a test.<br>
To achieve repeatable behavior -R "test_continues_*" is enough.<br>
<br>
But if it calls FIXTURE why not apply the specific behavior as<br>
expected from fixture (init/teardown)?<br></blockquote></div><div><br></div><div>It's mostly related to the way it is implemented internally. Because a fixture setup/cleanup is still just another test, it has all the features of a regular test, including honouring the option that tells ctest to run it multiple times. For some projects, it may be desirable for the fixture setup/cleanup to run only once but re-run the fixture-requiring test(s) to run multiple times. For other projects, it might be desirable for the fixture setup/cleanup tests to also run multiple times (a setup test might simply be polling a service to confirm it is up, for example). Since ctest cannot know which of the two scenarios the project wants, it simply treats all tests the same, whether they are fixture setup/cleanup tests or not.</div><div><br></div><div>Perhaps one way of dealing with this might be to add a new boolean test property which, when set, has the meaning of "only run once" when the --repeat-until-fail option is used.</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div><div><br></div><div>Get the hand-book for every CMake user: <a href="https://crascit.com/professional-cmake/" target="_blank">Professional CMake: A Practical Guide</a><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>