From 3eee6ccda4b907c9b02b50881e82b6ff0550a81d Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Fri, 18 Nov 2022 16:12:26 +0100 Subject: [PATCH] gcovr: Exclude sip-provider.c and dummy-provider.c gcovr > 5.1 (which is included in the latest Debian CI image) fails an assertion because two different functions with the same name end up on different lines because they are #ifdef'ed The offending code is this: G_DEFINE_TYPE_WITH_CODE (CallsDummyProvider, calls_dummy_provider, CALLS_TYPE_PROVIDER, G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE, calls_dummy_provider_message_source_interface_init)) G_DEFINE_DYNAMIC_TYPE_EXTENDED (CallsDummyProvider, calls_dummy_provider, CALLS_TYPE_PROVIDER, 0, G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE, calls_dummy_provider_message_source_interface_init)) There is already a gcovr issue here: https://github.com/gcovr/gcovr/issues/586 The failed assertion looks like this: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/gcovr/workers.py", line 78, in worker work(*args, **kwargs) File "/usr/lib/python3/dist-packages/gcovr/gcov.py", line 337, in process_datafile done = run_gcov_and_process_files( File "/usr/lib/python3/dist-packages/gcovr/gcov.py", line 514, in run_gcov_and_process_files process_gcov_data(fname, covdata, abs_filename, options) File "/usr/lib/python3/dist-packages/gcovr/gcov.py", line 165, in process_gcov_data insert_file_coverage(covdata, coverage) File "/usr/lib/python3/dist-packages/gcovr/merging.py", line 159, in insert_file_coverage return _insert_coverage_item(target, file.filename, file, merge_file, options) File "/usr/lib/python3/dist-packages/gcovr/merging.py", line 135, in _insert_coverage_item merged_item = merge_item(target_dict[key], new_item, options) File "/usr/lib/python3/dist-packages/gcovr/merging.py", line 178, in merge_file left.functions = _merge_dict( File "/usr/lib/python3/dist-packages/gcovr/merging.py", line 99, in _merge_dict _insert_coverage_item(left, key, right_item, merge_item, options) File "/usr/lib/python3/dist-packages/gcovr/merging.py", line 135, in _insert_coverage_item merged_item = merge_item(target_dict[key], new_item, options) File "/usr/lib/python3/dist-packages/gcovr/merging.py", line 268, in merge_function assert left.lineno == right.lineno AssertionError --- gcovr.cfg | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcovr.cfg b/gcovr.cfg index bcf6f6c..21386e0 100644 --- a/gcovr.cfg +++ b/gcovr.cfg @@ -1,2 +1,8 @@ exclude = src/dbus -exclude = subprojects/ \ No newline at end of file +exclude = subprojects/ +# exclude calls-dummy-provider.c and calls-sip-provider.c as +# gcovr currently can't handle having the same function name twice on different lines: +# #ifdef FOR_TESTING switches between G_DEFINE_TYPE and a G_DEFINE_DYNAMIC_TYPE +# see https://github.com/gcovr/gcovr/issues/586 +exclude = plugins/provider/dummy/calls-dummy-provider.c +exclude = plugins/provider/sip/calls-sip-provider.c