Error during parsing of coverage report - caused by unknown XML node - C/C++


I am having a new issue since the upgrade of SonarCloud on March 26th, 2022. It seems like I have an issue with the parsing of our generic coverage report.

Here is what I am using:

  • SonarCloud (scanner version
  • Bitbucket Pipelines
  • C/C++ project compiled with CMake
  • GoogleTests as a unit testing suit

The error I get is:

`ERROR: Error during SonarScanner execution`

`ERROR: Error during parsing of the generic coverage report '/opt/atlassian/pipelines/agent/build/test-coverage.xml'. Look at SonarQube documentation to know the expected XML format.`

`ERROR: Caused by: Unknown XML node, expected "lineToCover" but got "functionToCover" at line 2`

I am calling the SonarCloud analysis from Bitbucket Pipelines. Here is how my minimal pipeline step looks like:

          - export SONAR_SCANNER_VERSION=
          - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
          - curl --create-dirs -sSLo $HOME/.sonar/$
          - unzip -o $HOME/.sonar/ -d $HOME/.sonar/
          - export PATH=$SONAR_SCANNER_HOME/bin:$PATH
          - export SONAR_SCANNER_OPTS="-server"
          - curl --create-dirs -sSLo $HOME/.sonar/
          - unzip -o $HOME/.sonar/ -d $HOME/.sonar/
          - export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
          # Install node.js
          - curl -sL | bash -
          - apt-get install -y nodejs
          # Install code coverage tools
          - apt-get install -y python3-pip
          - pip3 install -U gcovr
          - gcovr --version
          #  Install CMake
          - apt-get update -qq
          - pip3 install cmake
          # Build library for testing and scanning Sonar Cloud
          - mkdir build_wrapper_output_directory
          - cmake -DCMAKE_BUILD_TYPE=Debug
          - build-wrapper-linux-x86-64 --out-dir build_wrapper_output_directory make clean all
          - tests/Google_Tests_run --gtest_output=xml:test-results/test_outputs.xml
          - gcovr -r . --sonarqube -o test-coverage.xml
          - sonar-scanner 

My specifies those entries:


This solution was working properly before the latest SonarCloud upgrade. Has anyone any idea on how to make setup this pipeline to make it properly work again?

Thank you very much for your help,


1 Like

I found a solution to my issue: the latest update of gcovr was making the file incompatible for Sonar to read the result of the generic file.

To install an older version of sonar, I had to install an older version of Python.

So I updated

pip3 install -U gcovr


pip install gcovr

And then all pip3 instructions by pip

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.