[lttng-dev] lttng-tools test suite problem

Christian Babeux christian.babeux at efficios.com
Wed Apr 3 12:49:42 EDT 2013


Hi Simon,

> A- Create a folder for each unit test. This is cumbersome, because it
> will require creating a Makefile in each directory, which requires to
> modify configure.ac. If it's hard to add a test, there will be less
> tests, which is baaaaad. Also, a single test that needs stuff from two
> files that have the same name will face the same problem as right now.

Agreed.

> B- Use of option subdir-objects [1] [2]. Looks like a good solution,
> but it won't work for me, it gives weird behaviours...

I would advocate for this option. Could you describe the issues you
encountered using subdirs-objects?

Thanks,

Christian

On Wed, Apr 3, 2013 at 3:16 AM, Simon Marchi <simon.marchi at polymtl.ca> wrote:
>
> Hello LTTng protagonists,
>
> Here is a more detailled description of the problem I have with the
> lttng-tools test suite.
>
> Suppose I want to write a unit test for the list_cmd_options function
> that is found in src/bin/lttng/utils.c. Based on existing tests, I
> would create the file tests/unit/test_list_cmd_options.c and add the
> following lines to tests/unit/Makefile.am:
>
> test_list_cmd_options_SOURCES = test_list_cmd_options.c \
>     $(top_srcdir)/src/bin/lttng/utils.c
> test_list_cmd_options_LDADD = $(LIBTAP)
>
> However, when I execute ./bootstrap, I get the following error:
>
> + [ ! -e config ]
> + autoreconf -i
> tests/unit/Makefile.am: object `utils.$(OBJEXT)' created by \
>     `$(top_srcdir)/src/bin/lttng/utils.c' and \
>     `$(top_srcdir)/src/common/utils.c'
> autoreconf: automake failed with exit status: 1
>
> IIUC, it is caused by the fact that other tests use the similarly
> named $(top_srcdir)/src/common/utils.c. Object files for the unit
> tests are all created in the same directory, regardless of where they
> come from. It results that two files with the same name will clash.
>
> I kind of see two solutions for this:
>
> A- Create a folder for each unit test. This is cumbersome, because it
> will require creating a Makefile in each directory, which requires to
> modify configure.ac. If it's hard to add a test, there will be less
> tests, which is baaaaad. Also, a single test that needs stuff from two
> files that have the same name will face the same problem as right now.
> B- Use of option subdir-objects [1] [2]. Looks like a good solution,
> but it won't work for me, it gives weird behaviours...
>
> Thanks for looking into this. Testing ftw !
>
> Simon
>
> [1] http://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html
> [2] http://stackoverflow.com/questions/917948/automake-and-files-with-the-same-name
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev



More information about the lttng-dev mailing list