eddyxu/cpp-coveralls — pull request #23 by kou (2014-01-25 15:16:15+00:00)
Title: Support GNU libtool

GNU libtool generates object files into `.libs/` directory instead of
the source directory. This change removes `.libs/` from paths to
generate suitable paths automatically.

For example, there is a source file in `sample/greeter.c`:

sample
`-- greeter.c

GNU libtool generates `greeter.o` into
`sample/greeter/.libs/greeter.o`:

sample
|-- .libs
| `-- greeter.o
`-- greeter.c

`.gcno` files are also generated into `.libs/` directory:

sample
|-- .libs
| |-- greeter.gcno
| `-- greeter.o
`-- greeter.c

`coveralls.coverage.run_gcov()` runs `gcov` in the directory that has
`.gcno`. In this example, it is `sample/.libs/` directory. But
`sample/.libs/` directory doesn't have source file, `greeter.c`. In
this situation, `gcov` can't find source file and reports the
following error:

% coveralls
...
Cannot open source file greeter.c
File 'greeter.c'
Lines executed:100.00% of 2
Creating 'greeter.c.gcov'
...

cpp-coveralls has `--build-root` option to change the working
directory to run `gcov`. We can use it to resolve the error:

% coveralls --build-root sample
...
File 'greeter.c'
Lines executed:100.00% of 2
Creating 'greeter.c.gcov'
...

But we can't use `--build-root` option when we have two or more
directories.

See also #11 and 0372af0.

I created a sample project to try GNU libtool and coverage
combination: https://github.com/kou/libtool-coverage-sample

You can find the current cpp-coveralls can't report coverage
information: https://coveralls.io/builds/465842

With this change, cpp-coveralls can report the correct coverage
information: https://coveralls.io/builds/465922