code_coverage.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #! /bin/sh
  2. #
  3. # Copyright (C) 2020 Embedded AMS B.V. - All Rights Reserved
  4. #
  5. # This file is part of Embedded Proto.
  6. #
  7. # Embedded Proto is open source software: you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License as published
  9. # by the Free Software Foundation, version 3 of the license.
  10. #
  11. # Embedded Proto is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
  18. #
  19. # For commercial and closed source application please visit:
  20. # <https://EmbeddedProto.com/license/>.
  21. #
  22. # Embedded AMS B.V.
  23. # Info:
  24. # info at EmbeddedProto dot com
  25. #
  26. # Postal adress:
  27. # Johan Huizingalaan 763a
  28. # 1066 VH, Amsterdam
  29. # the Netherlands
  30. #
  31. ./build/test/test_EmbeddedProto
  32. # rm -rf ./code_coverage_report/*
  33. # lcov --directory ./build/test --capture --output-file ./code_coverage_report/total_code_coverage.info -rc lcov_branch_coverage=1
  34. # lcov --remove ./code_coverage_report/total_code_coverage.info $PWD'/external/googletest/*' '/usr/include/*' -o ./code_coverage_report/filtered_code_coverage.info
  35. # genhtml ./code_coverage_report/filtered_code_coverage.info --branch-coverage --output-directory ./code_coverage_report
  36. rm -rf ./code_coverage_report/*
  37. mkdir -p code_coverage_report
  38. cd code_coverage_report
  39. # Run gcov on the static source files.
  40. gcov ../test/*.cpp --object-directory ../build/test/CMakeFiles/test_EmbeddedProto.dir/test/
  41. gcov ../src/*.cpp --object-directory ../build/test/CMakeFiles/test_EmbeddedProto.dir/src/
  42. cd -