All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: linux-sparse@vger.kernel.org, Christopher Li <sparse@chrisli.org>
Subject: Re: [PATCH 1/5] replace test for c99 for-loop initializers
Date: Sun, 19 Feb 2017 02:10:38 +0100	[thread overview]
Message-ID: <20170219011037.rv6k23uvdst2gfxt@macbook.local> (raw)
In-Reply-To: <12926366-f68d-460a-a181-cd30303631d5@ramsayjones.plus.com>

On Sat, Feb 18, 2017 at 10:37:36PM +0000, Ramsay Jones wrote:
> 
> 
> On 18/02/17 20:30, Luc Van Oostenryck wrote:
> > The existing test is an indirect test, using a warning
> > about context imbalance to show that some part of code
> > was discarded.
> > 
> > Now that we have the minimal tools to test the output of
> > test-linearize, use them to replace the test by a direct one.
> 
> Hmm, it may be a more direct test, but it is not clear
> just what is being tested (or indeed how it is being tested).
> 
> 
> After applying this patch, I edited validation/c99-for-loop.c
> like so:
> 
>     $ git diff
>     diff --git a/validation/c99-for-loop.c b/validation/c99-for-loop.c
>     index 427fde2..6b24fa8 100644
>     --- a/validation/c99-for-loop.c
>     +++ b/validation/c99-for-loop.c
>     @@ -2,8 +2,9 @@ int c99(void);
>      int c99(void)
>      {
>             int r = -1;
>     +       int i;
>  
>     -       for (int i = 0; i < 10; i++) {
>     +       for (i = 0; i < 10; i++) {
>                     r = i;
>             }
>  
>     $ 
> 
> This modified test still passes (indeed the output is identical).
> :-P
> 
> ATB,
> Ramsay Jones

Which is wonderful because it's exactly what it should be.

In fact I would love to be able to do this: show that two versions
of a program/function give exactly the same output, but the testsuite
can't do that (yet).

Now, you're right that It's may be not very clear what is being tested.
I may make more sense once you replace it in the context of the patch
it replace and the associated fix:
- 0e91f878 ("validation: Check C99 for loop variables")
- ed73fd32 ("linearize: Emit C99 declarations correctly")
If you try the test case on the tree with the patch ed73fd32 reverted,
you will see that the two versions doesn't give anymore the same result:
The C89 version (your) version will still give the right output
but the C99 version (the one of the test case) will essentialy gives
an empty output (the code used to ignore the C99-style declaration
and patch ed73fd32 fixed that).
Be careful also to the fact that this test case depends on testsuite
features only present on sparse-next, not on the master tree.


Luc Van Oostenryck

  reply	other threads:[~2017-02-19  1:10 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-18 20:30 [PATCH 0/5] more validation of C99 for-loop initializers Luc Van Oostenryck
2017-02-18 20:30 ` [PATCH 1/5] replace test for c99 " Luc Van Oostenryck
2017-02-18 22:37   ` Ramsay Jones
2017-02-19  1:10     ` Luc Van Oostenryck [this message]
2017-02-19 20:58       ` Ramsay Jones
2017-02-20  7:20         ` [PATCH v2 0/5] more validation of C99 " Luc Van Oostenryck
2017-02-20  7:20           ` [PATCH v2 1/5] replace test for c99 " Luc Van Oostenryck
2017-02-20 14:05             ` Ramsay Jones
2017-02-20  7:20           ` [PATCH v2 2/5] add test case for scope of C99 for-loop declarations Luc Van Oostenryck
2017-02-20  7:20           ` [PATCH v2 3/5] add test cases for storage of c99 " Luc Van Oostenryck
2017-02-20  7:20           ` [PATCH v2 4/5] add a method to external_declaration() Luc Van Oostenryck
2017-02-20  7:20           ` [PATCH v2 5/5] check the storage of C99 for-loop initializers Luc Van Oostenryck
2017-02-18 20:30 ` [PATCH 2/5] add test case for scope of C99 for-loop declarations Luc Van Oostenryck
2017-02-18 20:30 ` [PATCH 3/5] add test cases for storage of c99 " Luc Van Oostenryck
2017-02-18 20:30 ` [PATCH 4/5] add a method to external_declaration() Luc Van Oostenryck
2017-02-27 15:37   ` Christopher Li
2017-02-27 21:34     ` Luc Van Oostenryck
2017-02-28  9:46     ` Luc Van Oostenryck
2017-02-28 10:03       ` [PATCH v3 0/7] more validation of C99 for-loop initializers Luc Van Oostenryck
2017-02-28 10:03         ` [PATCH v3 1/7] replace test for c99 " Luc Van Oostenryck
2017-02-28 10:03         ` [PATCH v3 2/7] add test case for scope of C99 for-loop declarations Luc Van Oostenryck
2017-02-28 10:03         ` [PATCH v3 3/7] add test cases for storage of c99 " Luc Van Oostenryck
2017-02-28 10:04         ` [PATCH v3 4/7] add a method to external_declaration() Luc Van Oostenryck
2017-03-05 14:04           ` Christopher Li
2017-03-05 15:12             ` Luc Van Oostenryck
2017-03-06  1:13               ` Christopher Li
2017-03-05 19:21             ` [PATCH v4 0/6] more validation of C99 for-loop initializers Luc Van Oostenryck
2017-03-05 19:21               ` [PATCH v4 1/6] replace test for c99 " Luc Van Oostenryck
2017-03-05 19:21               ` [PATCH v4 2/6] add test case for scope of C99 for-loop declarations Luc Van Oostenryck
2017-03-05 19:21               ` [PATCH v4 3/6] add test cases for storage of c99 " Luc Van Oostenryck
2017-03-05 19:21               ` [PATCH v4 4/6] add an optional validation method to external_declaration() Luc Van Oostenryck
2017-03-05 19:21               ` [PATCH v4 5/6] check the storage of C99 for-loop initializers Luc Van Oostenryck
2017-03-05 19:21               ` [PATCH v4 6/6] move 'extern with initializer' validation after the validate method Luc Van Oostenryck
2017-03-06  0:59               ` [PATCH v4 0/6] more validation of C99 for-loop initializers Christopher Li
2017-03-06  1:08                 ` Luc Van Oostenryck
2017-02-28 10:04         ` [PATCH v3 5/7] check the storage " Luc Van Oostenryck
2017-03-05 14:26           ` Christopher Li
2017-03-05 15:24             ` Luc Van Oostenryck
2017-02-28 10:04         ` [PATCH v3 6/7] make process_decl() aware of the presence of an initializer Luc Van Oostenryck
2017-03-05 14:49           ` Christopher Li
2017-03-05 15:29             ` Luc Van Oostenryck
2017-02-28 10:04         ` [PATCH v3 7/7] move check extern with initializer to default_process_decl() Luc Van Oostenryck
2017-02-28 16:34         ` [PATCH v3 0/7] more validation of C99 for-loop initializers Christopher Li
2017-02-28 16:40           ` Luc Van Oostenryck
2017-02-18 20:30 ` [PATCH 5/5] check the storage " Luc Van Oostenryck

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=20170219011037.rv6k23uvdst2gfxt@macbook.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=sparse@chrisli.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.