diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-23 22:37:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-23 22:37:41 -0400 |
commit | d62a0234c87f1457a3d2ba519ef90cf164a5eb23 (patch) | |
tree | 96c546e32b0cf3032d39152b62687b4aa6b40906 /tools | |
parent | 4496a1d9638644484d0d99e9de63742248f3c119 (diff) | |
parent | 6eab37daf0ec1077fd612ff27ab513db20f33767 (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-x | tools/testing/selftests/ftrace/ftracetest | 9 | ||||
-rw-r--r-- | tools/testing/selftests/ftrace/test.d/event/event-pid.tc | 72 | ||||
-rwxr-xr-x | tools/testing/selftests/intel_pstate/run.sh | 2 |
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 |
90 | DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1` | 90 | DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1` |
91 | TRACING_DIR=$DEBUGFS_DIR/tracing | 91 | if [ -z "$DEBUGFS_DIR" ]; then |
92 | TRACING_DIR=`grep tracefs /proc/mounts | cut -f2 -d' ' | head -1` | ||
93 | else | ||
94 | TRACING_DIR=$DEBUGFS_DIR/tracing | ||
95 | fi | ||
96 | |||
92 | TOP_DIR=`absdir $0` | 97 | TOP_DIR=`absdir $0` |
93 | TEST_DIR=$TOP_DIR/test.d | 98 | TEST_DIR=$TOP_DIR/test.d |
94 | TEST_CASES=`find_testcases $TEST_DIR` | 99 | TEST_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 |
105 | if [ -z "$DEBUGFS_DIR" -o ! -d "$TRACING_DIR" ]; then | 110 | if [ -z "$TRACING_DIR" -o ! -d "$TRACING_DIR" ]; then |
106 | errexit "No ftrace directory found" | 111 | errexit "No ftrace directory found" |
107 | fi | 112 | fi |
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 | |||
4 | do_reset() { | ||
5 | echo > set_event | ||
6 | echo > set_event_pid | ||
7 | echo 0 > options/event-fork | ||
8 | clear_trace | ||
9 | } | ||
10 | |||
11 | fail() { #msg | ||
12 | do_reset | ||
13 | echo $1 | ||
14 | exit $FAIL | ||
15 | } | ||
16 | |||
17 | yield() { | ||
18 | ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1 | ||
19 | } | ||
20 | |||
21 | if [ ! -f set_event -o ! -d events/sched ]; then | ||
22 | echo "event tracing is not supported" | ||
23 | exit_unsupported | ||
24 | fi | ||
25 | |||
26 | if [ ! -f set_event_pid ]; then | ||
27 | echo "event pid filtering is not supported" | ||
28 | exit_unsupported | ||
29 | fi | ||
30 | |||
31 | reset_tracer | ||
32 | do_reset | ||
33 | |||
34 | echo 1 > events/sched/sched_switch/enable | ||
35 | |||
36 | yield | ||
37 | |||
38 | count=`cat trace | grep sched_switch | wc -l` | ||
39 | if [ $count -eq 0 ]; then | ||
40 | fail "sched_switch events are not recorded" | ||
41 | fi | ||
42 | |||
43 | do_reset | ||
44 | |||
45 | read mypid rest < /proc/self/stat | ||
46 | |||
47 | echo $mypid > set_event_pid | ||
48 | echo 'sched:sched_switch' > set_event | ||
49 | |||
50 | yield | ||
51 | |||
52 | count=`cat trace | grep sched_switch | grep -v "pid=$mypid" | wc -l` | ||
53 | if [ $count -ne 0 ]; then | ||
54 | fail "sched_switch events from other task are recorded" | ||
55 | fi | ||
56 | |||
57 | do_reset | ||
58 | |||
59 | echo $mypid > set_event_pid | ||
60 | echo 1 > options/event-fork | ||
61 | echo 1 > events/sched/sched_switch/enable | ||
62 | |||
63 | yield | ||
64 | |||
65 | count=`cat trace | grep sched_switch | grep -v "pid=$mypid" | wc -l` | ||
66 | if [ $count -eq 0 ]; then | ||
67 | fail "sched_switch events from other task are not recorded" | ||
68 | fi | ||
69 | |||
70 | do_reset | ||
71 | |||
72 | exit 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 | |||
32 | max_cpus=$(($(nproc)-1)) | 32 | max_cpus=$(($(nproc)-1)) |
33 | 33 | ||
34 | # compile programs | 34 | # compile programs |
35 | gcc -o aperf aperf.c -lm | 35 | gcc 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 |
37 | gcc -o msr msr.c -lm | 37 | gcc -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 |