public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Theodore Tso <tytso@mit.edu>,
	Alexei Starovoitov <ast@plumgrid.com>
Subject: Re: [PATCH 3/3] ftracetests: Add test to test event filter logic
Date: Thu, 04 Dec 2014 08:14:01 +0900	[thread overview]
Message-ID: <547F9939.7010207@hitachi.com> (raw)
In-Reply-To: <20141203043423.6c7e4524@gandalf.local.home>

(2014/12/03 18:34), Steven Rostedt wrote:
> On Wed, 03 Dec 2014 18:26:43 +0900
> Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> wrote:
> 
>> (2014/12/03 12:13), Steven Rostedt wrote:
>>> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
>>>
>>> Add a test to test the event filter logic. It currently tests the
>>> following filters against sched:sched_switch event.
>>>
>>>    ( prev_pid != 0 )
>>>    ( prev_pid == 0 )
>>>    ( prev_pid < 100 )
>>>    ( prev_pid <= $$ )
>>>    ( prev_pid > 100 )
>>>    ( prev_pid >= $$ )
>>>   ! ( prev_pid != 0 )
>>>   ! ( prev_pid == 0 )
>>>   ! ( prev_pid < 100 )
>>>   ! ( prev_pid <= $$ )
>>>   ! ( prev_pid > 100 )
>>>   ! ( prev_pid >= $$ )
>>>    ( prev_pid != 0 && next_pid > 10 )
>>>    ( prev_pid != 0 || next_pid > 10 )
>>>   ! ( prev_pid != 0 && next_pid > 10 )
>>>   ! ( prev_pid != 0 || next_pid > 10 )
>>>    ( prev_pid & 1 )
>>>    ( prev_pid & 2 )
>>>    ( prev_pid & 4 )
>>>    ( prev_pid & 8 )
>>>    ( prev_pid & 16 )
>>>   ! ( prev_pid & 1 )
>>>   ! ( prev_pid & 2 )
>>>   ! ( prev_pid & 4 )
>>>   ! ( prev_pid & 8 )
>>>   ! ( prev_pid & 16 )
>>>    ( next_comm ~ "ftrace-test-fil" )
>>>    ( next_comm != "ftrace-test-fil" )
>>>   ! ( next_comm ~ "ftrace-test-fil" )
>>>   ! ( next_comm != "ftrace-test-fil" )
>>>
>>
>> Hmm, this uses some bash-only syntax, here is the result of checkbashisms.
>>
>> # checkbashisms tools/testing/selftests/ftrace/test.d/ftrace/filter.tc
>> possible bashism in tools/testing/selftests/ftrace/test.d/ftrace/filter.tc line 70 (should be 'b = a'):
>>             if [ "$not" == '!' ]; then
>> possible bashism in tools/testing/selftests/ftrace/test.d/ftrace/filter.tc line 99 (should be 'b = a'):
>>             if [ "$not" == '!' ]; then
>> possible bashism in tools/testing/selftests/ftrace/test.d/ftrace/filter.tc line 137 (let ...):
>>     let x=1
>> possible bashism in tools/testing/selftests/ftrace/test.d/ftrace/filter.tc line 148 (let ...):
>>             let val="$pid & $x"
>> possible bashism in tools/testing/selftests/ftrace/test.d/ftrace/filter.tc line 155 (should be 'b = a'):
>>             elif [ "$not" == '!' ]; then
>> possible bashism in tools/testing/selftests/ftrace/test.d/ftrace/filter.tc line 160 (let ...):
>>         let x="$x << 1"
>> possible bashism in tools/testing/selftests/ftrace/test.d/ftrace/filter.tc line 182 (should be 'b = a'):
>>             if [ "$not" == '!' ]; then
>>
>> to allow run this on busybox or dash, we'd better clean it.
> 
> Do you know how to fix this?

Yes, it's easy :).
As the tool output, [ a == b ] can be changed to [ a = b ],
and "let ..." can be changed to "$((...))"

> 
>>
>>> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
>>> ---
>> [...]
>>> +# Test more complex compares (&& and !!)
>>> +test_cmp2 -ne 0 -a -gt 10 "!= 0" "> 10" "&&" ''
>>> +test_cmp2 -ne 0 -o -gt 10 "!= 0" "> 10" "||" ''
>>
>> This might better be
>> test_cmp2 -ne 0 -a -gt 10 "!= 0" "&&" "> 10" ''
>> test_cmp2 -ne 0 -o -gt 10 "!= 0" "||" "> 10" ''
>>
>> :-)
> 
> Sure.
> 
> OK, I'll hold off on sending this patch then till 3.20.

OK.

> 
> I'll still add the update to the kernel for 3.19, but the testing for
> it needs work. It passes my test suite, but I don't know how to handle
> the busybox limitations.

If you are using Fedora, it provides dash and busybox packages too.

Thank you,


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



  parent reply	other threads:[~2014-12-03 23:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03  3:13 [PATCH 0/3] tracing: Add event filter logic for !(...) Steven Rostedt
2014-12-03  3:13 ` [PATCH 1/3] tracing: Add NOT to filtering logic Steven Rostedt
2014-12-03  3:13 ` [PATCH 2/3] tracing: Allow NOT to filter AND and OR clauses Steven Rostedt
2014-12-03  3:13 ` [PATCH 3/3] ftracetests: Add test to test event filter logic Steven Rostedt
2014-12-03  6:22   ` Alexei Starovoitov
2014-12-03  8:40     ` Steven Rostedt
2014-12-03 17:53       ` Alexei Starovoitov
2014-12-03 18:01         ` Steven Rostedt
2014-12-03  9:26   ` Masami Hiramatsu
2014-12-03  9:34     ` Steven Rostedt
2014-12-03 16:20       ` Steven Rostedt
2014-12-04  8:12         ` Masami Hiramatsu
2014-12-03 23:14       ` Masami Hiramatsu [this message]
2014-12-03 23:29         ` Steven Rostedt
2014-12-04  3:18         ` [PATCH v2] " Steven Rostedt
2014-12-04 10:06           ` Masami Hiramatsu
2014-12-04 12:04             ` 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=547F9939.7010207@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=akpm@linux-foundation.org \
    --cc=ast@plumgrid.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tytso@mit.edu \
    /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