Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to find some files #11

Closed
nijel opened this issue Aug 23, 2013 · 4 comments
Closed

Fails to find some files #11

nijel opened this issue Aug 23, 2013 · 4 comments

Comments

@nijel
Copy link

nijel commented Aug 23, 2013

I've tried to add coveralls to nijel/enca repo, but cpp-coveralls fails to find some files:

https://travis-ci.org/nijel/enca/jobs/10533670#L939

Not sure if the build system is that special there, but it looks for lib/data/chinese/zh_weight_big5.h instead of data/chinese/zh_weight_big5.h.

@eddyxu
Copy link
Owner

eddyxu commented Aug 27, 2013

Hi @nijel, the path of source file is found from parsing the content of .gcov file. Could you verify the content of the corresponding .gcov file?

@nijel
Copy link
Author

nijel commented Aug 28, 2013

Okay, root cause of my problems is that this build is using libtool - so coveralls in this case would have to strip .libs from file path. The file I've mentioned in original report seems to be compiled with some wrong flags and that's now fixed.

Looking at other coverage processing tool (lcov) it has flag to cope with libtool based builds:
http://ltp.cvs.sourceforge.net/viewvc/ltp/utils/analysis/lcov/bin/geninfo?view=markup#l893

@eddyxu
Copy link
Owner

eddyxu commented Aug 29, 2013

Could you please try 3541561 to see whether it solves your problem?

The changes are:
master...skip_libs_dir

@nijel
Copy link
Author

nijel commented Aug 30, 2013

That one seems to work fine.

@eddyxu eddyxu closed this as completed Aug 30, 2013
kou added a commit to kou/cpp-coveralls that referenced this issue Jan 25, 2014
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 eddyxu#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
kou added a commit to kou/cpp-coveralls that referenced this issue Jan 25, 2014
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 eddyxu#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
kou added a commit to kou/cpp-coveralls that referenced this issue Jan 25, 2014
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 eddyxu#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
@kou kou mentioned this issue Jan 25, 2014
eddyxu added a commit that referenced this issue Sep 12, 2015
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants