Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: Pedro Alves <palves@redhat.com>
Cc: Antoine Tremblay <antoine.tremblay@ericsson.com>,
	<gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/5] Add counter-cases for trace-condition.exp tests
Date: Mon, 30 May 2016 14:20:00 -0000	[thread overview]
Message-ID: <wwokk2ibvd8c.fsf@ericsson.com> (raw)
In-Reply-To: <023899bf-b568-f522-be51-734f3ee2d022@redhat.com>


Pedro Alves writes:

> On 05/27/2016 08:05 PM, Antoine Tremblay wrote:
>> In trace-condition.exp, tests are done by doing a conditional tracepoint
>> and validating that the trace contains all the frames that could be
>> collected if that condition is true.
>> 
>> E.g. test_tracepoints $trace_command "21 + 21 == 42" 10
>> 
>> This will always return true and collect the 10 frames possible to collect
>> with the test program.
>> 
>> However, if the condition evaluation is broken such that the condition is
>> unconditional we will not notice this problem.
>> 
>> This patch adds counter-cases to such conditions like so:
>> 
>> $trace_command "21 + 11 == 42" 0
>> 
>> This way such a problem would be noticed.
>
> Thanks for doing this.
>
>> 
>> gdb/testsuite/ChangeLog:
>> 
>> 	* gdb.trace/trace-condition.exp: Add counter-case tests.
>> ---
>>  gdb/testsuite/gdb.trace/trace-condition.exp | 21 +++++++++++++++++++++
>>  1 file changed, 21 insertions(+)
>> 
>> diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
>> index b7427ca..f9eaf31 100644
>> --- a/gdb/testsuite/gdb.trace/trace-condition.exp
>> +++ b/gdb/testsuite/gdb.trace/trace-condition.exp
>> @@ -157,4 +157,25 @@ foreach trace_command { "trace" "ftrace" } {
>>      test_tracepoints $trace_command "(42 >= 42 ? 0 : 1) == 0" 10
>>      test_tracepoints $trace_command "(42 > 21 ? 0 : 1) == 0" 10 18955_i386_failure
>>      test_tracepoints $trace_command "\$trace_timestamp >= 0" 10
>> +
>> +    # Counter-cases tests.
>> +    test_tracepoints $trace_command "21 + 21 == 11" 0
>> +    test_tracepoints $trace_command "42 - 21 == 11" 0
>> +    test_tracepoints $trace_command "21 * 2 == 11" 0
>> +    test_tracepoints $trace_command "21 << 1 == 11" 0
>> +    test_tracepoints $trace_command "42 >> 1 == 11" 0
>> +    test_tracepoints $trace_command "-(21 << 1) == -11" 0
>> +    test_tracepoints $trace_command "-42 >> 1 == -11" 0
>> +    test_tracepoints $trace_command "(0xabababab & 0x0000ffff) == 0xffff" 0
>> +    test_tracepoints $trace_command "(0xabababab | 0x0000ffff) == 0xeeeedddd" 0
>> +    test_tracepoints $trace_command "(0xaaaaaaaa ^ 0x55555555) == 0xaaaaaaaa" 0
>> +    test_tracepoints $trace_command "~0xaaaaaaaa == 0x11111111" 0
>> +    test_tracepoints $trace_command "61 < 42" 0
>> +    test_tracepoints $trace_command "42 <= 11" 0
>> +    test_tracepoints $trace_command "11 >= 42" 0
>> +    test_tracepoints $trace_command "11 > 21" 0
>> +    test_tracepoints $trace_command "(66 < 42 ? 0 : 1) == 0" 0 18955_i386_failure
>> +    test_tracepoints $trace_command "(66 <= 42 ? 0 : 1) == 0" 0
>> +    test_tracepoints $trace_command "(11 >= 42 ? 0 : 1) == 0" 0
>> +    test_tracepoints $trace_command "(11 > 21 ? 0 : 1) == 0" 0 18955_i386_failure
>
> I'm surprised to see these split into their own section though.
> I'd think it'd be better to keep each along side the corresponding test,
> to make it easier to keep them in sync:
>
>      test_tracepoints $trace_command "21 + 21 == 42" 10
> +    test_tracepoints $trace_command "21 + 21 == 11" 0
>      test_tracepoints $trace_command "42 - 21 == 21" 10
> +    test_tracepoints $trace_command "42 - 21 == 11" 0
>
> etc.
>
> Could you do that?
>

Yes actually I did that at first, but found it very confusing with so
many similar lines together so I continued using another block.

But like you sugested in patch 5 review I can add a line between each
test case/counter.

I'll do that and repost.

Thanks,
Antoine


  reply	other threads:[~2016-05-30 14:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-27 19:05 Antoine Tremblay
2016-05-27 19:05 ` [PATCH 4/5 v2] Add variable length tests for emit_ref in trace-condition.exp Antoine Tremblay
2016-05-30 11:02   ` Pedro Alves
2016-05-27 19:05 ` [PATCH 3/5 v2] Add emit_less_unsigned test " Antoine Tremblay
2016-05-30 11:02   ` Pedro Alves
2016-05-27 19:05 ` [PATCH 2/5 v2] Move trace conditions tests from ftrace.exp to trace-condition.exp Antoine Tremblay
2016-05-30 11:02   ` Pedro Alves
2016-05-27 19:05 ` [PATCH 5/5 v2] Add tests for 64bit values in trace-condition.exp Antoine Tremblay
2016-05-30 11:02   ` Pedro Alves
2016-05-30 14:50     ` [PATCH 5/5 v3] " Antoine Tremblay
2016-05-30 15:06       ` Pedro Alves
2016-05-30 16:55         ` Antoine Tremblay
2016-05-30 10:50 ` [PATCH 1/5] Add counter-cases for trace-condition.exp tests Pedro Alves
2016-05-30 14:20   ` Antoine Tremblay [this message]
2016-05-30 14:48   ` [PATCH 1/5 v3] " Antoine Tremblay
2016-05-30 15:06     ` Pedro Alves

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=wwokk2ibvd8c.fsf@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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