diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index 230a275c4e..14bd6508e5 100644 --- a/.github/workflows/sonar-scan.yml +++ b/.github/workflows/sonar-scan.yml @@ -50,6 +50,7 @@ jobs: sudo apt-get install -y --allow-downgrades openssl=${openssl_ver} libssl-dev=${libssl_ver} sudo apt-get install -y \ ccache \ + gcovr \ parallel \ libboost-thread-dev \ libboost-iostreams-dev \ @@ -184,23 +185,11 @@ jobs: df -h - name: Prepare for scanning with SonarScanner run: | - find _build/libraries/[acdenptuw]*/CMakeFiles/*.dir \ - _build/libraries/plugins/*/CMakeFiles/*.dir \ - -type d -print \ - | while read d; do \ - tmpd="${d:7}"; \ - srcd="${tmpd/CMakeFiles*.dir/.}"; \ - gcov -o "$d" "${srcd}"/*.[ch][px][px] \ - "${srcd}"/include/graphene/*/*.[ch][px][px] ; \ - done >/dev/null - find _build/programs/[cdgjsw]*/CMakeFiles/*.dir \ - -type d -print \ - | while read d; do \ - tmpd="${d:7}"; \ - srcd="${tmpd/CMakeFiles*.dir/.}"; \ - gcov -o "$d" "${srcd}"/*.[ch][px][px] ; \ - done >/dev/null programs/build_helpers/set_sonar_branch_for_github_actions sonar-project.properties + pushd _build + gcovr --version + gcovr --exclude-unreachable-branches --sonarqube ../coverage.xml -r .. + popd - name: Scan with SonarScanner env: # to get access to secrets.SONAR_TOKEN, provide GITHUB_TOKEN diff --git a/libraries/fc b/libraries/fc index 4d024a83b7..2405393e40 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 4d024a83b774da0e186c0c6c070e695f563da373 +Subproject commit 2405393e40219b8ff3a87ccbcc3de14e32886dda diff --git a/sonar-project.properties b/sonar-project.properties index 8796e257ec..c6b9acde72 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -20,7 +20,12 @@ sonar.tests=tests sonar.exclusions=programs/build_helper/**/*,libraries/fc/**/*,libraries/egenesis/egenesis_full.cpp sonar.sources=libraries,programs sonar.cfamily.build-wrapper-output=bw-output -sonar.cfamily.gcov.reportsPath=. + +# Note: +# It is hard to get the gcov sensor working, but gcovr works. +# See https://community.sonarsource.com/t/code-coverage-incorrect-for-c-gcov-project/41837/5 +#sonar.cfamily.gcov.reportsPath=. +sonar.coverageReportPaths=coverage.xml # Decide which tree the current build belongs to in SonarCloud. # Managed by the `set_sonar_branch*` script(s) when building with CI. diff --git a/tests/cli/main.cpp b/tests/cli/main.cpp index 41b3b632c8..585b2dd416 100644 --- a/tests/cli/main.cpp +++ b/tests/cli/main.cpp @@ -1246,8 +1246,8 @@ BOOST_FIXTURE_TEST_CASE( cli_confidential_tx_test, cli_fixture ) // then confirm that balances are received, and then analyze the range // prooofs to make sure the mantissa length does not reveal approximate // balance (issue #480). - std::map to_list = {{"alice",100000000000}, - {"bob", 1000000000}}; + std::map to_list = {{"alice",100000000000LL}, + {"bob", 1000000000LL}}; vector bconfs; auto core_asset = W.get_asset("1.3.0"); BOOST_TEST_MESSAGE("Sending blind transactions to alice and bob"); diff --git a/tests/tests/settle_tests.cpp b/tests/tests/settle_tests.cpp index 5fef6aeede..2d879f1351 100644 --- a/tests/tests/settle_tests.cpp +++ b/tests/tests/settle_tests.cpp @@ -1551,7 +1551,7 @@ BOOST_AUTO_TEST_CASE( create_bitassets ) transfer( committee_account, rachelregistrar_id, asset( 10000000 ) ); transfer( committee_account, rachelreferrer_id, asset( 10000000 ) ); transfer( committee_account, rachel.get_id(), asset( 10000000) ); - transfer( committee_account, paul_id, asset( 10000000000 ) ); + transfer( committee_account, paul_id, asset( 10000000000LL ) ); asset_update_operation op; op.issuer = biteur.issuer;