[PATCH 02/15] Add selftests to bitmap.c

Jeff Law law@redhat.com
Tue Nov 24 21:13:00 GMT 2015


On 11/19/2015 10:04 AM, David Malcolm wrote:
> Jeff pre-approved the plugin version of this (as a new
> file unittests/test-bitmap.c):
>    https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03284.html
> with:
>> OK if/when prereqs are approved.  Minor twiddling if we end up moving it
>> elsewhere or standardizing/reducing header files is pre-approved.
>
> This version moves them to bitmap.c
>
> One issue: how to express:
>    TEST (bitmap_test, gc_alloc)
> in a ChangeLog entry.
>
> I've chosen to write it as (bitmap_test, gc_alloc) since that
> has the greatest chance of being found via grep.
Seems reasonable.  I'm not going to go through the individual tests 
closely this round.  I think the big question is whether or not we're 
getting close to an agreement on things like all tests vs stop at first 
failure, registration and pollution of state from one test to the next.

So what I like here is we've got a single #include, which probably 
should, by convention, be last in the set of headers.  Then at the end 
of the file we have the tests, guarded by a single #if CHECKING_P.

Each test uses the TEST macro, which is probably fine since it gives a 
way to hook up registration and the like.

EXPECT_XXX usage (or non-usage) will follow from the test everything vs 
stop at first failure decision.  If we adopt test everything, then 
indirection of some sort is useful here too as we can log results.

I'm curious what the namespace is for.  It's probably fine, just curious 
more than anything.

Jeff




More information about the Gcc-patches mailing list