aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2018-08-30 10:25:39 -0400
committerShuah Khan (Samsung OSG) <shuah@kernel.org>2018-10-24 16:49:36 -0400
commit8ffade754bdf8350f63792c6125346d77f975b41 (patch)
tree6e34f02f42e3c114518a270642dd1674bbb1f20e /tools/testing
parentc575dea2c1a50306d382615fad06767564734e0b (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.tc42
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
5if ! which nproc ; then
6 nproc() {
7 ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l
8 }
9fi
10
11NP=`nproc`
12
13if [ $NP -eq 1 ] ;then
14 echo "We can not test cpumask on UP environment"
15 exit_unresolved
16fi
17
18ORIG_CPUMASK=`cat tracing_cpumask`
19
20do_reset() {
21 echo $ORIG_CPUMASK > tracing_cpumask
22}
23
24echo 0 > tracing_on
25echo > trace
26: "Bitmask only record on CPU1"
27echo 2 > tracing_cpumask
28MASK=0x`cat tracing_cpumask`
29test `printf "%d" $MASK` -eq 2 || do_reset
30
31echo function > current_tracer
32echo 1 > tracing_on
33(echo "forked")
34echo 0 > tracing_on
35
36: "Check CPU1 events are recorded"
37grep -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
42do_reset