Commit 43c9dd8d authored by Carles Pey's avatar Carles Pey Committed by Steven Rostedt (VMware)

ftrace: Add unit test for removing trace function

A self test is provided for the trace function removal functionality.

Link: https://lkml.kernel.org/r/20210918153043.318016-2-carles.pey@gmail.comSigned-off-by: default avatarCarles Pey <carles.pey@gmail.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 4ee1b4ca
......@@ -287,6 +287,40 @@ static int trace_selftest_ops(struct trace_array *tr, int cnt)
if (trace_selftest_test_probe3_cnt != 4)
goto out_free;
/* Remove trace function from probe 3 */
func1_name = "!" __stringify(DYN_FTRACE_TEST_NAME);
len1 = strlen(func1_name);
ftrace_set_filter(&test_probe3, func1_name, len1, 0);
DYN_FTRACE_TEST_NAME();
print_counts();
if (trace_selftest_test_probe1_cnt != 3)
goto out_free;
if (trace_selftest_test_probe2_cnt != 2)
goto out_free;
if (trace_selftest_test_probe3_cnt != 4)
goto out_free;
if (cnt > 1) {
if (trace_selftest_test_global_cnt == 0)
goto out_free;
}
if (trace_selftest_test_dyn_cnt == 0)
goto out_free;
DYN_FTRACE_TEST_NAME2();
print_counts();
if (trace_selftest_test_probe1_cnt != 3)
goto out_free;
if (trace_selftest_test_probe2_cnt != 3)
goto out_free;
if (trace_selftest_test_probe3_cnt != 5)
goto out_free;
ret = 0;
out_free:
unregister_ftrace_function(dyn_ops);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment