On Fri, Nov 23, 2018 at 12:47 PM, Tom de Vries <tdevr...@suse.de> wrote:
> [ was: [PATCH 1/2][libbacktrace] Handle realloc returning NULL if size == 0 ]
>
> On Thu, Nov 22, 2018 at 01:35:43PM +0100, Tom de Vries wrote:
>> Hi,
>>
>> Build and tested on x86_64, with mmap.c replaced by alloc.c to ensure that
>> backtrace_vector_release in alloc.c is tested.
>
> Hi,
>
> I came up with a more structural solution.
>
> OK for trunk?
>
> Thanks,
> - Tom
>
> [libbacktrace] Test check_PROGRAMS without mmap
>
> When building libbacktrace, we typically use mmapio.c and mmap.c, and don't
> build read.c and alloc.c.
>
> Add testcases that use read.c and alloc.c to ensure that we also build and
> test those on a typical development setup.
>
> Bootstrapped and reg-tested on x86_64.
>
> 2018-11-23  Tom de Vries  <tdevr...@suse.de>
>
>         * configure.ac (HAVE_MMAP): New AM_CONDITIONAL.
>         * configure: Regenerate.
>         * Makefile.am : Add _with_alloc version for each test in
>         check_PROGRAMS.
>         * Makefile.in: Regenerate.
>
> ---
>  libbacktrace/Makefile.am  |  45 ++++++++
>  libbacktrace/Makefile.in  | 284 
> +++++++++++++++++++++++++++++++++++++++++++---
>  libbacktrace/configure    |  18 ++-
>  libbacktrace/configure.ac |   1 +
>  4 files changed, 331 insertions(+), 17 deletions(-)
>
> diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am
> index 3c1bd49dd7b..ee47daee415 100644
> --- a/libbacktrace/Makefile.am
> +++ b/libbacktrace/Makefile.am
> @@ -95,11 +95,25 @@ btest_CFLAGS = $(AM_CFLAGS) -g -O
>  btest_LDADD = libbacktrace.la
>
>  check_PROGRAMS += btest
> +if HAVE_MMAP
> +libbacktrace_with_alloc = $(libbacktrace_la_OBJECTS) \
> +       $(filter-out mmap.lo mmapio.lo,$(libbacktrace_la_LIBADD)) \
> +       alloc.lo read.lo


As far as I know libbacktrace does not currently rely on using GNU
make.  I'd rather not add that dependency for this purpose (I don't
mind adding this kind of testing but to me this seems only of mild
interest--I expect that all significant libbacktrace users have mmap).
You should be able to write something like

libbacktrace_alloc_la_SOURCES = $(libbacktrace_SOURCES)
libbacktrace_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) read.c alloc.c

Then I wouldn't bother with only running the tests with HAVE_MMAP,
just add unconditional tests for btest_alloc, etc.  It's OK to run
duplicate tests for the incredibly rare case of a host that doesn't
support mmap.

Ian

Reply via email to