]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rtla/tests: Add unit test for restoring continue flag
authorTomas Glozar <tglozar@redhat.com>
Tue, 26 May 2026 10:25:21 +0000 (12:25 +0200)
committerTomas Glozar <tglozar@redhat.com>
Thu, 28 May 2026 11:02:47 +0000 (13:02 +0200)
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>
tools/tracing/rtla/tests/unit/actions.c

index a5808ab71a4d77bcb76bbbf517aa93df583cf92a..94ad5ad42774bf04495fb127b8aad5e446e02205 100644 (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;