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

setup_target_for_coverage_gcovr_html fails when running with clang #81

Open
DavidLazarescu opened this issue Apr 13, 2023 · 0 comments
Open

Comments

@DavidLazarescu
Copy link

Using the CodeCoverage.cmake module works just fine when I am compiling my project with GCC, but it does not work when running with clang. Is gcovr gcc only, or is there also a way to compile it with clang?

The code I am using is:

# Generate code coverage
if (ENABLE_COVERAGE) 
    include(CodeCoverage)
    append_coverage_compiler_flags_to_target(application)
    setup_target_for_coverage_gcovr_html(
              NAME application_coverage
              EXECUTABLE application_unit_tests
              BASE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
              EXCLUDE ${PROJECT_BINARY_DIR}/* ${PROJECT_SOURCE_DIR}/libs/*)
endif()

The error I am getting is:

(ERROR) Trouble processing '/home/creapermann/Programming/Etovex/Librum/build-Debug/src/adapters/CMakeFiles/adapters.dir/controllers/user_controller.cpp.gcda' with working directory '/home/creapermann/Programming/Etovex/Librum/build-Debug/src/adapters/CMakeFiles/adapters.dir/controllers/.'.
Stdout of gcov was >>None<< End of stdout
Stderr of gcov was >>None<< End of stderr
Current processed gcov file was None.
Use option --verbose to get extended informations.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/gcovr/workers.py", line 80, in worker
work(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 323, in process_datafile
done = run_gcov_and_process_files(
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 536, in run_gcov_and_process_files
out, err = gcov_cmd.run_with_args(
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 519, in run_with_args
raise RuntimeError(f"GCOV returncode was {gcov_process.returncode}.")
RuntimeError: GCOV returncode was 3.
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/gcovr/workers.py", line 80, in worker
work(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 323, in process_datafile
done = run_gcov_and_process_files(
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 536, in run_gcov_and_process_files
out, err = gcov_cmd.run_with_args(
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 519, in run_with_args
raise RuntimeError(f"GCOV returncode was {gcov_process.returncode}.")
RuntimeError: GCOV returncode was 3.
(ERROR) Uncaught EXCEPTION
Traceback (most recent call last):
File "/usr/bin/gcovr", line 33, in <module>
sys.exit(load_entry_point('gcovr==6.0', 'console_scripts', 'gcovr')())
File "/usr/lib/python3.10/site-packages/gcovr/__main__.py", line 328, in main
covdata = collect_coverage_from_gcov(options)
File "/usr/lib/python3.10/site-packages/gcovr/__main__.py", line 380, in collect_coverage_from_gcov
with Workers(
File "/usr/lib/python3.10/site-packages/gcovr/workers.py", line 173, in __exit__
self.wait()
File "/usr/lib/python3.10/site-packages/gcovr/workers.py", line 164, in wait
raise self.exceptions[0][1]
File "/usr/lib/python3.10/site-packages/gcovr/__main__.py", line 387, in collect_coverage_from_gcov
contexts = pool.wait()
File "/usr/lib/python3.10/site-packages/gcovr/workers.py", line 164, in wait
raise self.exceptions[0][1]
File "/usr/lib/python3.10/site-packages/gcovr/workers.py", line 80, in worker
work(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 323, in process_datafile
done = run_gcov_and_process_files(
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 536, in run_gcov_and_process_files
out, err = gcov_cmd.run_with_args(
File "/usr/lib/python3.10/site-packages/gcovr/gcov.py", line 519, in run_with_args
raise RuntimeError(f"GCOV returncode was {gcov_process.returncode}.")
RuntimeError: GCOV returncode was 3.
make[3]: *** [src/adapters/CMakeFiles/coverage.dir/build.make:73: src/adapters/CMakeFiles/coverage] Error 1
make[2]: *** [CMakeFiles/Makefile2:2437: src/adapters/CMakeFiles/coverage.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2444: src/adapters/CMakeFiles/coverage.dir/rule] Error 2
make: *** [Makefile:1053: coverage] Error 2
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