diff --git a/.gcov/make/make_gcov_01_generic.gmk b/.gcov/make/make_gcov_01_generic.gmk index dfb1bde5..6dd38689 100644 --- a/.gcov/make/make_gcov_01_generic.gmk +++ b/.gcov/make/make_gcov_01_generic.gmk @@ -61,30 +61,43 @@ gcov: $(PATH_BIN)/wide_decimal.exe @$(PATH_BIN)/wide_decimal.exe @$(GNUECHO) @$(GNUECHO) +++ running gcov - @$(GCOV) $(GCOV_FLAGS) $(addsuffix .cpp,$(FILES_PRJ)) --object-directory obj + @$(GCOV) $(GCOV_FLAGS) $(addsuffix .cpp,$(FILES_PRJ)) + @$(GNUECHO) + @$(GNUECHO) +++ running lcov + @$(LCOV) $(LCOV_BRANCH) -c --directory obj --output-file coverage_unfiltered.info + @$(LCOV) $(LCOV_BRANCH) --remove coverage_unfiltered.info $(LCOV_REMOVES) --output-file coverage.info + @$(GNUECHO) + @$(GNUECHO) +++ running genhtml + @$(GENHTML) coverage.info $(LCOV_BRANCH) --demangle-cpp --output-directory $(PATH_BIN)/report @$(GNUECHO) - @$(LCOV) -c --directory obj --output-file coverage.info - @$(LCOV) --remove coverage.info '/usr/*' --output-file coverage.info - @$(LCOV) --remove coverage.info '*boost/*' --output-file coverage.info - @$(GENHTML) coverage.info --demangle-cpp --output-directory out # ------------------------------------------------------------------------------ # Clean temporary files. # ------------------------------------------------------------------------------ -.PHONY: prepare -prepare: +.PHONY: clean +clean: # creating output directories + @$(GNUECHO) +++ cleaning output directories + @-$(RM) -rf $(PATH_BIN)* || uname -r + @-$(RM) -rf $(PATH_ERR)* || uname -r + @-$(RM) -rf $(PATH_OBJ)* || uname -r + @-$(RM) -f *.gcov || uname -r + @-$(RM) -f coverage* || uname -r + @$(GNUECHO) + + +# ------------------------------------------------------------------------------ +# Prepare the gcov build. +# ------------------------------------------------------------------------------ + +.PHONY: prepare +prepare: clean @$(GNUECHO) +++ creating output directories @-$(MKDIR) -p $(PATH_BIN) @-$(MKDIR) -p $(PATH_ERR) @-$(MKDIR) -p $(PATH_OBJ) @$(GNUECHO) - @$(GNUECHO) +++ cleaning output directories - @-$(RM) -rf $(PATH_BIN)/*.* - @-$(RM) -rf $(PATH_ERR)/*.* - @-$(RM) -rf $(PATH_OBJ)/*.* - @$(GNUECHO) @$(GNUECHO) +++ print gcov version @$(GCOV) --version @$(GNUECHO) diff --git a/.gcov/make/make_gcov_03_flags.gmk b/.gcov/make/make_gcov_03_flags.gmk index 859993b1..b337fc01 100644 --- a/.gcov/make/make_gcov_03_flags.gmk +++ b/.gcov/make/make_gcov_03_flags.gmk @@ -6,8 +6,9 @@ # ------------------------------------------------------------------------------ BOOST_ROOT_FOR_GCOV = /mnt/c/boost/boost_1_78_0 -CC = g++-10 +CC = g++ STD = c++11 +ALL_COV = 0 ifneq ($(MY_BOOST_ROOT),) BOOST_ROOT_FOR_GCOV := $(MY_BOOST_ROOT) @@ -21,6 +22,14 @@ ifneq ($(MY_STD),) STD := $(MY_STD) endif +ifneq ($(MY_STD),) +STD := $(MY_STD) +endif + +ifneq ($(MY_ALL_COV),) +ALL_COV := $(MY_ALL_COV) +endif + CXXFLAGS = -march=native \ -mtune=native \ -O2 \ @@ -43,5 +52,22 @@ C_INCLUDES = $(PATH_SRC) \ C_DEFINES :=$(addprefix -D,$(C_DEFINES)) C_INCLUDES :=$(addprefix -I,$(C_INCLUDES)) +GCOV_FLAGS = --object-directory obj \ + --all-blocks \ + --function-summaries \ + --demangled-names + +ifneq ($(ALL_COV),0) +GCOV_FLAGS := $(GCOV_FLAGS) \ + --branch-counts \ + --branch-probabilities +endif + +LCOV_BRANCH = + +ifneq ($(ALL_COV),0) +LCOV_BRANCH := --rc lcov_branch_coverage=1 +endif -GCOV_FLAGS = -b -c -m +LCOV_REMOVES = '/usr/*' \ + '*boost/*' diff --git a/.github/workflows/wide_decimal.yml b/.github/workflows/wide_decimal.yml index 6ffc3c04..5f2b15c8 100644 --- a/.github/workflows/wide_decimal.yml +++ b/.github/workflows/wide_decimal.yml @@ -93,46 +93,6 @@ jobs: echo echo "verify empty word count of ./tmp/all.tidy_txt" wc ./tmp/all.tidy_txt | grep '0 0 0' - gnumake-gcc-gcov-native: - runs-on: ubuntu-20.04 - defaults: - run: - shell: bash - strategy: - fail-fast: false - matrix: - standard: [ c++11 ] - compiler: [ g++ ] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: '0' - - name: update-tools - run: sudo apt install lcov - - name: clone-submods-bootstrap-headers-boost-develop - run: | - git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root - cd ../boost-root - git submodule update --init tools - git submodule update --init libs/config - git submodule update --init libs/math - cd libs/math - git checkout no_exceptions_or_rtti_error_handling - cd ../.. - git submodule update --init libs/multiprecision - ./bootstrap.sh - ./b2 headers - - name: gnumake-gcc-gcov-native - run: | - grep BOOST_VERSION ../boost-root/boost/version.hpp - cd .gcov/make - echo "running gcov" - echo "make prepare -f make_gcov_01_generic.gmk MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}" - echo - make prepare -f make_gcov_01_generic.gmk MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }} - echo "make gcov -f make_gcov_01_generic.gmk --jobs=8 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}" - make gcov -f make_gcov_01_generic.gmk --jobs=8 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }} - echo gcc-clang-native: runs-on: ubuntu-20.04 defaults: diff --git a/.github/workflows/wide_decimal_codecov.yml b/.github/workflows/wide_decimal_codecov.yml new file mode 100644 index 00000000..5c16f86c --- /dev/null +++ b/.github/workflows/wide_decimal_codecov.yml @@ -0,0 +1,66 @@ +# ------------------------------------------------------------------------------ +# Copyright Christopher Kormanyos 2022. +# Distributed under the Boost Software License, +# Version 1.0. (See accompanying file LICENSE_1_0.txt +# or copy at http://www.boost.org/LICENSE_1_0.txt) +# ------------------------------------------------------------------------------ + +name: wide_decimal_codecov +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + gnumake-gcc-gcov-native: + runs-on: ubuntu-20.04 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + standard: [ c++11 ] + compiler: [ g++ ] + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - name: update-tools + run: sudo apt install lcov + - name: clone-submods-bootstrap-headers-boost-develop + run: | + git clone -b develop --depth 1 https://github.com/boostorg/boost.git ../boost-root + cd ../boost-root + git submodule update --init tools + git submodule update --init libs/config + git submodule update --init libs/math + cd libs/math + git checkout no_exceptions_or_rtti_error_handling + cd ../.. + git submodule update --init libs/multiprecision + ./bootstrap.sh + ./b2 headers + - name: gnumake-gcc-gcov-native + run: | + grep BOOST_VERSION ../boost-root/boost/version.hpp + cd .gcov/make + echo "build and run gcov/lcov/genhtml" + echo "make prepare -f make_gcov_01_generic.gmk MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}" + echo + make prepare -f make_gcov_01_generic.gmk MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }} + echo + echo "make gcov -f make_gcov_01_generic.gmk --jobs=8 MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }}" + echo + make gcov -f make_gcov_01_generic.gmk --jobs=8 MY_ALL_COV=0 MY_BOOST_ROOT=../../../boost-root MY_CC=${{ matrix.compiler }} MY_STD=${{ matrix.standard }} + echo + echo "return to wide-decimal root directory" + cd ../.. + - name: upload-codecov + uses: codecov/codecov-action@v2 + with: + files: .gcov/make/coverage.info + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + functionalities: fix diff --git a/README.md b/README.md index a38b5937..a87e09d2 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Total alerts](https://img.shields.io/lgtm/alerts/g/ckormanyos/wide-decimal.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ckormanyos/wide-decimal/alerts/) [![Coverity Scan](https://scan.coverity.com/projects/24792/badge.svg)](https://scan.coverity.com/projects/ckormanyos-wide-decimal) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ckormanyos_wide-decimal&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ckormanyos_wide-decimal) +[![codecov](https://codecov.io/gh/ckormanyos/wide-decimal/branch/main/graph/badge.svg?token=9SEP7RLNSO)](https://codecov.io/gh/ckormanyos/wide-decimal) [![Boost Software License 1.0](https://img.shields.io/badge/license-BSL%201.0-blue.svg)](https://github.com/ckormanyos/wide-decimal/blob/master/LICENSE_1_0.txt) [![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/ckormanyos/wide-decimal)](https://github.com/ckormanyos/wide-decimal) diff --git a/test/test.cpp b/test/test.cpp index 975f9e48..727bdd5f 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -22,8 +22,9 @@ // make tidy -f make_tidy_01_generic.gmk --jobs=8 MY_BOOST_ROOT=/mnt/c/boost/boost_1_79_0 // cd .gcov/make -// make prepare -f make_gcov_01_generic.gmk MY_BOOST_ROOT=/mnt/c/boost/boost_1_79_0 -// make gcov -f make_gcov_01_generic.gmk --jobs=8 MY_BOOST_ROOT=/mnt/c/boost/boost_1_79_0 +// make clean -f make_gcov_01_generic.gmk MY_CC=g++ MY_ALL_COV=0 MY_BOOST_ROOT=/mnt/c/boost/boost_1_79_0 +// make prepare -f make_gcov_01_generic.gmk MY_CC=g++ MY_ALL_COV=0 MY_BOOST_ROOT=/mnt/c/boost/boost_1_79_0 +// make gcov -f make_gcov_01_generic.gmk --jobs=8 MY_CC=g++ MY_ALL_COV=0 MY_BOOST_ROOT=/mnt/c/boost/boost_1_79_0 // cd /mnt/c/Users/User/Documents/Ks/PC_Software/NumericalPrograms/ExtendedNumberTypes/wide_decimal // PATH=/home/chris/local/coverity/cov-analysis-linux64-2021.12.1/bin:$PATH diff --git a/wide_decimal.vcxproj b/wide_decimal.vcxproj index ab21b2fe..cbbf2cd6 100644 --- a/wide_decimal.vcxproj +++ b/wide_decimal.vcxproj @@ -245,6 +245,7 @@ + diff --git a/wide_decimal.vcxproj.filters b/wide_decimal.vcxproj.filters index 55704e27..330cdfee 100644 --- a/wide_decimal.vcxproj.filters +++ b/wide_decimal.vcxproj.filters @@ -292,6 +292,9 @@ .props + + .github\workflows +