Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1405587 > unrolled thread
| Started by | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| First post | 2016-05-23 21:20 +0200 |
| Last post | 2016-05-24 05:10 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[RFC][PATCH] ftracetest: Fix hist unsupported result in hist selftests Steven Rostedt <rostedt@goodmis.org> - 2016-05-23 21:20 +0200
Re: [RFC][PATCH] ftracetest: Fix hist unsupported result in hist selftests Namhyung Kim <namhyung@kernel.org> - 2016-05-24 02:00 +0200
Re: [RFC][PATCH] ftracetest: Fix hist unsupported result in hist selftests Steven Rostedt <rostedt@goodmis.org> - 2016-05-24 04:00 +0200
Re: [RFC][PATCH] ftracetest: Fix hist unsupported result in hist selftests Namhyung Kim <namhyung@kernel.org> - 2016-05-24 04:20 +0200
Re: [RFC][PATCH] ftracetest: Fix hist unsupported result in hist selftests Steven Rostedt <rostedt@goodmis.org> - 2016-05-24 04:40 +0200
Re: [RFC][PATCH] ftracetest: Fix hist unsupported result in hist selftests Namhyung Kim <namhyung@kernel.org> - 2016-05-24 05:10 +0200
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2016-05-23 21:20 +0200 |
| Subject | [RFC][PATCH] ftracetest: Fix hist unsupported result in hist selftests |
| Message-ID | <rC3yp-1sr-7@gated-at.bofh.it> |
[ Folks, is this a proper work around? ]
When histograms are not configured in the kernel, the ftracetest histogram
selftests should return "unsupported" and not "Failed". To detect this, the
test scripts have:
FEATURE=`grep hist events/sched/sched_process_fork/trigger`
if [ -z "$FEATURE" ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
The problem is that '-e' is in effect and any error will cause the program
to terminate. The grep for 'hist' fails, because it is not compiled it (thus
unsupported), but because grep has an error code for failing to find the
string, it causes the program to terminate, and is marked as a failed test.
As a work around, I added "|| echo -n ''" to not let bash terminate the
script on a failed grep, and then the rest of the script can handle the fact
that histograms are not supported and return a proper result.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc | 2 +-
tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc | 2 +-
tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
index c2b61c4fda11..6c100759c758 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
@@ -26,7 +26,7 @@ fi
reset_tracer
do_reset
-FEATURE=`grep hist events/sched/sched_process_fork/trigger`
+FEATURE=`grep hist events/sched/sched_process_fork/trigger || echo -n ''`
if [ -z "$FEATURE" ]; then
echo "hist trigger is not supported"
exit_unsupported
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
index b2902d42a537..8d691dc0c5cc 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
@@ -26,7 +26,7 @@ fi
reset_tracer
do_reset
-FEATURE=`grep hist events/sched/sched_process_fork/trigger`
+FEATURE=`grep hist events/sched/sched_process_fork/trigger || echo -n ''`
if [ -z "$FEATURE" ]; then
echo "hist trigger is not supported"
exit_unsupported
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
index 03c4a46561fc..1a11e641e97d 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
@@ -26,7 +26,7 @@ fi
reset_tracer
do_reset
-FEATURE=`grep hist events/sched/sched_process_fork/trigger`
+FEATURE=`grep hist events/sched/sched_process_fork/trigger || echo -n ''`
if [ -z "$FEATURE" ]; then
echo "hist trigger is not supported"
exit_unsupported
--
1.8.3.1
[toc] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-05-24 02:00 +0200 |
| Message-ID | <rC7Vo-3YJ-15@gated-at.bofh.it> |
| In reply to | #1405587 |
Hi Steve,
On Mon, May 23, 2016 at 03:15:38PM -0400, Steven Rostedt wrote:
>
> [ Folks, is this a proper work around? ]
>
> When histograms are not configured in the kernel, the ftracetest histogram
> selftests should return "unsupported" and not "Failed". To detect this, the
> test scripts have:
>
> FEATURE=`grep hist events/sched/sched_process_fork/trigger`
> if [ -z "$FEATURE" ]; then
> echo "hist trigger is not supported"
> exit_unsupported
> fi
>
> The problem is that '-e' is in effect and any error will cause the program
> to terminate. The grep for 'hist' fails, because it is not compiled it (thus
> unsupported), but because grep has an error code for failing to find the
> string, it causes the program to terminate, and is marked as a failed test.
We have a feature check before doing grep, doesn't it detect such
case?
if [ ! -f events/sched/sched_process_fork/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
Thanks,
Namhyung
>
> As a work around, I added "|| echo -n ''" to not let bash terminate the
> script on a failed grep, and then the rest of the script can handle the fact
> that histograms are not supported and return a proper result.
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc | 2 +-
> tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc | 2 +-
> tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
> index c2b61c4fda11..6c100759c758 100644
> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
> @@ -26,7 +26,7 @@ fi
> reset_tracer
> do_reset
>
> -FEATURE=`grep hist events/sched/sched_process_fork/trigger`
> +FEATURE=`grep hist events/sched/sched_process_fork/trigger || echo -n ''`
> if [ -z "$FEATURE" ]; then
> echo "hist trigger is not supported"
> exit_unsupported
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
> index b2902d42a537..8d691dc0c5cc 100644
> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
> @@ -26,7 +26,7 @@ fi
> reset_tracer
> do_reset
>
> -FEATURE=`grep hist events/sched/sched_process_fork/trigger`
> +FEATURE=`grep hist events/sched/sched_process_fork/trigger || echo -n ''`
> if [ -z "$FEATURE" ]; then
> echo "hist trigger is not supported"
> exit_unsupported
> diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
> index 03c4a46561fc..1a11e641e97d 100644
> --- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
> +++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
> @@ -26,7 +26,7 @@ fi
> reset_tracer
> do_reset
>
> -FEATURE=`grep hist events/sched/sched_process_fork/trigger`
> +FEATURE=`grep hist events/sched/sched_process_fork/trigger || echo -n ''`
> if [ -z "$FEATURE" ]; then
> echo "hist trigger is not supported"
> exit_unsupported
> --
> 1.8.3.1
>
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2016-05-24 04:00 +0200 |
| Message-ID | <rC9Nw-54N-5@gated-at.bofh.it> |
| In reply to | #1405727 |
On Tue, 24 May 2016 08:54:38 +0900 Namhyung Kim <namhyung@kernel.org> wrote: > Hi Steve, > > On Mon, May 23, 2016 at 03:15:38PM -0400, Steven Rostedt wrote: > > > > [ Folks, is this a proper work around? ] > > > > When histograms are not configured in the kernel, the ftracetest histogram > > selftests should return "unsupported" and not "Failed". To detect this, the > > test scripts have: > > > > FEATURE=`grep hist events/sched/sched_process_fork/trigger` > > if [ -z "$FEATURE" ]; then > > echo "hist trigger is not supported" > > exit_unsupported > > fi > > > > The problem is that '-e' is in effect and any error will cause the program > > to terminate. The grep for 'hist' fails, because it is not compiled it (thus > > unsupported), but because grep has an error code for failing to find the > > string, it causes the program to terminate, and is marked as a failed test. > > We have a feature check before doing grep, doesn't it detect such > case? > > if [ ! -f events/sched/sched_process_fork/trigger ]; then > echo "event trigger is not supported" > exit_unsupported > fi > Triggers exist, but the "hist" trigger does not, and that's what is being checked. -- Steve
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-05-24 04:20 +0200 |
| Message-ID | <rCa6S-5we-7@gated-at.bofh.it> |
| In reply to | #1405773 |
On Mon, May 23, 2016 at 09:50:45PM -0400, Steven Rostedt wrote: > On Tue, 24 May 2016 08:54:38 +0900 > Namhyung Kim <namhyung@kernel.org> wrote: > > > Hi Steve, > > > > On Mon, May 23, 2016 at 03:15:38PM -0400, Steven Rostedt wrote: > > > > > > [ Folks, is this a proper work around? ] > > > > > > When histograms are not configured in the kernel, the ftracetest histogram > > > selftests should return "unsupported" and not "Failed". To detect this, the > > > test scripts have: > > > > > > FEATURE=`grep hist events/sched/sched_process_fork/trigger` > > > if [ -z "$FEATURE" ]; then > > > echo "hist trigger is not supported" > > > exit_unsupported > > > fi > > > > > > The problem is that '-e' is in effect and any error will cause the program > > > to terminate. The grep for 'hist' fails, because it is not compiled it (thus > > > unsupported), but because grep has an error code for failing to find the > > > string, it causes the program to terminate, and is marked as a failed test. > > > > We have a feature check before doing grep, doesn't it detect such > > case? > > > > if [ ! -f events/sched/sched_process_fork/trigger ]; then > > echo "event trigger is not supported" > > exit_unsupported > > fi > > > > Triggers exist, but the "hist" trigger does not, and that's what is > being checked. Why not checking "hist" file then? Thanks, Namhyung
[toc] | [prev] | [next] | [standalone]
| From | Steven Rostedt <rostedt@goodmis.org> |
|---|---|
| Date | 2016-05-24 04:40 +0200 |
| Message-ID | <rCaqe-5CJ-23@gated-at.bofh.it> |
| In reply to | #1405775 |
On Tue, 24 May 2016 11:16:31 +0900 Namhyung Kim <namhyung@kernel.org> wrote: > Why not checking "hist" file then? I guess that could be done too, but is there anything wrong with my current solution? Or is it just too hacky? How would one check if something exists in a file or not? Say, I want to detect if preemptirqsoff tracer exists or not, and that only happens if I do a grep of current_tracer (I have tests coming that will need to do that)? -- Steve
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2016-05-24 05:10 +0200 |
| Message-ID | <rCaTf-61D-1@gated-at.bofh.it> |
| In reply to | #1405800 |
On Mon, May 23, 2016 at 10:32:43PM -0400, Steven Rostedt wrote: > On Tue, 24 May 2016 11:16:31 +0900 > Namhyung Kim <namhyung@kernel.org> wrote: > > > > Why not checking "hist" file then? > > I guess that could be done too, but is there anything wrong with my > current solution? Or is it just too hacky? How would one check if > something exists in a file or not? Say, I want to detect if > preemptirqsoff tracer exists or not, and that only happens if I do a > grep of current_tracer (I have tests coming that will need to do that)? There's nothing wrong with your approach IMHO. But I think checking existence of a file is clearer and consistent to other tests. For the preemptirqsoff tracer case, it seems there's no other way to check it simply. It's not hacky to me grep-ing contents to check availability of some option. Thanks, Namhyung
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web