rtla/tests: Add unit test for restoring continue flag

In case an action preceding the continue action fails, not only
the continue flag should not be set, it should be unset if it was set
from a previous run of actions_perform().

Add a unit test to check if this is implemented correctly.

Link: https://lore.kernel.org/r/20260526102523.2662391-2-tglozar@redhat.com
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
This commit is contained in:
Tomas Glozar 2026-05-26 12:25:21 +02:00
parent dd520daffb
commit a92bd1a28b

View File

@ -328,6 +328,18 @@ START_TEST(test_actions_perform_continue_after_failed_shell_command)
}
END_TEST
START_TEST(test_actions_perform_continue_unset_flag)
{
actions_fixture.continue_flag = true;
actions_add_shell(&actions_fixture, "exit 1");
actions_add_continue(&actions_fixture);
ck_assert_int_eq(actions_perform(&actions_fixture), 1 << 8);
ck_assert(!actions_fixture.continue_flag);
}
END_TEST
Suite *actions_suite(void)
{
Suite *s = suite_create("actions");
@ -374,6 +386,7 @@ Suite *actions_suite(void)
tcase_add_test(tc, test_actions_perform_continue);
tcase_add_test(tc, test_actions_perform_continue_after_successful_shell_command);
tcase_add_test(tc, test_actions_perform_continue_after_failed_shell_command);
tcase_add_test(tc, test_actions_perform_continue_unset_flag);
suite_add_tcase(s, tc);
return s;