diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2018-08-30 10:25:39 -0400 |
---|---|---|
committer | Shuah Khan (Samsung OSG) <shuah@kernel.org> | 2018-10-24 16:49:36 -0400 |
commit | 8ffade754bdf8350f63792c6125346d77f975b41 (patch) | |
tree | 6e34f02f42e3c114518a270642dd1674bbb1f20e /tools/testing | |
parent | c575dea2c1a50306d382615fad06767564734e0b (diff) |
selftests/ftrace: Add ftrace cpumask testcase
Add a testcase for tracing_cpumask with function tracer.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Diffstat (limited to 'tools/testing')
-rw-r--r-- | tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc new file mode 100644 index 000000000000..0e6810743576 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/ftrace/func_cpumask.tc | |||
@@ -0,0 +1,42 @@ | |||
1 | #!/bin/sh | ||
2 | # SPDX-License-Identifier: GPL2.0 | ||
3 | # description: ftrace - function trace with cpumask | ||
4 | |||
5 | if ! which nproc ; then | ||
6 | nproc() { | ||
7 | ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l | ||
8 | } | ||
9 | fi | ||
10 | |||
11 | NP=`nproc` | ||
12 | |||
13 | if [ $NP -eq 1 ] ;then | ||
14 | echo "We can not test cpumask on UP environment" | ||
15 | exit_unresolved | ||
16 | fi | ||
17 | |||
18 | ORIG_CPUMASK=`cat tracing_cpumask` | ||
19 | |||
20 | do_reset() { | ||
21 | echo $ORIG_CPUMASK > tracing_cpumask | ||
22 | } | ||
23 | |||
24 | echo 0 > tracing_on | ||
25 | echo > trace | ||
26 | : "Bitmask only record on CPU1" | ||
27 | echo 2 > tracing_cpumask | ||
28 | MASK=0x`cat tracing_cpumask` | ||
29 | test `printf "%d" $MASK` -eq 2 || do_reset | ||
30 | |||
31 | echo function > current_tracer | ||
32 | echo 1 > tracing_on | ||
33 | (echo "forked") | ||
34 | echo 0 > tracing_on | ||
35 | |||
36 | : "Check CPU1 events are recorded" | ||
37 | grep -q -e "\[001\]" trace || do_reset | ||
38 | |||
39 | : "There should be No other cpu events" | ||
40 | ! grep -qv -e "\[001\]" -e "^#" trace || do_reset | ||
41 | |||
42 | do_reset | ||