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

Cannot open source file #150

Open
lc-soft opened this issue Feb 1, 2020 · 0 comments
Open

Cannot open source file #150

lc-soft opened this issue Feb 1, 2020 · 0 comments

Comments

@lc-soft
Copy link

lc-soft commented Feb 1, 2020

travis-ci log: https://travis-ci.org/lc-soft/LCUI/jobs/644692385

image

Related code:

if not os.path.isabs(source_file_path):
if args.build_root:
source_file_path = os.path.join(
args.build_root, source_file_path)
elif root_is_libtool_dir:
source_file_path = os.path.abspath(
libtool_source_file_path(
root, source_file_path))
else:
if not source_file_path.startswith(os.path.pardir + os.path.sep) and \
os.path.dirname(source_file_path):
the_root = abs_root
else:
the_root = root
source_file_path = os.path.abspath(
os.path.join(the_root, source_file_path))

The value of source_file_path should be "/home/travis/build/lc-soft/LCUI/src/gui/widget/canvas.c", not "/home/travis/build/lc-soft/LCUI/widget/canvas.c".

The gcov file content looks like this:

$ cat src/gui/widget/canvas.gcno\#\#widget\#canvas.c.gcov 
        -:    0:Source:widget/canvas.c
        -:    0:Graph:/home/lc/projects/LCUI/src/gui/widget/.libs/canvas.gcno
        -:    0:Data:/home/lc/projects/LCUI/src/gui/widget/.libs/canvas.gcda
...

The path of the source file recorded in the gcov file is relative to the Makefile, maybe you need to modify the file path generation rules, like this pseudo code:

- source_file_path = os.path.join(current_dir_path, source_file_path)
+ source_file_path = os.path.join(makefile_dir_path, source_file_path) 

I tried using the gcov command manually, The file list now looks like this:

./Makefile
./src/Makefile
./src/thread/Makefile
./src/thread/pthread/thread.c
./src/thread/pthread/.libs/thread.gcda
./src/thread/pthread/.libs/thread.gcno

Using the following command will successfully create the ./src/thread/pthread.c.gcov file,

$ cd src/thread/
$ gcov -o ./pthread/.libs pthread/thread.c
File 'pthread/thread.c'
Lines executed:80.00% of 50
Creating 'thread.c.gcov'
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

1 participant