[lttng-dev] lttng-tools test suite problem

Simon Marchi simon.marchi at polymtl.ca
Wed Apr 3 14:28:53 EDT 2013

On 3 April 2013 12:49, Christian Babeux <christian.babeux at efficios.com> wrote:
> I would advocate for this option. Could you describe the issues you
> encountered using subdirs-objects?

Let's try to add

AUTOMAKE_OPTIONS = subdir-objects

at the top of tests/unit/Makefile.am. ./bootstrap and ./configure go
fine. When "making", here is the result: http://pastebin.com/QzcTuFpB.
Notice the complain "../../src/common/.deps/error.Po: No such file or
directory" ? This is what tests/unit looks like:

$ tree -a tests/unit
|-- .deps
|   |-- test_kernel_data.Po
|   |-- test_session.Po
|   |-- test_uri.Po
|   `-- test_ust_data.Po
|-- Makefile
|-- Makefile.am
|-- Makefile.in
|-- test_kernel_data.c
|-- test_session.c
|-- test_uri.c
|-- test_ust_data.c
`-- $(top_srcdir)
    `-- src
        |-- bin
        |   `-- lttng-sessiond
        |       `-- .deps
        |           |-- buffer-registry.Po
        |           |-- consumer.Po
        |           |-- fd-limit.Po
        |           |-- health.Po
        |           |-- session.Po
        |           |-- trace-kernel.Po
        |           |-- trace-ust.Po
        |           |-- ust-app.Po
        |           |-- ust-consumer.Po
        |           |-- ust-metadata.Po
        |           `-- ust-registry.Po
        `-- common
            `-- .deps
                |-- error.Po
                |-- uri.Po
                `-- utils.Po

8 directories, 25 files

Yep, there is a directory named $(top_srcdir). It comes from the path
of the files in Makefile.am that contains $(top_srcdir). And it
contains the files that were not found earlier. If I do a

$ cp -a tests/unit/\$\(top_srcdir\)/src .

it places the files at the right place. I can do make again and it
completes successfully.

I then tried to replace instances of $(top_srcdir) in
tests/unit/Makefile.am by "../..". The objects files will then be
placed in the same directory as the source file and everything looks
good. The problem I see though is that the resulting object files
overwrite the objects previously built when make passed in the source
folder. Maybe this can create problems if we want to compile tests
with different flags than the main libs and executables.

Finally, an idea just like that: instead of specifying the source
file, would it be possible to specify directly the object file (e.g.
$(top_srcdir)/src/bin/lttng/utils.o or ../../src/bin/lttng/utils.o) in
LDADD ? So the unit test Makefile would not recompile the unit under
test, but just link with the object that is already built ?


More information about the lttng-dev mailing list