On Wed, Mar 16, 2016 at 08:14:55PM -0700, William Tu wrote:
> For target 'check-valgrind', add '-' before $(SHELL) so that even if
> test case fails, the make continues executing and reports total errors.
> The additional option --errors-for-leak-kinds=definite will consider
> valgrind's definite memory leaks as errors and show at the last line of
> valgrind.* as "ERROR SUMMARY: <N> errors". The patch grep this pattern
> and sum the total number of errors.
> 
> To better understand the erros, add a new target 'check-valgrind-verbose',
> which checks different valgrind's error patterns. Note: all the results
> are from tests/testsuite.dir/<N>/valgrind.*, make sure this folder has no
> stale files.
> 
> Signed-off-by: William Tu <[email protected]>

Thanks for working on this.

I couldn't get this to work for me, though.  I made a change to
ovs-ofctl to cause it to segfault:

    diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
    index 713edc7..1cd7b38 100644
    --- a/utilities/ovs-ofctl.c
    +++ b/utilities/ovs-ofctl.c
    @@ -129,6 +129,7 @@ static bool recv_flow_stats_reply(struct vconn *, 
ovs_be32 send_xid,
     int
     main(int argc, char *argv[])
     {
    +    asm volatile ("movb $0,0");
         struct ovs_cmdl_context ctx = { .argc = 0, };
         set_program_name(argv[0]);
         service_start(&argc, &argv);

which caused tests to fail, e.g.:

## ------------------------------ ##
## openvswitch 2.5.90 test suite. ##
## ------------------------------ ##
234: OFPST_PORT request - 1.0                        FAILED (ofp-print.at:1577)

which ended up with a reasonable valgrind message:

==2995== Invalid write of size 1
==2995==    at 0x804BEA6: main (ovs-ofctl.c:132)
==2995==  Address 0x0 is not stack'd, malloc'd or (recently) free'd

and yet:

----------------------------------------------------------------------
Total errors:
Valgrind output can be found in tests/testsuite.dir/*/valgrind.*
----------------------------------------------------------------------

Reflecting, I think it's probably because I have "-q" in ~/.valgrindrc.
Not sure what to do about that.

The regular expressions in check-valgrind-verbose take advantage of a
GNU extension to basic regular expressions, that is, \|.  I suggest
instead using extended regular expressions and $(EGREP), for
portability.

The commands for check-valgrind-verbose are a bit long.  I think they
might be more comfortable in a shell script.  I am not sure that there
is value in making them a separate target; I guess I'd be OK with adding
them to plain "check-valgrind".
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to