-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
travis-ci log: https://travis-ci.org/lc-soft/LCUI/jobs/644692385
Related code:
cpp-coveralls/cpp_coveralls/coverage.py
Lines 430 to 445 in ff7af7e
| 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'
Metadata
Metadata
Assignees
Labels
No labels
