提交 42534b1f 编写于 作者: M Masami Hiramatsu 提交者: Shuah Khan

selftests/ftrace: Introduce exit_pass and exit_fail

As same as other results, introduce exit_pass and exit_fail
functions so that we can easily understand what will happen.
Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
上级 f737b8f4
......@@ -222,7 +222,14 @@ SIG_RESULT=
SIG_BASE=36 # Use realtime signals
SIG_PID=$$
exit_pass () {
exit 0
}
SIG_FAIL=$((SIG_BASE + FAIL))
exit_fail () {
exit 1
}
trap 'SIG_RESULT=$FAIL' $SIG_FAIL
SIG_UNRESOLVED=$((SIG_BASE + UNRESOLVED))
......
......@@ -2,4 +2,4 @@
# description: Basic event tracing check
test -f available_events -a -f set_event -a -d events
# check scheduler events are available
grep -q sched available_events && exit 0 || exit $FAIL
grep -q sched available_events && exit_pass || exit_fail
......@@ -11,7 +11,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
yield() {
......
......@@ -13,7 +13,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
yield() {
......
......@@ -11,7 +11,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
yield() {
......
......@@ -10,7 +10,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
yield() {
......
......@@ -28,7 +28,7 @@ do_reset() {
fail() { # msg
do_reset
echo $1
exit $FAIL
exit_fail
}
disable_tracing
......
......@@ -18,7 +18,7 @@ do_reset() {
fail() { # msg
do_reset
echo $1
exit $FAIL
exit_fail
}
disable_tracing
......
......@@ -51,7 +51,7 @@ do_reset() {
fail() { # msg
do_reset
echo $1
exit $FAIL
exit_fail
}
yield() {
......
......@@ -27,7 +27,7 @@ do_reset() {
fail() { # mesg
do_reset
echo $1
exit $FAIL
exit_fail
}
SLEEP_TIME=".1"
......@@ -48,8 +48,7 @@ test_event_enabled() {
e=`cat $EVENT_ENABLE`
if [ "$e" != $val ]; then
echo "Expected $val but found $e"
exit 1
fail "Expected $val but found $e"
fi
}
......
......@@ -32,7 +32,7 @@ fail() { # mesg
reset_tracer
echo > set_ftrace_filter
echo $1
exit $FAIL
exit_fail
}
echo "Testing function tracer with profiler:"
......
......@@ -26,7 +26,7 @@ do_reset() {
fail() { # mesg
do_reset
echo $1
exit $FAIL
exit_fail
}
do_reset
......
......@@ -27,7 +27,7 @@ do_reset() {
fail() { # mesg
do_reset
echo $1
exit $FAIL
exit_fail
}
SLEEP_TIME=".1"
......
......@@ -11,7 +11,7 @@ fail() { # mesg
rmdir foo 2>/dev/null
echo $1
set -e
exit $FAIL
exit_fail
}
cd instances
......
......@@ -11,7 +11,7 @@ fail() { # mesg
rmdir x y z 2>/dev/null
echo $1
set -e
exit $FAIL
exit_fail
}
cd instances
......
......@@ -9,7 +9,7 @@ echo > kprobe_events
echo p:myevent _do_fork > kprobe_events
test -d events/kprobes/myevent
echo 1 > events/kprobes/myevent/enable
echo > kprobe_events && exit 1 # this must fail
echo > kprobe_events && exit_fail # this must fail
echo 0 > events/kprobes/myevent/enable
echo > kprobe_events # this must succeed
clear_trace
......@@ -14,5 +14,5 @@ echo 1 > events/kprobes/testprobe/enable
echo 0 > events/kprobes/testprobe/enable
echo "-:testprobe" >> kprobe_events
clear_trace
test -d events/kprobes/testprobe && exit 1 || exit 0
test -d events/kprobes/testprobe && exit_fail || exit_pass
......@@ -35,4 +35,4 @@ check_types $ARGS
echo "-:testprobe" >> kprobe_events
clear_trace
test -d events/kprobes/testprobe && exit 1 || exit 0
test -d events/kprobes/testprobe && exit_fail || exit_pass
......@@ -14,4 +14,4 @@ echo 1 > events/kprobes/testprobe2/enable
echo 0 > events/kprobes/testprobe2/enable
echo '-:testprobe2' >> kprobe_events
clear_trace
test -d events/kprobes/testprobe2 && exit 1 || exit 0
test -d events/kprobes/testprobe2 && exit_fail || exit_pass
......@@ -4,6 +4,7 @@
# Note that all tests are run with "errexit" option.
exit 0 # Return 0 if the test is passed, otherwise return !0
# Or you can call exit_pass for passed test, and exit_fail for failed test.
# If the test could not run because of lack of feature, call exit_unsupported
# If the test returned unclear results, call exit_unresolved
# If the test is a dummy, or a placeholder, call exit_untested
......@@ -12,7 +12,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
if [ ! -f set_event -o ! -d events/sched ]; then
......
......@@ -12,7 +12,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
if [ ! -f set_event -o ! -d events/sched ]; then
......
......@@ -12,7 +12,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
if [ ! -f set_event -o ! -d events/sched ]; then
......
......@@ -12,7 +12,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
if [ ! -f set_event -o ! -d events/sched ]; then
......
......@@ -12,7 +12,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
if [ ! -f set_event -o ! -d events/sched ]; then
......
......@@ -11,7 +11,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
if [ ! -f set_event -o ! -d events/sched ]; then
......
......@@ -11,7 +11,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
if [ ! -f set_event -o ! -d events/sched ]; then
......
......@@ -11,7 +11,7 @@ do_reset() {
fail() { #msg
do_reset
echo $1
exit $FAIL
exit_fail
}
if [ ! -f set_event -o ! -d events/sched ]; then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册