usleep is a Fedoraism, it's not generally available on Debian based
systems AFAICS.
GNU sleep accepts a floating point argument, so use that instead.
Signed-off-by: Michael Ellerman <[email protected]>
---
tools/testing/selftests/ftrace/test.d/event/event-enable.tc | 6 +++---
tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc | 6 +++---
2 files changed, 6 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..c5343add3407 100644
--- a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
@@ -21,7 +21,7 @@ reset_tracer
do_reset
echo 'sched:sched_switch' > set_event
-usleep 1
+sleep 0.000001
count=`cat trace | grep sched_switch | wc -l`
if [ $count -eq 0 ]; then
@@ -31,7 +31,7 @@ fi
do_reset
echo 1 > events/sched/sched_switch/enable
-usleep 1
+sleep 0.000001
count=`cat trace | grep sched_switch | wc -l`
if [ $count -eq 0 ]; then
@@ -41,7 +41,7 @@ fi
do_reset
echo 0 > events/sched/sched_switch/enable
-usleep 1
+sleep 0.000001
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..84a2020d4e7b 100644
--- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
+++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
@@ -21,7 +21,7 @@ reset_tracer
do_reset
echo 'sched:*' > set_event
-usleep 1
+sleep 0.000001
count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
if [ $count -lt 3 ]; then
@@ -31,7 +31,7 @@ fi
do_reset
echo 1 > events/sched/enable
-usleep 1
+sleep 0.000001
count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
if [ $count -lt 3 ]; then
@@ -41,7 +41,7 @@ fi
do_reset
echo 0 > events/sched/enable
-usleep 1
+sleep 0.000001
count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
if [ $count -ne 0 ]; then
--
1.9.1
Hi Michael,
On Wed, Dec 10, 2014 at 1:38 PM, Michael Ellerman <[email protected]> wrote:
> usleep is a Fedoraism, it's not generally available on Debian based
> systems AFAICS.
>
> GNU sleep accepts a floating point argument, so use that instead.
I tested it on busybox not Debian, sorry. But it seems busybox's
sleep doesn't support floating point argument..
/ # ls -l `which sleep`
lrwxrwxrwx 1 root rooot 7 May 22 2014 /bin/sleep -> busybox
/ # sleep 0.1
sleep: invalid number '0.1'
Thanks,
Namhyung
Hi,
(2014/12/10 17:19), Namhyung Kim wrote:
> Hi Michael,
>
> On Wed, Dec 10, 2014 at 1:38 PM, Michael Ellerman <[email protected]> wrote:
>> usleep is a Fedoraism, it's not generally available on Debian based
>> systems AFAICS.
>>
>> GNU sleep accepts a floating point argument, so use that instead.
>
> I tested it on busybox not Debian, sorry. But it seems busybox's
> sleep doesn't support floating point argument..
>
> / # ls -l `which sleep`
> lrwxrwxrwx 1 root rooot 7 May 22 2014 /bin/sleep -> busybox
>
> / # sleep 0.1
> sleep: invalid number '0.1'
I also have same result. Basically, ftracetest should be able to run on busybox.
So, I think we'd better check whether usleep is available, and if not, fallback
to sleep like as below.
if which usleep &> /dev/null; then
usleep 1
else
sleep 0.000001
fi
Thank you,
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]
On Thu, 2014-12-11 at 14:12 +0900, Masami Hiramatsu wrote:
> Hi,
>
> (2014/12/10 17:19), Namhyung Kim wrote:
> > Hi Michael,
> >
> > On Wed, Dec 10, 2014 at 1:38 PM, Michael Ellerman <[email protected]> wrote:
> >> usleep is a Fedoraism, it's not generally available on Debian based
> >> systems AFAICS.
> >>
> >> GNU sleep accepts a floating point argument, so use that instead.
> >
> > I tested it on busybox not Debian, sorry. But it seems busybox's
> > sleep doesn't support floating point argument..
> >
> > / # ls -l `which sleep`
> > lrwxrwxrwx 1 root rooot 7 May 22 2014 /bin/sleep -> busybox
> >
> > / # sleep 0.1
> > sleep: invalid number '0.1'
>
> I also have same result. Basically, ftracetest should be able to run on busybox.
Yeah OK.
> So, I think we'd better check whether usleep is available, and if not, fallback
> to sleep like as below.
>
> if which usleep &> /dev/null; then
> usleep 1
> else
> sleep 0.000001
> fi
Why do we need to call (u)sleep anyway? It's generally a bad sign when tests
use sleep as it's asking for random timing related failures to creep in.
cheers
On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> usleep is a Fedoraism, it's not generally available on Debian based
> systems AFAICS.
>
> GNU sleep accepts a floating point argument, so use that instead.
>
> Signed-off-by: Michael Ellerman <[email protected]>
Could ftrace user interface be enhanced not to need random delays?
Pavel
> ---
> tools/testing/selftests/ftrace/test.d/event/event-enable.tc | 6 +++---
> tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc | 6 +++---
> 2 files changed, 6 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..c5343add3407 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/event-enable.tc
> @@ -21,7 +21,7 @@ reset_tracer
> do_reset
>
> echo 'sched:sched_switch' > set_event
> -usleep 1
> +sleep 0.000001
>
> count=`cat trace | grep sched_switch | wc -l`
> if [ $count -eq 0 ]; then
> @@ -31,7 +31,7 @@ fi
> do_reset
>
> echo 1 > events/sched/sched_switch/enable
> -usleep 1
> +sleep 0.000001
>
> count=`cat trace | grep sched_switch | wc -l`
> if [ $count -eq 0 ]; then
> @@ -41,7 +41,7 @@ fi
> do_reset
>
> echo 0 > events/sched/sched_switch/enable
> -usleep 1
> +sleep 0.000001
>
> 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..84a2020d4e7b 100644
> --- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> +++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc
> @@ -21,7 +21,7 @@ reset_tracer
> do_reset
>
> echo 'sched:*' > set_event
> -usleep 1
> +sleep 0.000001
>
> count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
> if [ $count -lt 3 ]; then
> @@ -31,7 +31,7 @@ fi
> do_reset
>
> echo 1 > events/sched/enable
> -usleep 1
> +sleep 0.000001
>
> count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
> if [ $count -lt 3 ]; then
> @@ -41,7 +41,7 @@ fi
> do_reset
>
> echo 0 > events/sched/enable
> -usleep 1
> +sleep 0.000001
>
> count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
> if [ $count -ne 0 ]; then
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Sat, 20 Dec 2014 21:42:13 +0100
Pavel Machek <[email protected]> wrote:
> On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> > usleep is a Fedoraism, it's not generally available on Debian based
> > systems AFAICS.
> >
> > GNU sleep accepts a floating point argument, so use that instead.
> >
> > Signed-off-by: Michael Ellerman <[email protected]>
>
> Could ftrace user interface be enhanced not to need random delays?
>
Not sure what you are talking about. These "random delays" are not for
the interface, but instead to force some events to happen and to make
sure they did.
As the subject states, this is for "ftracetest" which is the selftests
for ftrace.
The usleep is basically a "do something to trigger events", and we
don't want to wait long in doing it.
-- Steve
On Sat, Dec 20, 2014 at 05:07:25PM -0500, Steven Rostedt wrote:
> On Sat, 20 Dec 2014 21:42:13 +0100
> Pavel Machek <[email protected]> wrote:
>
> > On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> > > usleep is a Fedoraism, it's not generally available on Debian based
> > > systems AFAICS.
> > >
> > > GNU sleep accepts a floating point argument, so use that instead.
> > >
> > > Signed-off-by: Michael Ellerman <[email protected]>
> >
> > Could ftrace user interface be enhanced not to need random delays?
> >
>
> Not sure what you are talking about. These "random delays" are not for
> the interface, but instead to force some events to happen and to make
> sure they did.
>
> As the subject states, this is for "ftracetest" which is the selftests
> for ftrace.
>
> The usleep is basically a "do something to trigger events", and we
> don't want to wait long in doing it.
Right. AFAIK what ftracetest expects is a scheduler event so it
doesn't need to be the [u]sleep.
Thanks,
Namhyung
On Tue, 2014-12-23 at 13:21 +0900, Namhyung Kim wrote:
> On Sat, Dec 20, 2014 at 05:07:25PM -0500, Steven Rostedt wrote:
> > On Sat, 20 Dec 2014 21:42:13 +0100
> > Pavel Machek <[email protected]> wrote:
> >
> > > On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> > > > usleep is a Fedoraism, it's not generally available on Debian based
> > > > systems AFAICS.
> > > >
> > > > GNU sleep accepts a floating point argument, so use that instead.
> > > >
> > > > Signed-off-by: Michael Ellerman <[email protected]>
> > >
> > > Could ftrace user interface be enhanced not to need random delays?
> > >
> >
> > Not sure what you are talking about. These "random delays" are not for
> > the interface, but instead to force some events to happen and to make
> > sure they did.
> >
> > As the subject states, this is for "ftracetest" which is the selftests
> > for ftrace.
> >
> > The usleep is basically a "do something to trigger events", and we
> > don't want to wait long in doing it.
>
> Right. AFAIK what ftracetest expects is a scheduler event so it
> doesn't need to be the [u]sleep.
Would /bin/true work in that case?
cheers
(2014/12/23 16:08), Michael Ellerman wrote:
> On Tue, 2014-12-23 at 13:21 +0900, Namhyung Kim wrote:
>> On Sat, Dec 20, 2014 at 05:07:25PM -0500, Steven Rostedt wrote:
>>> On Sat, 20 Dec 2014 21:42:13 +0100
>>> Pavel Machek <[email protected]> wrote:
>>>
>>>> On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
>>>>> usleep is a Fedoraism, it's not generally available on Debian based
>>>>> systems AFAICS.
>>>>>
>>>>> GNU sleep accepts a floating point argument, so use that instead.
>>>>>
>>>>> Signed-off-by: Michael Ellerman <[email protected]>
>>>>
>>>> Could ftrace user interface be enhanced not to need random delays?
>>>>
>>>
>>> Not sure what you are talking about. These "random delays" are not for
>>> the interface, but instead to force some events to happen and to make
>>> sure they did.
>>>
>>> As the subject states, this is for "ftracetest" which is the selftests
>>> for ftrace.
>>>
>>> The usleep is basically a "do something to trigger events", and we
>>> don't want to wait long in doing it.
>>
>> Right. AFAIK what ftracetest expects is a scheduler event so it
>> doesn't need to be the [u]sleep.
>
> Would /bin/true work in that case?
As other scripts doing, just (echo "forked") would be enough. It forks
sub shell and wait for that.
Please check test.d/kprobe/kprobe_args.tc
Thanks!
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]
On Sat 2014-12-20 17:07:25, Steven Rostedt wrote:
> On Sat, 20 Dec 2014 21:42:13 +0100
> Pavel Machek <[email protected]> wrote:
>
> > On Wed 2014-12-10 15:38:27, Michael Ellerman wrote:
> > > usleep is a Fedoraism, it's not generally available on Debian based
> > > systems AFAICS.
> > >
> > > GNU sleep accepts a floating point argument, so use that instead.
> > >
> > > Signed-off-by: Michael Ellerman <[email protected]>
> >
> > Could ftrace user interface be enhanced not to need random delays?
> >
>
> Not sure what you are talking about. These "random delays" are not for
> the interface, but instead to force some events to happen and to make
> sure they did.
>
> As the subject states, this is for "ftracetest" which is the selftests
> for ftrace.
>
> The usleep is basically a "do something to trigger events", and we
> don't want to wait long in doing it.
Yep, I misunderstood, sorry.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html