aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-23 22:37:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-23 22:37:41 -0400
commitd62a0234c87f1457a3d2ba519ef90cf164a5eb23 (patch)
tree96c546e32b0cf3032d39152b62687b4aa6b40906 /tools
parent4496a1d9638644484d0d99e9de63742248f3c119 (diff)
parent6eab37daf0ec1077fd612ff27ab513db20f33767 (diff)
Merge tag 'linux-kselftest-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest updates from Shuah Khan: "This update for Kselftest adds: - a new ftrace testcase - fixes for ftrace and intel_pstate tests" * tag 'linux-kselftest-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: tools: testing: define the _GNU_SOURCE macro kselftests/ftrace: Add a test case for event pid filtering kselftests/ftrace: Detect tracefs mount point
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/selftests/ftrace/ftracetest9
-rw-r--r--tools/testing/selftests/ftrace/test.d/event/event-pid.tc72
-rwxr-xr-xtools/testing/selftests/intel_pstate/run.sh2
3 files changed, 80 insertions, 3 deletions
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index da48812ab95e..4c6a0bf8ba79 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -88,7 +88,12 @@ parse_opts() { # opts
88 88
89# Parameters 89# Parameters
90DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1` 90DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1`
91TRACING_DIR=$DEBUGFS_DIR/tracing 91if [ -z "$DEBUGFS_DIR" ]; then
92 TRACING_DIR=`grep tracefs /proc/mounts | cut -f2 -d' ' | head -1`
93else
94 TRACING_DIR=$DEBUGFS_DIR/tracing
95fi
96
92TOP_DIR=`absdir $0` 97TOP_DIR=`absdir $0`
93TEST_DIR=$TOP_DIR/test.d 98TEST_DIR=$TOP_DIR/test.d
94TEST_CASES=`find_testcases $TEST_DIR` 99TEST_CASES=`find_testcases $TEST_DIR`
@@ -102,7 +107,7 @@ parse_opts $*
102[ $DEBUG -ne 0 ] && set -x 107[ $DEBUG -ne 0 ] && set -x
103 108
104# Verify parameters 109# Verify parameters
105if [ -z "$DEBUGFS_DIR" -o ! -d "$TRACING_DIR" ]; then 110if [ -z "$TRACING_DIR" -o ! -d "$TRACING_DIR" ]; then
106 errexit "No ftrace directory found" 111 errexit "No ftrace directory found"
107fi 112fi
108 113
diff --git a/tools/testing/selftests/ftrace/test.d/event/event-pid.tc b/tools/testing/selftests/ftrace/test.d/event/event-pid.tc
new file mode 100644
index 000000000000..d4ab27b522f8
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/event/event-pid.tc
@@ -0,0 +1,72 @@
1#!/bin/sh
2# description: event tracing - restricts events based on pid
3
4do_reset() {
5 echo > set_event
6 echo > set_event_pid
7 echo 0 > options/event-fork
8 clear_trace
9}
10
11fail() { #msg
12 do_reset
13 echo $1
14 exit $FAIL
15}
16
17yield() {
18 ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
19}
20
21if [ ! -f set_event -o ! -d events/sched ]; then
22 echo "event tracing is not supported"
23 exit_unsupported
24fi
25
26if [ ! -f set_event_pid ]; then
27 echo "event pid filtering is not supported"
28 exit_unsupported
29fi
30
31reset_tracer
32do_reset
33
34echo 1 > events/sched/sched_switch/enable
35
36yield
37
38count=`cat trace | grep sched_switch | wc -l`
39if [ $count -eq 0 ]; then
40 fail "sched_switch events are not recorded"
41fi
42
43do_reset
44
45read mypid rest < /proc/self/stat
46
47echo $mypid > set_event_pid
48echo 'sched:sched_switch' > set_event
49
50yield
51
52count=`cat trace | grep sched_switch | grep -v "pid=$mypid" | wc -l`
53if [ $count -ne 0 ]; then
54 fail "sched_switch events from other task are recorded"
55fi
56
57do_reset
58
59echo $mypid > set_event_pid
60echo 1 > options/event-fork
61echo 1 > events/sched/sched_switch/enable
62
63yield
64
65count=`cat trace | grep sched_switch | grep -v "pid=$mypid" | wc -l`
66if [ $count -eq 0 ]; then
67 fail "sched_switch events from other task are not recorded"
68fi
69
70do_reset
71
72exit 0
diff --git a/tools/testing/selftests/intel_pstate/run.sh b/tools/testing/selftests/intel_pstate/run.sh
index bdaf37e92684..7868c106b8b1 100755
--- a/tools/testing/selftests/intel_pstate/run.sh
+++ b/tools/testing/selftests/intel_pstate/run.sh
@@ -32,7 +32,7 @@ EVALUATE_ONLY=0
32max_cpus=$(($(nproc)-1)) 32max_cpus=$(($(nproc)-1))
33 33
34# compile programs 34# compile programs
35gcc -o aperf aperf.c -lm 35gcc aperf.c -Wall -D_GNU_SOURCE -o aperf -lm
36[ $? -ne 0 ] && echo "Problem compiling aperf.c." && exit 1 36[ $? -ne 0 ] && echo "Problem compiling aperf.c." && exit 1
37gcc -o msr msr.c -lm 37gcc -o msr msr.c -lm
38[ $? -ne 0 ] && echo "Problem compiling msr.c." && exit 1 38[ $? -ne 0 ] && echo "Problem compiling msr.c." && exit 1