Commit e527c470 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Shuah Khan (Samsung OSG)

selftests/ftrace: Remove unneeded per-test init/cleanup ftrace

Since ftracetest framework calls initialize_ftrace() right before
each test and after all tests, we don't need to init/cleanup
ftrace for each test case.
Just remove such unneeded init/cleanup code because it can
increase logfile size.
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarShuah Khan (Samsung OSG) <shuah@kernel.org>
parent 9768cc46
...@@ -9,7 +9,6 @@ do_reset() { ...@@ -9,7 +9,6 @@ do_reset() {
} }
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -23,9 +22,6 @@ if [ ! -f set_event -o ! -d events/sched ]; then ...@@ -23,9 +22,6 @@ if [ ! -f set_event -o ! -d events/sched ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo 'sched:sched_switch' > set_event echo 'sched:sched_switch' > set_event
yield yield
...@@ -57,6 +53,4 @@ if [ $count -ne 0 ]; then ...@@ -57,6 +53,4 @@ if [ $count -ne 0 ]; then
fail "sched_switch events should not be recorded" fail "sched_switch events should not be recorded"
fi fi
do_reset
exit 0 exit 0
...@@ -30,8 +30,7 @@ if [ ! -f set_event_pid ]; then ...@@ -30,8 +30,7 @@ if [ ! -f set_event_pid ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer echo 0 > options/event-fork
do_reset
echo 1 > events/sched/sched_switch/enable echo 1 > events/sched/sched_switch/enable
......
...@@ -9,7 +9,6 @@ do_reset() { ...@@ -9,7 +9,6 @@ do_reset() {
} }
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -23,9 +22,6 @@ if [ ! -f set_event -o ! -d events/sched ]; then ...@@ -23,9 +22,6 @@ if [ ! -f set_event -o ! -d events/sched ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo 'sched:*' > set_event echo 'sched:*' > set_event
yield yield
...@@ -57,6 +53,4 @@ if [ $count -ne 0 ]; then ...@@ -57,6 +53,4 @@ if [ $count -ne 0 ]; then
fail "any of scheduler events should not be recorded" fail "any of scheduler events should not be recorded"
fi fi
do_reset
exit 0 exit 0
...@@ -8,7 +8,6 @@ do_reset() { ...@@ -8,7 +8,6 @@ do_reset() {
} }
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -22,9 +21,6 @@ if [ ! -f available_events -o ! -f set_event -o ! -d events ]; then ...@@ -22,9 +21,6 @@ if [ ! -f available_events -o ! -f set_event -o ! -d events ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo '*:*' > set_event echo '*:*' > set_event
yield yield
...@@ -60,6 +56,4 @@ if [ $count -ne 0 ]; then ...@@ -60,6 +56,4 @@ if [ $count -ne 0 ]; then
fail "any of events should not be recorded" fail "any of events should not be recorded"
fi fi
do_reset
exit 0 exit 0
...@@ -16,13 +16,9 @@ if [ ! -f set_ftrace_filter ]; then ...@@ -16,13 +16,9 @@ if [ ! -f set_ftrace_filter ]; then
fi fi
do_reset() { do_reset() {
reset_tracer
if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then if [ -e /proc/sys/kernel/stack_tracer_enabled ]; then
echo 0 > /proc/sys/kernel/stack_tracer_enabled echo 0 > /proc/sys/kernel/stack_tracer_enabled
fi fi
enable_tracing
clear_trace
echo > set_ftrace_filter
} }
fail() { # msg fail() { # msg
......
...@@ -9,14 +9,7 @@ if ! grep -q function_graph available_tracers; then ...@@ -9,14 +9,7 @@ if ! grep -q function_graph available_tracers; then
exit_unsupported exit_unsupported
fi fi
do_reset() {
reset_tracer
enable_tracing
clear_trace
}
fail() { # msg fail() { # msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -48,6 +41,4 @@ if [ $count -eq 0 ]; then ...@@ -48,6 +41,4 @@ if [ $count -eq 0 ]; then
fail "No schedule traces found?" fail "No schedule traces found?"
fi fi
do_reset
exit 0 exit 0
...@@ -35,12 +35,6 @@ if [ $do_function_fork -eq 1 ]; then ...@@ -35,12 +35,6 @@ if [ $do_function_fork -eq 1 ]; then
fi fi
do_reset() { do_reset() {
reset_tracer
clear_trace
enable_tracing
echo > set_ftrace_filter
echo > set_ftrace_pid
if [ $do_function_fork -eq 0 ]; then if [ $do_function_fork -eq 0 ]; then
return return
fi fi
......
...@@ -25,15 +25,12 @@ do_reset() { ...@@ -25,15 +25,12 @@ do_reset() {
} }
fail() { # mesg fail() { # mesg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
SLEEP_TIME=".1" SLEEP_TIME=".1"
do_reset
echo "Testing function probes with events:" echo "Testing function probes with events:"
EVENT="sched:sched_switch" EVENT="sched:sched_switch"
......
...@@ -29,8 +29,6 @@ if [ ! -f function_profile_enabled ]; then ...@@ -29,8 +29,6 @@ if [ ! -f function_profile_enabled ]; then
fi fi
fail() { # mesg fail() { # mesg
reset_tracer
echo > set_ftrace_filter
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -76,6 +74,4 @@ if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then ...@@ -76,6 +74,4 @@ if ! grep -v -e '^#' -e 'schedule' trace > /dev/null; then
fail "no other functions besides schedule was found" fail "no other functions besides schedule was found"
fi fi
reset_tracer
exit 0 exit 0
...@@ -15,22 +15,11 @@ if [ ! -f set_ftrace_filter ]; then ...@@ -15,22 +15,11 @@ if [ ! -f set_ftrace_filter ]; then
exit_unsupported exit_unsupported
fi fi
do_reset() {
reset_tracer
reset_ftrace_filter
disable_events
clear_trace
enable_tracing
}
fail() { # mesg fail() { # mesg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
do_reset
FILTER=set_ftrace_filter FILTER=set_ftrace_filter
FUNC1="schedule" FUNC1="schedule"
FUNC2="do_softirq" FUNC2="do_softirq"
...@@ -165,6 +154,4 @@ test_actual ...@@ -165,6 +154,4 @@ test_actual
rm $TMPDIR/expected rm $TMPDIR/expected
rm $TMPDIR/actual rm $TMPDIR/actual
do_reset
exit 0 exit 0
...@@ -16,24 +16,13 @@ if [ ! -f set_ftrace_filter ]; then ...@@ -16,24 +16,13 @@ if [ ! -f set_ftrace_filter ]; then
exit_unsupported exit_unsupported
fi fi
do_reset() {
reset_ftrace_filter
reset_tracer
disable_events
clear_trace
enable_tracing
}
fail() { # mesg fail() { # mesg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
SLEEP_TIME=".1" SLEEP_TIME=".1"
do_reset
echo "Testing function probes with enabling disabling tracing:" echo "Testing function probes with enabling disabling tracing:"
cnt_trace() { cnt_trace() {
......
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
[ -f kprobe_events ] || exit_unsupported # this is configurable [ -f kprobe_events ] || exit_unsupported # this is configurable
echo 0 > events/enable
echo > kprobe_events
echo p:myevent _do_fork > kprobe_events echo p:myevent _do_fork > kprobe_events
grep myevent kprobe_events grep myevent kprobe_events
test -d events/kprobes/myevent test -d events/kprobes/myevent
echo > kprobe_events echo > kprobe_events
clear_trace
...@@ -4,12 +4,9 @@ ...@@ -4,12 +4,9 @@
[ -f kprobe_events ] || exit_unsupported [ -f kprobe_events ] || exit_unsupported
echo 0 > events/enable
echo > kprobe_events
echo p:myevent _do_fork > kprobe_events echo p:myevent _do_fork > kprobe_events
test -d events/kprobes/myevent test -d events/kprobes/myevent
echo 1 > events/kprobes/myevent/enable echo 1 > events/kprobes/myevent/enable
echo > kprobe_events && exit_fail # this must fail echo > kprobe_events && exit_fail # this must fail
echo 0 > events/kprobes/myevent/enable echo 0 > events/kprobes/myevent/enable
echo > kprobe_events # this must succeed echo > kprobe_events # this must succeed
clear_trace
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
[ -f kprobe_events ] || exit_unsupported # this is configurable [ -f kprobe_events ] || exit_unsupported # this is configurable
echo 0 > events/enable
echo > kprobe_events
echo 'p:testprobe _do_fork $stack $stack0 +0($stack)' > kprobe_events echo 'p:testprobe _do_fork $stack $stack0 +0($stack)' > kprobe_events
grep testprobe kprobe_events grep testprobe kprobe_events
test -d events/kprobes/testprobe test -d events/kprobes/testprobe
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
[ -f kprobe_events ] || exit_unsupported # this is configurable [ -f kprobe_events ] || exit_unsupported # this is configurable
echo 0 > events/enable
echo > kprobe_events
case `uname -m` in case `uname -m` in
x86_64) x86_64)
ARG1=%di ARG1=%di
...@@ -44,5 +41,3 @@ echo 1 > events/kprobes/testprobe/enable ...@@ -44,5 +41,3 @@ echo 1 > events/kprobes/testprobe/enable
echo "p:test _do_fork" >> kprobe_events echo "p:test _do_fork" >> kprobe_events
grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
echo 0 > events/enable
echo > kprobe_events
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
echo 0 > events/enable
echo > kprobe_events
PROBEFUNC="vfs_read" PROBEFUNC="vfs_read"
GOODREG= GOODREG=
BADREG= BADREG=
...@@ -100,5 +97,3 @@ test_badarg "${GOODREG}::${GOODTYPE}" "${GOODREG}:${BADTYPE}" \ ...@@ -100,5 +97,3 @@ test_badarg "${GOODREG}::${GOODTYPE}" "${GOODREG}:${BADTYPE}" \
test_goodarg "\$comm:string" "+0(\$stack):string" test_goodarg "\$comm:string" "+0(\$stack):string"
test_badarg "\$comm:x64" "\$stack:string" "${GOODREG}:string" test_badarg "\$comm:x64" "\$stack:string" "${GOODREG}:string"
echo > kprobe_events
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue
echo 0 > events/enable
echo > kprobe_events
enable_tracing
echo 'p:testprobe _do_fork $stack0:s32 $stack0:u32 $stack0:x32 $stack0:b8@4/32' > kprobe_events echo 'p:testprobe _do_fork $stack0:s32 $stack0:u32 $stack0:x32 $stack0:b8@4/32' > kprobe_events
grep testprobe kprobe_events grep testprobe kprobe_events
test -d events/kprobes/testprobe test -d events/kprobes/testprobe
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
[ -f kprobe_events ] || exit_unsupported # this is configurable [ -f kprobe_events ] || exit_unsupported # this is configurable
disable_events
echo > kprobe_events
:;: "Add an event on function without name" ;: :;: "Add an event on function without name" ;:
FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "` FUNC=`grep " [tT] .*vfs_read$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "`
...@@ -33,5 +30,3 @@ echo "p $FUNC" > kprobe_events ...@@ -33,5 +30,3 @@ echo "p $FUNC" > kprobe_events
EVENT=`grep $FUNC kprobe_events | cut -f 1 -d " " | cut -f 2 -d:` EVENT=`grep $FUNC kprobe_events | cut -f 1 -d " " | cut -f 2 -d:`
[ "x" != "x$EVENT" ] || exit_failure [ "x" != "x$EVENT" ] || exit_failure
test -d events/$EVENT || exit_failure test -d events/$EVENT || exit_failure
echo > kprobe_events
...@@ -8,8 +8,6 @@ grep function available_tracers || exit_unsupported # this is configurable ...@@ -8,8 +8,6 @@ grep function available_tracers || exit_unsupported # this is configurable
# prepare # prepare
echo nop > current_tracer echo nop > current_tracer
echo _do_fork > set_ftrace_filter echo _do_fork > set_ftrace_filter
echo 0 > events/enable
echo > kprobe_events
echo 'p:testprobe _do_fork' > kprobe_events echo 'p:testprobe _do_fork' > kprobe_events
# kprobe on / ftrace off # kprobe on / ftrace off
...@@ -47,10 +45,3 @@ echo > trace ...@@ -47,10 +45,3 @@ echo > trace
( echo "forked") ( echo "forked")
grep testprobe trace grep testprobe trace
! grep '_do_fork <-' trace ! grep '_do_fork <-' trace
# cleanup
echo nop > current_tracer
echo > set_ftrace_filter
echo 0 > events/kprobes/testprobe/enable
echo > kprobe_events
echo > trace
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
[ -f kprobe_events ] || exit_unsupported # this is configurable [ -f kprobe_events ] || exit_unsupported # this is configurable
disable_events
echo > kprobe_events
:;: "Add an event on a module function without specifying event name" ;: :;: "Add an event on a module function without specifying event name" ;:
MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "` MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
...@@ -25,5 +22,3 @@ test -d events/kprobes/event1 || exit_failure ...@@ -25,5 +22,3 @@ test -d events/kprobes/event1 || exit_failure
echo "p:kprobes1/event1 $MOD:$FUNC" > kprobe_events echo "p:kprobes1/event1 $MOD:$FUNC" > kprobe_events
test -d events/kprobes1/event1 || exit_failure test -d events/kprobes1/event1 || exit_failure
echo > kprobe_events
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
[ -f kprobe_events ] || exit_unsupported # this is configurable [ -f kprobe_events ] || exit_unsupported # this is configurable
echo 0 > events/enable
echo > kprobe_events
echo 'r:testprobe2 _do_fork $retval' > kprobe_events echo 'r:testprobe2 _do_fork $retval' > kprobe_events
grep testprobe2 kprobe_events grep testprobe2 kprobe_events
test -d events/kprobes/testprobe2 test -d events/kprobes/testprobe2
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
[ -f kprobe_events ] || exit_unsupported # this is configurable [ -f kprobe_events ] || exit_unsupported # this is configurable
grep -q 'r\[maxactive\]' README || exit_unsupported # this is older version grep -q 'r\[maxactive\]' README || exit_unsupported # this is older version
echo > kprobe_events
# Test if we successfully reject unknown messages # Test if we successfully reject unknown messages
if echo 'a:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi if echo 'a:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi
...@@ -37,5 +35,3 @@ echo > kprobe_events ...@@ -37,5 +35,3 @@ echo > kprobe_events
echo 'r10 inet_csk_accept' > kprobe_events echo 'r10 inet_csk_accept' > kprobe_events
grep inet_csk_accept kprobe_events grep inet_csk_accept kprobe_events
echo > kprobe_events echo > kprobe_events
clear_trace
...@@ -12,11 +12,6 @@ case `uname -m` in ...@@ -12,11 +12,6 @@ case `uname -m` in
*) OFFS=0;; *) OFFS=0;;
esac esac
if [ -d events/kprobes ]; then
echo 0 > events/kprobes/enable
echo > kprobe_events
fi
N=0 N=0
echo "Setup up kprobes on first available 256 text symbols" echo "Setup up kprobes on first available 256 text symbols"
grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \ grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
......
...@@ -30,8 +30,6 @@ if [ `printf "%x" -1 | wc -c` != 9 ]; then ...@@ -30,8 +30,6 @@ if [ `printf "%x" -1 | wc -c` != 9 ]; then
UINT_TEST=yes UINT_TEST=yes
fi fi
echo 0 > events/enable
echo > kprobe_events
echo "p:testprobe ${TARGET_FUNC}" > kprobe_events echo "p:testprobe ${TARGET_FUNC}" > kprobe_events
echo "p:testprobe ${TARGET}" > kprobe_events echo "p:testprobe ${TARGET}" > kprobe_events
echo "p:testprobe ${TARGET_FUNC}${NEXT}" > kprobe_events echo "p:testprobe ${TARGET_FUNC}${NEXT}" > kprobe_events
...@@ -39,5 +37,3 @@ echo "p:testprobe ${TARGET_FUNC}${NEXT}" > kprobe_events ...@@ -39,5 +37,3 @@ echo "p:testprobe ${TARGET_FUNC}${NEXT}" > kprobe_events
if [ "${UINT_TEST}" = yes ]; then if [ "${UINT_TEST}" = yes ]; then
! echo "p:testprobe ${TARGET_FUNC}${OVERFLOW}" > kprobe_events ! echo "p:testprobe ${TARGET_FUNC}${OVERFLOW}" > kprobe_events
fi fi
echo > kprobe_events
clear_trace
...@@ -2,14 +2,7 @@ ...@@ -2,14 +2,7 @@
# description: event trigger - test extended error support # description: event trigger - test extended error support
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -24,9 +17,6 @@ if [ ! -f synthetic_events ]; then ...@@ -24,9 +17,6 @@ if [ ! -f synthetic_events ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo "Test extended error support" echo "Test extended error support"
echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
! echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger 2> /dev/null ! echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger 2> /dev/null
...@@ -34,6 +24,4 @@ if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then ...@@ -34,6 +24,4 @@ if ! grep -q "ERROR:" events/sched/sched_wakeup/hist; then
fail "Failed to generate extended error in histogram" fail "Failed to generate extended error in histogram"
fi fi
do_reset
exit 0 exit 0
#!/bin/sh #!/bin/sh
# description: event trigger - test field variable support # description: event trigger - test field variable support
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then ...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then
exit_unsupported exit_unsupported
fi fi
clear_synthetic_events
reset_tracer
do_reset
echo "Test field variable support" echo "Test field variable support"
echo 'wakeup_latency u64 lat; pid_t pid; int prio; char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat; pid_t pid; int prio; char comm[16]' > synthetic_events
...@@ -49,6 +38,4 @@ if grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then ...@@ -49,6 +38,4 @@ if grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then
fail "Failed to remove histogram with field variable" fail "Failed to remove histogram with field variable"
fi fi
do_reset
exit 0 exit 0
#!/bin/sh #!/bin/sh
# description: event trigger - test inter-event combined histogram trigger # description: event trigger - test inter-event combined histogram trigger
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then ...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
clear_synthetic_events
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'waking_latency u64 lat pid_t pid' > synthetic_events echo 'waking_latency u64 lat pid_t pid' > synthetic_events
...@@ -53,6 +42,4 @@ if ! grep -q "pid:" events/synthetic/waking+wakeup_latency/hist; then ...@@ -53,6 +42,4 @@ if ! grep -q "pid:" events/synthetic/waking+wakeup_latency/hist; then
fail "Failed to create combined histogram" fail "Failed to create combined histogram"
fi fi
do_reset
exit 0 exit 0
#!/bin/sh #!/bin/sh
# description: event trigger - test multiple actions on hist trigger # description: event trigger - test multiple actions on hist trigger
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -24,10 +16,6 @@ if [ ! -f synthetic_events ]; then ...@@ -24,10 +16,6 @@ if [ ! -f synthetic_events ]; then
exit_unsupported exit_unsupported
fi fi
clear_synthetic_events
reset_tracer
do_reset
echo "Test multiple actions on hist trigger" echo "Test multiple actions on hist trigger"
echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events echo 'wakeup_latency u64 lat; pid_t pid' >> synthetic_events
TRIGGER1=events/sched/sched_wakeup/trigger TRIGGER1=events/sched/sched_wakeup/trigger
...@@ -39,6 +27,4 @@ echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_ ...@@ -39,6 +27,4 @@ echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_
echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> $TRIGGER2 echo 'hist:keys=next_pid:onmatch(sched.sched_wakeup).wakeup_latency(sched.sched_switch.$wakeup_lat,prev_pid) if next_comm=="cyclictest"' >> $TRIGGER2
echo 'hist:keys=next_pid if next_comm=="cyclictest"' >> $TRIGGER2 echo 'hist:keys=next_pid if next_comm=="cyclictest"' >> $TRIGGER2
do_reset
exit 0 exit 0
#!/bin/sh #!/bin/sh
# description: event trigger - test inter-event histogram trigger onmatch action # description: event trigger - test inter-event histogram trigger onmatch action
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then ...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then
exit_unsupported exit_unsupported
fi fi
clear_synthetic_events
reset_tracer
do_reset
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
...@@ -45,6 +34,4 @@ if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then ...@@ -45,6 +34,4 @@ if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then
fail "Failed to create onmatch action inter-event histogram" fail "Failed to create onmatch action inter-event histogram"
fi fi
do_reset
exit 0 exit 0
#!/bin/sh #!/bin/sh
# description: event trigger - test inter-event histogram trigger onmatch-onmax action # description: event trigger - test inter-event histogram trigger onmatch-onmax action
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then ...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then
exit_unsupported exit_unsupported
fi fi
clear_synthetic_events
reset_tracer
do_reset
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
...@@ -45,6 +34,4 @@ if [ ! grep -q "ping" events/synthetic/wakeup_latency/hist -o ! grep -q "max:" e ...@@ -45,6 +34,4 @@ if [ ! grep -q "ping" events/synthetic/wakeup_latency/hist -o ! grep -q "max:" e
fail "Failed to create onmatch-onmax action inter-event histogram" fail "Failed to create onmatch-onmax action inter-event histogram"
fi fi
do_reset
exit 0 exit 0
#!/bin/sh #!/bin/sh
# description: event trigger - test inter-event histogram trigger onmax action # description: event trigger - test inter-event histogram trigger onmax action
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then ...@@ -23,10 +16,6 @@ if [ ! -f synthetic_events ]; then
exit_unsupported exit_unsupported
fi fi
clear_synthetic_events
reset_tracer
do_reset
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
...@@ -43,6 +32,4 @@ if ! grep -q "max:" events/sched/sched_switch/hist; then ...@@ -43,6 +32,4 @@ if ! grep -q "max:" events/sched/sched_switch/hist; then
fail "Failed to create onmax action inter-event histogram" fail "Failed to create onmax action inter-event histogram"
fi fi
do_reset
exit 0 exit 0
#!/bin/sh #!/bin/sh
# description: event trigger - test synthetic event create remove # description: event trigger - test synthetic event create remove
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -22,10 +16,6 @@ if [ ! -f synthetic_events ]; then ...@@ -22,10 +16,6 @@ if [ ! -f synthetic_events ]; then
exit_unsupported exit_unsupported
fi fi
clear_synthetic_events
reset_tracer
do_reset
echo "Test create synthetic event" echo "Test create synthetic event"
echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
...@@ -49,6 +39,4 @@ if [ -d events/synthetic/wakeup_latency ]; then ...@@ -49,6 +39,4 @@ if [ -d events/synthetic/wakeup_latency ]; then
fail "Failed to delete wakeup_latency synthetic event" fail "Failed to delete wakeup_latency synthetic event"
fi fi
do_reset
exit 0 exit 0
...@@ -3,14 +3,7 @@ ...@@ -3,14 +3,7 @@
# description: event trigger - test event enable/disable trigger # description: event trigger - test event enable/disable trigger
# flags: instance # flags: instance
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -25,9 +18,6 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then ...@@ -25,9 +18,6 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
FEATURE=`grep enable_event events/sched/sched_process_fork/trigger` FEATURE=`grep enable_event events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then if [ -z "$FEATURE" ]; then
echo "event enable/disable trigger is not supported" echo "event enable/disable trigger is not supported"
...@@ -61,6 +51,4 @@ echo 'enable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger ...@@ -61,6 +51,4 @@ echo 'enable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger
! echo 'enable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger ! echo 'enable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger
! echo 'disable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger ! echo 'disable_event:sched:sched_switch' > events/sched/sched_process_fork/trigger
do_reset
exit 0 exit 0
...@@ -3,14 +3,7 @@ ...@@ -3,14 +3,7 @@
# description: event trigger - test trigger filter # description: event trigger - test trigger filter
# flags: instance # flags: instance
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -25,9 +18,6 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then ...@@ -25,9 +18,6 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo "Test trigger filter" echo "Test trigger filter"
echo 1 > tracing_on echo 1 > tracing_on
echo 'traceoff if child_pid == 0' > events/sched/sched_process_fork/trigger echo 'traceoff if child_pid == 0' > events/sched/sched_process_fork/trigger
...@@ -54,8 +44,4 @@ echo '!traceoff' > events/sched/sched_process_fork/trigger ...@@ -54,8 +44,4 @@ echo '!traceoff' > events/sched/sched_process_fork/trigger
echo 'traceoff if parent_pid >= 0 || child_pid >= 0' > events/sched/sched_process_fork/trigger echo 'traceoff if parent_pid >= 0 || child_pid >= 0' > events/sched/sched_process_fork/trigger
echo '!traceoff' > events/sched/sched_process_fork/trigger echo '!traceoff' > events/sched/sched_process_fork/trigger
do_reset
exit 0 exit 0
...@@ -3,14 +3,7 @@ ...@@ -3,14 +3,7 @@
# description: event trigger - test histogram modifiers # description: event trigger - test histogram modifiers
# flags: instance # flags: instance
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -30,9 +23,6 @@ if [ ! -f events/sched/sched_process_fork/hist ]; then ...@@ -30,9 +23,6 @@ if [ ! -f events/sched/sched_process_fork/hist ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo "Test histogram with execname modifier" echo "Test histogram with execname modifier"
echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger
...@@ -71,6 +61,4 @@ for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done ...@@ -71,6 +61,4 @@ for i in `seq 1 10` ; do ( echo "forked" > /dev/null); done
grep 'bytes_req: ~ 2^[0-9]*' events/kmem/kmalloc/hist > /dev/null || \ grep 'bytes_req: ~ 2^[0-9]*' events/kmem/kmalloc/hist > /dev/null || \
fail "log2 modifier on kmem/kmalloc did not work" fail "log2 modifier on kmem/kmalloc did not work"
do_reset
exit 0 exit 0
...@@ -3,14 +3,7 @@ ...@@ -3,14 +3,7 @@
# description: event trigger - test histogram trigger # description: event trigger - test histogram trigger
# flags: instance # flags: instance
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -30,9 +23,6 @@ if [ ! -f events/sched/sched_process_fork/hist ]; then ...@@ -30,9 +23,6 @@ if [ ! -f events/sched/sched_process_fork/hist ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo "Test histogram basic tigger" echo "Test histogram basic tigger"
echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger
...@@ -79,6 +69,4 @@ check_inc `grep -o "child_pid:[[:space:]]*[[:digit:]]*" \ ...@@ -79,6 +69,4 @@ check_inc `grep -o "child_pid:[[:space:]]*[[:digit:]]*" \
events/sched/sched_process_fork/hist | cut -d: -f2 ` || events/sched/sched_process_fork/hist | cut -d: -f2 ` ||
fail "sort param on sched_process_fork did not work" fail "sort param on sched_process_fork did not work"
do_reset
exit 0 exit 0
...@@ -3,14 +3,7 @@ ...@@ -3,14 +3,7 @@
# description: event trigger - test multiple histogram triggers # description: event trigger - test multiple histogram triggers
# flags: instance # flags: instance
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -30,11 +23,6 @@ if [ ! -f events/sched/sched_process_fork/hist ]; then ...@@ -30,11 +23,6 @@ if [ ! -f events/sched/sched_process_fork/hist ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
reset_trigger
echo "Test histogram multiple tiggers" echo "Test histogram multiple tiggers"
echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger
...@@ -67,8 +55,4 @@ grep test_hist events/sched/sched_process_exit/hist > /dev/null || \ ...@@ -67,8 +55,4 @@ grep test_hist events/sched/sched_process_exit/hist > /dev/null || \
diffs=`diff events/sched/sched_process_exit/hist events/sched/sched_process_fork/hist | wc -l` diffs=`diff events/sched/sched_process_exit/hist events/sched/sched_process_fork/hist | wc -l`
test $diffs -eq 0 || fail "Same name histograms are not same" test $diffs -eq 0 || fail "Same name histograms are not same"
reset_trigger
do_reset
exit 0 exit 0
...@@ -2,14 +2,7 @@ ...@@ -2,14 +2,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test snapshot-trigger # description: event trigger - test snapshot-trigger
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -29,9 +22,6 @@ if [ ! -f snapshot ]; then ...@@ -29,9 +22,6 @@ if [ ! -f snapshot ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
FEATURE=`grep snapshot events/sched/sched_process_fork/trigger` FEATURE=`grep snapshot events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then if [ -z "$FEATURE" ]; then
echo "snapshot trigger is not supported" echo "snapshot trigger is not supported"
...@@ -57,6 +47,4 @@ echo "Test snapshot semantic errors" ...@@ -57,6 +47,4 @@ echo "Test snapshot semantic errors"
echo "snapshot" > events/sched/sched_process_fork/trigger echo "snapshot" > events/sched/sched_process_fork/trigger
! echo "snapshot" > events/sched/sched_process_fork/trigger ! echo "snapshot" > events/sched/sched_process_fork/trigger
do_reset
exit 0 exit 0
...@@ -2,14 +2,7 @@ ...@@ -2,14 +2,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test stacktrace-trigger # description: event trigger - test stacktrace-trigger
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -24,9 +17,6 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then ...@@ -24,9 +17,6 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
FEATURE=`grep stacktrace events/sched/sched_process_fork/trigger` FEATURE=`grep stacktrace events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then if [ -z "$FEATURE" ]; then
echo "stacktrace trigger is not supported" echo "stacktrace trigger is not supported"
...@@ -49,6 +39,4 @@ echo "Test stacktrace semantic errors" ...@@ -49,6 +39,4 @@ echo "Test stacktrace semantic errors"
echo "stacktrace" > events/sched/sched_process_fork/trigger echo "stacktrace" > events/sched/sched_process_fork/trigger
! echo "stacktrace" > events/sched/sched_process_fork/trigger ! echo "stacktrace" > events/sched/sched_process_fork/trigger
do_reset
exit 0 exit 0
...@@ -3,14 +3,7 @@ ...@@ -3,14 +3,7 @@
# description: trace_marker trigger - test histogram trigger # description: trace_marker trigger - test histogram trigger
# flags: instance # flags: instance
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -35,8 +28,6 @@ if [ ! -f events/ftrace/print/hist ]; then ...@@ -35,8 +28,6 @@ if [ ! -f events/ftrace/print/hist ]; then
exit_unsupported exit_unsupported
fi fi
do_reset
echo "Test histogram trace_marker tigger" echo "Test histogram trace_marker tigger"
echo 'hist:keys=common_pid' > events/ftrace/print/trigger echo 'hist:keys=common_pid' > events/ftrace/print/trigger
...@@ -44,6 +35,4 @@ for i in `seq 1 10` ; do echo "hello" > trace_marker; done ...@@ -44,6 +35,4 @@ for i in `seq 1 10` ; do echo "hello" > trace_marker; done
grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \ grep 'hitcount: *10$' events/ftrace/print/hist > /dev/null || \
fail "hist trigger did not trigger correct times on trace_marker" fail "hist trigger did not trigger correct times on trace_marker"
do_reset
exit 0 exit 0
...@@ -3,15 +3,7 @@ ...@@ -3,15 +3,7 @@
# description: trace_marker trigger - test snapshot trigger # description: trace_marker trigger - test snapshot trigger
# flags: instance # flags: instance
do_reset() {
reset_trigger
echo > set_event
echo 0 > snapshot
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -54,8 +46,6 @@ test_trace() { ...@@ -54,8 +46,6 @@ test_trace() {
done done
} }
do_reset
echo "Test snapshot trace_marker tigger" echo "Test snapshot trace_marker tigger"
echo 'snapshot' > events/ftrace/print/trigger echo 'snapshot' > events/ftrace/print/trigger
...@@ -69,6 +59,4 @@ for i in `seq 1 10` ; do echo "hello >$i<" > trace_marker; done ...@@ -69,6 +59,4 @@ for i in `seq 1 10` ; do echo "hello >$i<" > trace_marker; done
test_trace trace 1 test_trace trace 1
test_trace snapshot 2 test_trace snapshot 2
do_reset
exit 0 exit 0
...@@ -3,15 +3,7 @@ ...@@ -3,15 +3,7 @@
# description: trace_marker trigger - test histogram with synthetic event against kernel event # description: trace_marker trigger - test histogram with synthetic event against kernel event
# flags: # flags:
do_reset() {
reset_trigger
echo > set_event
echo > synthetic_events
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -46,8 +38,6 @@ if [ ! -f events/ftrace/print/hist ]; then ...@@ -46,8 +38,6 @@ if [ ! -f events/ftrace/print/hist ]; then
exit_unsupported exit_unsupported
fi fi
do_reset
echo "Test histogram kernel event to trace_marker latency histogram trigger" echo "Test histogram kernel event to trace_marker latency histogram trigger"
echo 'latency u64 lat' > synthetic_events echo 'latency u64 lat' > synthetic_events
...@@ -63,6 +53,4 @@ grep 'hitcount: *1$' events/ftrace/print/hist > /dev/null || \ ...@@ -63,6 +53,4 @@ grep 'hitcount: *1$' events/ftrace/print/hist > /dev/null || \
grep 'hitcount: *1$' events/synthetic/latency/hist > /dev/null || \ grep 'hitcount: *1$' events/synthetic/latency/hist > /dev/null || \
fail "hist trigger did not trigger " fail "hist trigger did not trigger "
do_reset
exit 0 exit 0
...@@ -3,15 +3,7 @@ ...@@ -3,15 +3,7 @@
# description: trace_marker trigger - test histogram with synthetic event # description: trace_marker trigger - test histogram with synthetic event
# flags: # flags:
do_reset() {
reset_trigger
echo > set_event
echo > synthetic_events
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -41,8 +33,6 @@ if [ ! -f events/ftrace/print/hist ]; then ...@@ -41,8 +33,6 @@ if [ ! -f events/ftrace/print/hist ]; then
exit_unsupported exit_unsupported
fi fi
do_reset
echo "Test histogram trace_marker to trace_marker latency histogram trigger" echo "Test histogram trace_marker to trace_marker latency histogram trigger"
echo 'latency u64 lat' > synthetic_events echo 'latency u64 lat' > synthetic_events
...@@ -61,6 +51,4 @@ fi ...@@ -61,6 +51,4 @@ fi
grep 'hitcount: *1$' events/synthetic/latency/hist > /dev/null || \ grep 'hitcount: *1$' events/synthetic/latency/hist > /dev/null || \
fail "hist trigger did not trigger " fail "hist trigger did not trigger "
do_reset
exit 0 exit 0
...@@ -2,14 +2,7 @@ ...@@ -2,14 +2,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# description: event trigger - test traceon/off trigger # description: event trigger - test traceon/off trigger
do_reset() {
reset_trigger
echo > set_event
clear_trace
}
fail() { #msg fail() { #msg
do_reset
echo $1 echo $1
exit_fail exit_fail
} }
...@@ -24,9 +17,6 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then ...@@ -24,9 +17,6 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
exit_unsupported exit_unsupported
fi fi
reset_tracer
do_reset
echo "Test traceoff trigger" echo "Test traceoff trigger"
echo 1 > tracing_on echo 1 > tracing_on
echo 'traceoff' > events/sched/sched_process_fork/trigger echo 'traceoff' > events/sched/sched_process_fork/trigger
...@@ -54,6 +44,4 @@ echo 'traceon' > events/sched/sched_process_fork/trigger ...@@ -54,6 +44,4 @@ echo 'traceon' > events/sched/sched_process_fork/trigger
! echo 'traceon' > events/sched/sched_process_fork/trigger ! echo 'traceon' > events/sched/sched_process_fork/trigger
! echo 'traceoff' > events/sched/sched_process_fork/trigger ! echo 'traceoff' > events/sched/sched_process_fork/trigger
do_reset
exit 0 exit 0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment