Re: libtool (use with autotest)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-07-24, Simon Sobisch <simonsobisch@xxxxxxx> wrote:
>
> I hope to possibly get an answer by moving this question to the
> appropriate lists :-)
> For more context I provide the original responses to this topic.
>
> Am 06.07.2023 um 14:55 schrieb Jose E. Marchesi:
>>
>>> On 2023-07-03 17:16:59 +0200, Bruno Haible wrote:
>>>> Someone wrote:
>>>>> Without relinking at install time, I don't see how tests can
>>>>> reliably load the just-built library from the sources (objdir
>>>>> really) rather than loading the installed library.  Unless
>>>>> perhaps there is a belief that LD_LIBARY_PATH is reliable and
>>>>> supercedes, and there are wrappers
>>>>
>>>> Yes, on all ELF systems, libtool creates wrappers that set
>>>> LD_LIBRARY_PATH, for all programs that link to shared libraries in
>>>> the build dir.
>>>
>>> But wrappers have drawbacks: they make the use of gdb or valgrind
>>> less convenient.
>>
>> Just a tiny bit less convenient:
>>
>> $ libtool --mode=execute gdb ./prog
>> $ libtool --mode=execute valgrind ./prog
>
> Just to recheck:
>
> When using both autotest (autoconf) generated testsuites and libtool,
> then how should we handle the following, given that we generate
>
> bin/runner
> bin2/compiler
> runtime/librun
>
> * specify binaries to test AT_TESTED
> They are not in PATH, so should we add the libtool generated binaries'
> path to PATH for `make check` before the testsuite is executed?

The normal way is to set AUTOTEST_PATH so that all the programs under
test are in it.  When using Autoconf, this is usually done via the
the second argument to the AC_CONFIG_TESTDIR macro.

I must be missing some context here, as I'm afraid I don't understand
what the problem is.  To use valgrind in an Autotest test suite together
with libtool, I would do something like this (untested):

  m4_divert_text([PREPARE_TESTS], [: ${LIBTOOL="$SHELL $builddir/libtool"}
  ])

  AT_TESTED([my_program])

  AT_SETUP([my test w/ valgrind])

  AT_CHECK([$LIBTOOL --mode=execute valgrind my_program], [...])
  [...]

  AT_CLEANUP

> Bonus:
> How to do this in a way that allows `make installcheck`?

If you use AUTOTEST_PATH to locate the programs under test, I wouldn't
expect there to be any particular problem with installcheck.

Hope that helps,
  Nick




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux