Subject: Re: Unit test suite for c-ares

Re: Unit test suite for c-ares

From: David Drysdale <drysdale_at_google.com>
Date: Wed, 25 Nov 2015 10:39:45 +0000

On Wed, Nov 25, 2015 at 10:16 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Wed, 25 Nov 2015, David Drysdale wrote:
>
>> - Fix double-free from ares__read_line() failure case
>> https://github.com/daviddrysdale/c-ares/commit/d91d731636f5
>
>
> +1
>
>> - Extend the injection of malloc/free to cover realloc too:
>> https://github.com/daviddrysdale/c-ares/commit/492a1cc5e4fa
>
>
> This modifies the public API though so it'll break existing applications. I
> would suggest this is introduced with a new API function to allow new
> applications to use it and yet keep the old ones functional.

Well, it only modifies the ares_library_init_mem() function that I added
in my commit b017d2664283, and that's not yet in the official repo/branch.
So there can't be anything using it yet (other than my test code), so it's
safe to adjust.

(Obviously, I'd agree with you if a) the test changes were merged into
the master repo and b) there had been an official release since then.)

>> - Add ares_set_sortlist() to allow manual specification (and therefore
>> testing) of the sort list for ares_gethostbyname()
>> https://github.com/daviddrysdale/c-ares/commit/79c719270fb6
>
>
> Fine by me, but if you only want it for testing purposes I'm less convinced.
> For testing, you could do a separate build that allows you to link and use
> private functions as well.

I could certainly do that, but it seemed slightly odd to have a bunch of
address sorting functionality that's only accessibly via an /etc/resolv.conf
option, and not via any other method. I've never used the sortlist
functionality myself, but if it's in resolv.conf I assume it's useful to
someone, and in that case it would be nice to be able to configure an
instance of the library independently of the system-wide configuration.
WDYT?

> --
>
> / daniel.haxx.se
Received on 2015-11-25