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.

Signed-off-by: Tomas Glozar <[email protected]>
---

Depends on "rtla/tests: Add unit tests for actions module"
- 
https://lore.kernel.org/linux-trace-kernel/[email protected]/

 tools/tracing/rtla/tests/unit/actions.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/tracing/rtla/tests/unit/actions.c 
b/tools/tracing/rtla/tests/unit/actions.c
index a5808ab71a4d..94ad5ad42774 100644
--- a/tools/tracing/rtla/tests/unit/actions.c
+++ b/tools/tracing/rtla/tests/unit/actions.c
@@ -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;
-- 
2.54.0


Reply via email to