From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V2 4/9] ftrace_stress: skip unsupported tests
Date: Wed, 4 May 2016 18:50:50 +0200 [thread overview]
Message-ID: <20160504165050.GC22563@rei> (raw)
In-Reply-To: <1460966656-28328-5-git-send-email-chuhu@redhat.com>
Hi!
> diff --git a/testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh b/testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh
> index d9f7f8b..80c914c 100755
> --- a/testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh
> +++ b/testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh
> @@ -21,87 +21,92 @@
> ## ##
> ###########################################################################
>
> -
> export TCID="ftrace-stress-test"
> export TST_TOTAL=1
> export TST_COUNT=1
>
> . ftrace_lib.sh
>
> -test_success=true
> +test_targets=" \
> +trace_pipe current_tracer ftrace_enabled function_profile_enabled \
> +set_event set_ftrace_pid stack_max_size stack_trace trace trace_clock \
> +trace_options trace_stat tracing_enabled tracing_max_latency \
> +tracing_on function_profile_enabled buffer_size_kb"
>
> -export_pids()
> +get_skip_targets()
> {
> - export pid1 pid2 pid3 pid4 pid5 pid6 pid7 pid8 pid9 pid10 pid11 pid12 \
> - pid13 pid14 pid15 pid16
> -
> - export NR_PIDS=16
> + NR_PIDS=0
> + for target in ${test_targets}; do
> + if [ ! -e $TRACING_PATH/$target ] &&
> + [ ! -e /proc/sys/kernel/$target ]; then
> + eval skip_$target=1
> + tst_resm TINFO "$target is not supported. Skip it."
> + else
> + eval skip_$target=0
> + NR_PIDS=$((NR_PIDS + 1))
> + fi
> + done
> + # Export it before sub case is lanuched.
> + export NR_PIDS
> }
>
> -test_stress()
> +should_skip_target()
> {
> - export_pids
> -
> - $SPATH/ftrace_trace_clock.sh &
> - pid1=$!
> - $SPATH/ftrace_current_tracer.sh &
> - pid2=$!
> - $SPATH/ftrace_trace_options.sh &
> - pid3=$!
> - $SPATH/ftrace_tracing_max_latency.sh &
> - pid4=$!
> - $SPATH/ftrace_stack_trace.sh &
> - pid5=$!
> - $SPATH/ftrace_stack_max_size.sh &
> - pid6=$!
> - $SPATH/ftrace_tracing_on.sh &
> - pid7=$!
> - $SPATH/ftrace_tracing_enabled.sh &
> - pid8=$!
> - $SPATH/ftrace_set_event.sh &
> - pid9=$!
> - $SPATH/ftrace_buffer_size.sh &
> - pid10=$!
> - $SPATH/ftrace_trace.sh &
> - pid11=$!
> - $SPATH/ftrace_trace_pipe.sh &
> - pid12=$!
> - $SPATH/ftrace_ftrace_enabled.sh &
> - pid13=$!
> - $SPATH/ftrace_set_ftrace_pid.sh &
> - pid14=$!
> - $SPATH/ftrace_profile_enabled.sh &
> - pid15=$!
> - $SPATH/ftrace_trace_stat.sh &
> - pid16=$!
> + local var=skip_$1
> + local val=${!var}
> + [ "$val" = 1 ]
> }
>
> test_kill()
> {
> - kill -KILL $pid1 || test_success=false
> - kill -KILL $pid2 || test_success=false
> - kill -KILL $pid3 || test_success=false
> - kill -KILL $pid4 || test_success=false
> - kill -KILL $pid5 || test_success=false
> - kill -KILL $pid6 || test_success=false
> - kill -KILL $pid7 || test_success=false
> - kill -KILL $pid8 || test_success=false
> - kill -KILL $pid9 || test_success=false
> - kill -KILL $pid10 || test_success=false
> - kill -KILL $pid11 || test_success=false
> - kill -USR1 $pid12 || test_success=false
> - kill -KILL $pid13 || test_success=false
> - kill -KILL $pid14 || test_success=false
> - kill -KILL $pid15 || test_success=false
> - kill -KILL $pid16 || test_success=false
> + tst_resm TINFO "killing ${pid0}"
> + kill -USR1 ${pid0}
> + wait ${pid0}
> +
> + local p=1;
> + while [ $p -lt $NR_PIDS ]; do
> + local kill_pid=pid${p}
> + kill -KILL ${!kill_pid}
^
Bashism.
> + tst_resm TINFO "killing ${!kill_pid}"
> + wait ${!kill_pid}
> + p=$((p + 1))
> + done
This part seems to have misformatted whitespaces, please fix that.
> sleep 2
The wait is done here, OK. But you should have dropped the sleep 2.
> clean_up
> }
>
> +test_stress()
> +{
> + local index=0;
> +
> + tst_resm TINFO "Test targets: ${test_targets}"
> +
> + get_skip_targets
> + for target in ${test_targets}; do
> + if should_skip_target $target; then
> + continue
> + fi
> + sh ftrace_${target}.sh &
> + eval pid${index}=$!
> + tst_resm TINFO "Start pid${index}=$! $SPATH/ftrace_${target}.sh"
> + index=$((index + 1))
> + done
> + export_pids
> +}
> +
> +export_pids()
> +{
> + local p=0
> + while [ $p -lt $NR_PIDS ]; do
> + export pid${p}
> + p=$((p + 1))
> + done
> +}
>
> +cd ftrace_stress/
Why the cd? It does not seem to be needed.
> # ----------------------------
> -echo "Ftrace Stress Test Begin"
> +tst_resm TINFO "Ftrace Stress Test Begin"
>
> save_old_setting
>
> @@ -113,11 +118,6 @@ test_wait
>
> test_kill
>
> -echo "Ftrace Stress Test End"
> +tst_resm TINFO "Finished running the test. Run dmesg to double-check for bugs"
Well most of the things I've pointed out seems to be fixed but I still
fail to see the restore_old_setting here. Or do I miss someting?
> -if $test_success; then
> - tst_resm TPASS "finished running the test. Run dmesg to double-check for bugs"
> -else
> - tst_resm TFAIL "please check log message."
> - exit 1
> -fi
> +tst_exit
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2016-05-04 16:50 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 8:04 [LTP] [PATCH V2 0/9] tracing: make ftrace tests to be extended Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 1/9] tracing: reorganize ftrace-stress tests to general tests Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 2/9] tracing/ftrace: add new case for ftrace userstacktrace Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 3/9] tracing/ftrace: add a new case for signal_generate Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 4/9] ftrace_stress: skip unsupported tests Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 5/9] ftrace_stress: keep the name of testscipt in sync with tracing file Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 6/9] testcases/lib: Add tst_random decmical integer generator Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 7/9] ftrace_stress: update the trace_options test Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 8/9] ftrace_stress: add two new tests Chunyu Hu
2016-04-18 8:04 ` [LTP] [PATCH V2 9/9] ftrace_stress: cleanup and use ltp API Chunyu Hu
2016-05-04 14:56 ` Cyril Hrubis
2016-05-04 15:42 ` Chunyu Hu
2016-05-04 16:32 ` Cyril Hrubis
2016-05-05 7:44 ` Chunyu Hu
2016-05-10 14:13 ` Cyril Hrubis
2016-05-11 11:01 ` Chunyu Hu
2016-05-04 16:57 ` [LTP] [PATCH V2 7/9] ftrace_stress: update the trace_options test Cyril Hrubis
2016-05-04 13:34 ` [LTP] [PATCH V2 6/9] testcases/lib: Add tst_random decmical integer generator Cyril Hrubis
2016-05-04 15:04 ` Chunyu Hu
2016-05-04 15:55 ` Cyril Hrubis
2016-05-04 16:28 ` Chunyu Hu
2016-05-04 23:40 ` Chunyu Hu
2016-05-04 16:50 ` Cyril Hrubis [this message]
2016-05-05 0:53 ` [LTP] [PATCH V2 4/9] ftrace_stress: skip unsupported tests Chunyu Hu
2016-05-10 14:25 ` Cyril Hrubis
2016-05-11 11:14 ` Chunyu Hu
2016-05-04 16:00 ` [LTP] [PATCH V2 2/9] tracing/ftrace: add new case for ftrace userstacktrace Cyril Hrubis
2016-05-05 6:24 ` Li Wang
2016-05-04 16:26 ` [LTP] [PATCH V2 1/9] tracing: reorganize ftrace-stress tests to general tests Cyril Hrubis
2016-05-05 6:21 ` Li Wang
2016-05-05 10:11 ` Chunyu Hu
2016-05-05 10:53 ` Chunyu Hu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160504165050.GC22563@rei \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.