[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calling an identical setup/teardown for each test in group ?


Hi all,

Is there a way to have an identical setup/teardown which gets executed
for each test in the group? That is without wrapping a macro around
cmocka_unit_test_setup_teardown.

Afaict the current cmocka_run_group_tests allows you to do a once-off
setup/teardown for the whole group, which is great but sadly doesn't
fit my requirements :-( The recent prestate feature on the other hand
seems like it does the opposite (identical test body, different
setup/teardown) yet reading the actual implementation brings be to
believe that's not exactly the case. Can anyone shed some light on the
topic ?

If there isn't a way to handle the above, what would be the better way
to implement this ? A 'quick and dirty' way is to add an extra
argument to cmocka_run_group_tests(..., bool reinit_on_each_test), but
there should be a cleaner way.

Thanks
Emil


Follow-Ups:
Re: Calling an identical setup/teardown for each test in group ?Lukas Slebodnik <lslebodn@xxxxxxxxxx>