Remove redhat'ism from ftrace selftests.
PATCH 1/1 Remove redhat'ism from ftrace selftests.
usleep(1) is a Red Hat'ism (bizarrely provided by initscripts), that isn't available on other distributions.
To make this work elsewhere, convert to using fractional shell sleeps.
tools/testing/selftests/ftrace/test.d/event/event-enable.tc +3 -3
@@ -21,7 +21,7 @@ reset_tracer do_reset echo 'sched:sched_switch' > set_event -usleep 1 +sleep 0.1 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.1 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.1 count=`cat trace | grep sched_switch | wc -l` if [ $count -ne 0 ]; then
tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc +3 -3
@@ -21,7 +21,7 @@ reset_tracer do_reset echo 'sched:*' > set_event -usleep 1 +sleep 0.1 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.1 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.1 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` if [ $count -ne 0 ]; then
Shuah,
Can you take this in your tree?
Quoted 7 lines · On Tue, 24 Feb 2015 11:19:27 -0500 Dave Jones <[email protected]> wrote:
usleep(1) is a Red Hat'ism (bizarrely provided by initscripts), that isn't available on other distributions.
To make this work elsewhere, convert to using fractional shell sleeps.Signed-off-by Dave Jones <[email protected]>
-- Steve
Quoted 62 lines
tools/testing/selftests/ftrace/test.d/event/event-enable.tc +3
-3@@ -21,7 +21,7 @@ reset_tracer do_reset echo 'sched:sched_switch' > set_event -usleep 1 +sleep 0.1 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.1 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.1 count=`cat trace | grep sched_switch | wc -l` if [ $count -ne 0 ]; thentools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc +3
-3@@ -21,7 +21,7 @@ reset_tracer do_reset echo 'sched:*' > set_event -usleep 1 +sleep 0.1 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.1 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.1 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` if [ $count -ne 0 ]; then
Quoted 4 lines · Steven Rostedt
Shuah,
Can you take this in your tree?
Yes I can do that. This must be the original patch email:
https://lkml.org/lkml/2015/2/24/435
-- Shuah
Quoted 79 lines
Quoted 7 lines · On Tue, 24 Feb 2015 11:19:27 -0500 Dave Jones <[email protected]> wrote:
usleep(1) is a Red Hat'ism (bizarrely provided by initscripts), that isn't available on other distributions.
To make this work elsewhere, convert to using fractional shell sleeps.Signed-off-by Dave Jones <[email protected]>Acked-by Steven Rostedt <[email protected]>-- Steve
Quoted 62 lines
tools/testing/selftests/ftrace/test.d/event/event-enable.tc +3
-3@@ -21,7 +21,7 @@ reset_tracer do_reset echo 'sched:sched_switch' > set_event -usleep 1 +sleep 0.1 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.1 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.1 count=`cat trace | grep sched_switch | wc -l` if [ $count -ne 0 ]; thentools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc +3
-3@@ -21,7 +21,7 @@ reset_tracer do_reset echo 'sched:*' > set_event -usleep 1 +sleep 0.1 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.1 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.1 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` if [ $count -ne 0 ]; then
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 8 lines · Shuah Khan
Quoted 4 lines · Steven Rostedt
Shuah,
Can you take this in your tree?
Yes I can do that. This must be the original patch email:
https://lkml.org/lkml/2015/2/24/435
Correct.
Dave
Hi,
Quoted 9 lines · Dave Jones
Quoted 8 lines · Shuah Khan
Quoted 4 lines · Steven Rostedt
Shuah,
Can you take this in your tree?
Yes I can do that. This must be the original patch email:
https://lkml.org/lkml/2015/2/24/435
Please see below links:
https://lkml.org/lkml/2014/12/10/52
https://lkml.org/lkml/2014/12/22/556
I think we can get rid of the (u)sleeps entirely since 'cat trace' itself should trigger scheduler events.
Thanks,
Namhyung
Quoted 13 lines · Namhyung Kim
Hi,
Quoted 9 lines · Dave Jones
Quoted 8 lines · Shuah Khan
Quoted 4 lines · Steven Rostedt
Shuah,
Can you take this in your tree?
Yes I can do that. This must be the original patch email:
https://lkml.org/lkml/2015/2/24/435
Quoted 8 lines
Please see below links:
https://lkml.org/lkml/2014/12/10/52
https://lkml.org/lkml/2014/12/22/556I think we can get rid of the (u)sleeps entirely since 'cat trace' itself should trigger scheduler events.
Steve/Dave,
Still good to take it through. The discussion in the threads Namhyung Kim pointed to seem to be inconclusive.
The only difference between the original patch
https://lkml.org/lkml/2014/12/9/780
and
https://lkml.org/lkml/2015/2/24/435
is sleep duration change. I can take through my tree
https://lkml.org/lkml/2015/2/24/435
just confirming.
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 30 lines · Shuah Khan
Quoted 11 lines · Namhyung Kim
Quoted 9 lines · Dave Jones
Quoted 8 lines · Shuah Khan
Quoted 4 lines · Steven Rostedt
Shuah,
Can you take this in your tree?
Yes I can do that. This must be the original patch email:
https://lkml.org/lkml/2015/2/24/435Quoted 7 lines
Please see below links:
https://lkml.org/lkml/2014/12/10/52
https://lkml.org/lkml/2014/12/22/556I think we can get rid of the (u)sleeps entirely since 'cat trace' itself should trigger scheduler events.
Steve/Dave,
Still good to take it through. The discussion in the threads Namhyung Kim pointed to seem to be inconclusive.
The only difference between the original patch
https://lkml.org/lkml/2014/12/9/780
and
https://lkml.org/lkml/2015/2/24/435
Quoted 4 lines
is sleep duration change. I can take through my tree
https://lkml.org/lkml/2015/2/24/435just confirming.
No, the resoultion was that busybox doesn't support fractional sleeps and so using them is not a solution.
I thought /bin/true would work, but never got around to testing it. The other option was to use (echo "forked"):
https://lkml.org/lkml/2014/12/23/447
cheers
Hello,
Quoted 36 lines · Michael Ellerman
Quoted 30 lines · Shuah Khan
Quoted 11 lines · Namhyung Kim
Quoted 9 lines · Dave Jones
Quoted 8 lines · Shuah Khan
Quoted 4 lines · Steven Rostedt
Shuah,
Can you take this in your tree?
Yes I can do that. This must be the original patch email:
https://lkml.org/lkml/2015/2/24/435Quoted 7 lines
Please see below links:
https://lkml.org/lkml/2014/12/10/52
https://lkml.org/lkml/2014/12/22/556I think we can get rid of the (u)sleeps entirely since 'cat trace' itself should trigger scheduler events.
Steve/Dave,
Still good to take it through. The discussion in the threads Namhyung Kim pointed to seem to be inconclusive.
The only difference between the original patch
https://lkml.org/lkml/2014/12/9/780
and
https://lkml.org/lkml/2015/2/24/435Quoted 4 lines
is sleep duration change. I can take through my tree
https://lkml.org/lkml/2015/2/24/435just confirming.
Quoted 7 lines
No, the resoultion was that busybox doesn't support fractional sleeps and so using them is not a solution.
I thought
/bin/truewould work, but never got around to testing it. The other option was to use (echo "forked"):
I think that there's no need to even call true or echo..
Quoted 1 line
From
0549544e8e982df6478f11e2b4fe419f94c22434Mon Sep 17 00:00:00 2001
From: Namhyung Kim <[email protected]>
Date: Wed, 4 Mar 2015 21:26:38 +0900
Subject: [PATCH] ftracetest: Do not use usleep
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. But as we use 'cat trace | grep | wc -l' to read the events, the command themselves already generate some events before reading the trace file so no need to call [u]sleep explicitly.
--- tools/testing/selftests/ftrace/test.d/event/event-enable.tc | 3 --- tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc | 3 --- 2 files changed, 6 deletions(-)
tools/testing/selftests/ftrace/test.d/event/event-enable.tc +0 -3
@@ -21,7 +21,6 @@ reset_tracer do_reset echo 'sched:sched_switch' > set_event -usleep 1 count=`cat trace | grep sched_switch | wc -l` if [ $count -eq 0 ]; then
@@ -31,7 +30,6 @@ fi do_reset echo 1 > events/sched/sched_switch/enable -usleep 1 count=`cat trace | grep sched_switch | wc -l` if [ $count -eq 0 ]; then
@@ -41,7 +39,6 @@ fi do_reset echo 0 > events/sched/sched_switch/enable -usleep 1 count=`cat trace | grep sched_switch | wc -l` if [ $count -ne 0 ]; then
tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc +0 -3
@@ -21,7 +21,6 @@ reset_tracer do_reset echo 'sched:*' > set_event -usleep 1 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` if [ $count -lt 3 ]; then
@@ -31,7 +30,6 @@ fi do_reset echo 1 > events/sched/enable -usleep 1 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` if [ $count -lt 3 ]; then
@@ -41,7 +39,6 @@ fi do_reset echo 0 > events/sched/enable -usleep 1 count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` if [ $count -ne 0 ]; then
Signature · 1 line
2.3.1
Michael Ellerman
Tested-byQuoted 11 lines · Namhyung Kim
I think that there's no need to even call true or echo..
From
0549544e8e982df6478f11e2b4fe419f94c22434Mon Sep 17 00:00:00 2001
From: Namhyung Kim <[email protected]>
Date: Wed, 4 Mar 2015 21:26:38 +0900
Subject: [PATCH] ftracetest: Do not use usleepThe usleep is only provided on distros from Redhat so running ftracetest on other distro resulted in failures due to the missing usleep.
Quoted 8 lines
The reason of using [u]sleep in the test was to generate (scheduler) events. But as we use 'cat trace | grep | wc -l' to read the events, the command themselves already generate some events before reading the trace file so no need to call [u]sleep explicitly.
Reported-by Michael Ellerman <[email protected]>Reported-by Dave Jones <[email protected]>Signed-off-by Namhyung Kim <[email protected]>
Thanks, this is working for me.
$ cat /etc/issue Ubuntu 14.10 \n \l $ git log -2 --pretty=oneline 385a914624fc9fb6d0ccc3d2fd3a12ebd1ece7dd ftracetest: Do not use usleep a6c5170d1edea97c538c81e377e56c7b5c5b7e63 Merge branch 'for-4.0' of git://linux-nfs.org/~bfields/linux $ sudo ./ftracetest === Ftrace unit tests === [1] Basic trace file check [PASS] [2] Basic test for tracers [PASS] [3] Basic trace clock test [PASS] [4] Basic event tracing check [PASS] [5] event tracing - enable/disable with event level files [PASS] [6] event tracing - enable/disable with subsystem level files [PASS] [7] event tracing - enable/disable with top level files [PASS] [8] ftrace - function graph filters with stack tracer [PASS] [9] ftrace - function graph filters [PASS] [10] ftrace - function profiler with function tracing [PASS] [11] Kprobe dynamic event - adding and removing [PASS] [12] Kprobe dynamic event - busy event check [PASS] [13] Kprobe dynamic event with arguments [PASS] [14] Kprobe dynamic event with function tracer [PASS] [15] Kretprobe dynamic event with arguments [PASS]
# of passed: 15 # of failed: 0 # of unresolved: 0 # of untested: 0 # of unsupported: 0 # of xfailed: 0 # of undefined(test bug): 0
cheers
Quoted 17 lines · Michael Ellerman
Quoted 16 lines · Namhyung Kim
I think that there's no need to even call true or echo..
From
0549544e8e982df6478f11e2b4fe419f94c22434Mon Sep 17 00:00:00 2001
From: Namhyung Kim <[email protected]>
Date: Wed, 4 Mar 2015 21:26:38 +0900
Subject: [PATCH] ftracetest: Do not use usleepThe 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. But as we use 'cat trace | grep | wc -l' to read the events, the command themselves already generate some events before reading the trace file so no need to call [u]sleep explicitly.
Quoted 8 lines
Quoted 3 lines
Reported-by Michael Ellerman <[email protected]>Reported-by Dave Jones <[email protected]>Signed-off-by Namhyung Kim <[email protected]>Thanks, this is working for me.
Tested-by Michael Ellerman <[email protected]>
Steve,
Do you want to make a call on which one you want me to take it through between these two patches - one from Dave and the other from Namhyung Kim.
Please send me the patch I have to pull in. Namhyung Kim's patch isn't in the format I can apply and I don't have Dave's patch in my inbox.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 29 lines · Shuah Khan
Quoted 17 lines · Michael Ellerman
Quoted 16 lines · Namhyung Kim
I think that there's no need to even call true or echo..
From
0549544e8e982df6478f11e2b4fe419f94c22434Mon Sep 17 00:00:00 2001
From: Namhyung Kim <[email protected]>
Date: Wed, 4 Mar 2015 21:26:38 +0900
Subject: [PATCH] ftracetest: Do not use usleepThe 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. But as we use 'cat trace | grep | wc -l' to read the events, the command themselves already generate some events before reading the trace file so no need to call [u]sleep explicitly.
Quoted 8 lines
Quoted 3 lines
Reported-by Michael Ellerman <[email protected]>Reported-by Dave Jones <[email protected]>Signed-off-by Namhyung Kim <[email protected]>Thanks, this is working for me.
Tested-by Michael Ellerman <[email protected]>Steve,
Quoted 7 lines
Do you want to make a call on which one you want me to take it through between these two patches - one from Dave and the other from Namhyung Kim.
Please send me the patch I have to pull in. Namhyung Kim's patch isn't in the format I can apply and I don't have Dave's patch in my inbox.
Removing it entirely sounds like a much better choice, so I'd wait for Namhyung to resend.
Dave
Steven Rostedt
maintainerQuoted 1 line · On Wed, 4 Mar 2015 21:44:57 +0900 Namhyung Kim <[email protected]> wrote:
I think that there's no need to even call true or echo..
Ideally it shouldn't. But I if you noticed it expects 3 or more events in some cases. I believe without the sleep it would sometimes fail that.
Is there a small command we can run just to do something? I rather have that then nothing at all. I added those sleeps a while ago (in my original tests), because every so often it would fail a test due to not enough going on.
-- Steve
Steven Rostedt
maintainerQuoted 2 lines · On Thu, 5 Mar 2015 10:17:04 -0500 Dave Jones <[email protected]> wrote:
Removing it entirely sounds like a much better choice, so I'd wait for Namhyung to resend.
Removing or just doing something small may be better. Those sleeps were added to my original tests because it sometimes had false failures.
But that was a long time ago. Maybe they are not needed. It really doesn't matter much to me, as long as there's no false failures. I'm still running my original tests.
-- Steve