public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: "Shuah Khan" <shuahkh@osg.samsung.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Pádraig Brady" <P@draigBrady.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Dave Jones" <davej@codemonkey.org.uk>,
	"Luis Henriques" <luis.henriques@canonical.com>
Subject: Re: [PATCH v2.1] ftracetest: Do not use usleep directly
Date: Thu, 02 Apr 2015 14:58:04 +0900	[thread overview]
Message-ID: <551CDA6C.50106@hitachi.com> (raw)
In-Reply-To: <1427949253-26883-1-git-send-email-namhyung@kernel.org>

(2015/04/02 13:34), Namhyung Kim wrote:
> The usleep is only provided on distros from Redhat so running ftracetest
> on other distro resulted in failures due to the missing usleep.
> 
> The reason of using [u]sleep in the test was to generate (scheduler)
> events.  It can be done various ways like this:
> 
> yield() {  ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1; }

Nice hack! :)

Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

> 
> Reported-by: Michael Ellerman <mpe@ellerman.id.au>
> Reported-by: Dave Jones <davej@codemonkey.org.uk>
> Reported-by: Luis Henriques <luis.henriques@canonical.com>
> Based-on-patch-by: Pádraig Brady <P@draigBrady.com>
> CC: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> fix a typo of pinc
> 
>  tools/testing/selftests/ftrace/test.d/event/event-enable.tc | 13 ++++++++++---
>  .../selftests/ftrace/test.d/event/subsystem-enable.tc       | 13 ++++++++++---
>  .../selftests/ftrace/test.d/event/toplevel-enable.tc        | 13 +++++++++++++
>  3 files changed, 33 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> index 668616d9bb03..c40c139aaf2b 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> @@ -12,6 +12,10 @@ fail() { #msg
>      exit -1
>  }
>  
> +yield() {
> +    ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
> +}
> +
>  if [ ! -f set_event -o ! -d events/sched ]; then
>      echo "event tracing is not supported"
>      exit_unsupported
> @@ -21,7 +25,8 @@ reset_tracer
>  do_reset
>  
>  echo 'sched:sched_switch' > set_event
> -usleep 1
> +
> +yield
>  
>  count=`cat trace | grep sched_switch | wc -l`
>  if [ $count -eq 0 ]; then
> @@ -31,7 +36,8 @@ fi
>  do_reset
>  
>  echo 1 > events/sched/sched_switch/enable
> -usleep 1
> +
> +yield
>  
>  count=`cat trace | grep sched_switch | wc -l`
>  if [ $count -eq 0 ]; then
> @@ -41,7 +47,8 @@ fi
>  do_reset
>  
>  echo 0 > events/sched/sched_switch/enable
> -usleep 1
> +
> +yield
>  
>  count=`cat trace | grep sched_switch | wc -l`
>  if [ $count -ne 0 ]; then
> diff --git a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> index 655c415b6e7f..cbd98b71ee8a 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> @@ -12,6 +12,10 @@ fail() { #msg
>      exit -1
>  }
>  
> +yield() {
> +    ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
> +}
> +
>  if [ ! -f set_event -o ! -d events/sched ]; then
>      echo "event tracing is not supported"
>      exit_unsupported
> @@ -21,7 +25,8 @@ reset_tracer
>  do_reset
>  
>  echo 'sched:*' > set_event
> -usleep 1
> +
> +yield
>  
>  count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
>  if [ $count -lt 3 ]; then
> @@ -31,7 +36,8 @@ fi
>  do_reset
>  
>  echo 1 > events/sched/enable
> -usleep 1
> +
> +yield
>  
>  count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
>  if [ $count -lt 3 ]; then
> @@ -41,7 +47,8 @@ fi
>  do_reset
>  
>  echo 0 > events/sched/enable
> -usleep 1
> +
> +yield
>  
>  count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
>  if [ $count -ne 0 ]; then
> diff --git a/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc b/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc
> index 480845774007..65e2ab666611 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/toplevel-enable.tc
> @@ -12,6 +12,10 @@ fail() { #msg
>      exit -1
>  }
>  
> +yield() {
> +    ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1
> +}
> +
>  if [ ! -f available_events -o ! -f set_event -o ! -d events ]; then
>      echo "event tracing is not supported"
>      exit_unsupported
> @@ -21,6 +25,9 @@ reset_tracer
>  do_reset
>  
>  echo '*:*' > set_event
> +
> +yield
> +
>  count=`cat trace | grep -v ^# | wc -l`
>  if [ $count -eq 0 ]; then
>      fail "none of events are recorded"
> @@ -29,6 +36,9 @@ fi
>  do_reset
>  
>  echo 1 > events/enable
> +
> +yield
> +
>  count=`cat trace | grep -v ^# | wc -l`
>  if [ $count -eq 0 ]; then
>      fail "none of events are recorded"
> @@ -37,6 +47,9 @@ fi
>  do_reset
>  
>  echo 0 > events/enable
> +
> +yield
> +
>  count=`cat trace | grep -v ^# | wc -l`
>  if [ $count -ne 0 ]; then
>      fail "any of events should not be recorded"
> 


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com



  reply	other threads:[~2015-04-02  5:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02  4:24 [PATCH v2] ftracetest: Do not use usleep directly Namhyung Kim
2015-04-02  4:34 ` [PATCH v2.1] " Namhyung Kim
2015-04-02  5:58   ` Masami Hiramatsu [this message]
2015-04-02 13:38     ` Steven Rostedt
2015-04-02 14:20       ` Shuah Khan
2015-04-02 15:08         ` Steven Rostedt
2015-04-02 16:30           ` Shuah Khan
2015-04-02 16:48             ` Steven Rostedt
2015-04-02 16:52               ` Shuah Khan
2015-04-02 17:26                 ` Steven Rostedt

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=551CDA6C.50106@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=P@draigBrady.com \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luis.henriques@canonical.com \
    --cc=mpe@ellerman.id.au \
    --cc=namhyung@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=shuahkh@osg.samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox