1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: ftrace - function trace on module
4# requires: set_ftrace_filter
5
6: "mod: allows to filter a non exist function"
7echo 'non_exist_func:mod:non_exist_module' > set_ftrace_filter
8grep -q "non_exist_func" set_ftrace_filter
9
10: "mod: on exist module"
11echo '*:mod:trace_printk' > set_ftrace_filter
12if ! modprobe trace-printk ; then
13  echo "No trace-printk sample module - please make CONFIG_SAMPLE_TRACE_PRINTK=
14m"
15  exit_unresolved;
16fi
17
18: "Wildcard should be resolved after loading module"
19grep -q "trace_printk_irq_work" set_ftrace_filter
20
21: "After removing the filter becomes empty"
22rmmod trace_printk
23test `cat set_ftrace_filter | wc -l` -eq 0
24