[ccan] [PATCH 7/9] darray: test: only use darray_make_room() if we HAVE_STATEMENT_EXPR

Rusty Russell rusty at rustcorp.com.au
Mon Jun 23 09:40:17 EST 2014


Cody P Schafer <dev at codyps.com> writes:
> On Sat, Jun 21, 2014 at 3:31 AM, Rusty Russell <rusty at rustcorp.com.au> wrote:
>> Cody P Schafer <dev at codyps.com> writes:
>>>
>>> -     plan_tests(41);
>>> +     plan_tests(38 + HAVE_STATEMENT_EXPR * 3);
>>
>> This breaks autoconf-generated config.h, since this won't be defined.
>
> autoconf generated? This is in tests, do we even expect autoconf
> (instead of ccan's configurator) to be used to generate the config for
> tests?

Many people import ccan into existing projects; I don't expect them to
change their config.h generation, but it'd be nice if they could wire
up the ccan tests to "make check".

> That said:
>
>> Better is probably to do:
>>
>>> +#if HAVE_STATEMENT_EXPR
>>>       testing(darray_make_room);
>>>       {
>>>               for (i=0; i < ARRAY_SIZE(lotsOfStrings); i++) {
>>> @@ -233,6 +234,7 @@ int main(void) {
>>>               ok1(!strcmp(str.item, amalgams.stringsF));
>>>       }
>>>       reset(str);
>>> +#endif
>>
>> #else
>>         skip(3, "Need HAVE_STATEMENT_EXPR to test darray_make_room");
>> #endif
>
> Yep, that looks much nicer.

If Joey doesn't respond soon, I'll have to consider applying these
anyway :(

Thanks,
Rusty.


More information about the ccan mailing list