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: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
This commit is contained in:
Masami Hiramatsu 2017-11-04 04:38:41 +09:00 коммит произвёл Shuah Khan
Родитель f737b8f4d3
Коммит 42534b1f58
28 изменённых файлов: 35 добавлений и 28 удалений

Просмотреть файл

@ -222,7 +222,14 @@ SIG_RESULT=
SIG_BASE=36 # Use realtime signals SIG_BASE=36 # Use realtime signals
SIG_PID=$$ SIG_PID=$$
exit_pass () {
exit 0
}
SIG_FAIL=$((SIG_BASE + FAIL)) SIG_FAIL=$((SIG_BASE + FAIL))
exit_fail () {
exit 1
}
trap 'SIG_RESULT=$FAIL' $SIG_FAIL trap 'SIG_RESULT=$FAIL' $SIG_FAIL
SIG_UNRESOLVED=$((SIG_BASE + UNRESOLVED)) SIG_UNRESOLVED=$((SIG_BASE + UNRESOLVED))

Просмотреть файл

@ -2,4 +2,4 @@
# description: Basic event tracing check # description: Basic event tracing check
test -f available_events -a -f set_event -a -d events test -f available_events -a -f set_event -a -d events
# check scheduler events are available # 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 fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
yield() { yield() {

Просмотреть файл

@ -13,7 +13,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
yield() { yield() {

Просмотреть файл

@ -11,7 +11,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
yield() { yield() {

Просмотреть файл

@ -10,7 +10,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
yield() { yield() {

Просмотреть файл

@ -28,7 +28,7 @@ do_reset() {
fail() { # msg fail() { # msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
disable_tracing disable_tracing

Просмотреть файл

@ -18,7 +18,7 @@ do_reset() {
fail() { # msg fail() { # msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
disable_tracing disable_tracing

Просмотреть файл

@ -51,7 +51,7 @@ do_reset() {
fail() { # msg fail() { # msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
yield() { yield() {

Просмотреть файл

@ -27,7 +27,7 @@ do_reset() {
fail() { # mesg fail() { # mesg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
SLEEP_TIME=".1" SLEEP_TIME=".1"
@ -48,8 +48,7 @@ test_event_enabled() {
e=`cat $EVENT_ENABLE` e=`cat $EVENT_ENABLE`
if [ "$e" != $val ]; then if [ "$e" != $val ]; then
echo "Expected $val but found $e" fail "Expected $val but found $e"
exit 1
fi fi
} }

Просмотреть файл

@ -32,7 +32,7 @@ fail() { # mesg
reset_tracer reset_tracer
echo > set_ftrace_filter echo > set_ftrace_filter
echo $1 echo $1
exit $FAIL exit_fail
} }
echo "Testing function tracer with profiler:" echo "Testing function tracer with profiler:"

Просмотреть файл

@ -26,7 +26,7 @@ do_reset() {
fail() { # mesg fail() { # mesg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
do_reset do_reset

Просмотреть файл

@ -27,7 +27,7 @@ do_reset() {
fail() { # mesg fail() { # mesg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
SLEEP_TIME=".1" SLEEP_TIME=".1"

Просмотреть файл

@ -11,7 +11,7 @@ fail() { # mesg
rmdir foo 2>/dev/null rmdir foo 2>/dev/null
echo $1 echo $1
set -e set -e
exit $FAIL exit_fail
} }
cd instances cd instances

Просмотреть файл

@ -11,7 +11,7 @@ fail() { # mesg
rmdir x y z 2>/dev/null rmdir x y z 2>/dev/null
echo $1 echo $1
set -e set -e
exit $FAIL exit_fail
} }
cd instances cd instances

Просмотреть файл

@ -9,7 +9,7 @@ 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 1 # 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 clear_trace

Просмотреть файл

@ -14,5 +14,5 @@ echo 1 > events/kprobes/testprobe/enable
echo 0 > events/kprobes/testprobe/enable echo 0 > events/kprobes/testprobe/enable
echo "-:testprobe" >> kprobe_events echo "-:testprobe" >> kprobe_events
clear_trace 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 echo "-:testprobe" >> kprobe_events
clear_trace 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 0 > events/kprobes/testprobe2/enable
echo '-:testprobe2' >> kprobe_events echo '-:testprobe2' >> kprobe_events
clear_trace 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. # Note that all tests are run with "errexit" option.
exit 0 # Return 0 if the test is passed, otherwise return !0 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 could not run because of lack of feature, call exit_unsupported
# If the test returned unclear results, call exit_unresolved # If the test returned unclear results, call exit_unresolved
# If the test is a dummy, or a placeholder, call exit_untested # If the test is a dummy, or a placeholder, call exit_untested

Просмотреть файл

@ -12,7 +12,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then if [ ! -f set_event -o ! -d events/sched ]; then

Просмотреть файл

@ -12,7 +12,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then if [ ! -f set_event -o ! -d events/sched ]; then

Просмотреть файл

@ -12,7 +12,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then if [ ! -f set_event -o ! -d events/sched ]; then

Просмотреть файл

@ -12,7 +12,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then if [ ! -f set_event -o ! -d events/sched ]; then

Просмотреть файл

@ -12,7 +12,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then if [ ! -f set_event -o ! -d events/sched ]; then

Просмотреть файл

@ -11,7 +11,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then if [ ! -f set_event -o ! -d events/sched ]; then

Просмотреть файл

@ -11,7 +11,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then if [ ! -f set_event -o ! -d events/sched ]; then

Просмотреть файл

@ -11,7 +11,7 @@ do_reset() {
fail() { #msg fail() { #msg
do_reset do_reset
echo $1 echo $1
exit $FAIL exit_fail
} }
if [ ! -f set_event -o ! -d events/sched ]; then if [ ! -f set_event -o ! -d events/sched ]; then