diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 54ce3508195..db023d08933 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -94,6 +94,7 @@ jobs: -DCMAKE_C_COMPILER=$TOOLSET_CLANG_DIR/bin/gcc \ -DCMAKE_BUILD_TYPE=Debug \ -DENABLE_TESTING=on \ + -DENABLE_COVERAGE=on \ -B build echo "::set-output name=j::10" echo "::set-output name=t::10" @@ -144,6 +145,11 @@ jobs: make RM_DIR=false down working-directory: tests/ timeout-minutes: 2 + - name: coverage + if: ${{ matrix.compiler == 'gcc-9.2' && matrix.os == 'ubuntu2004' }} + run: | + ~/.local/bin/fastcov -d build -l -o fastcov.info -p --exclude /usr/include --exclude=/opt/vesoft --exclude scanner.lex + bash <(curl -s https://codecov.io/bash) -Z -f fastcov.info - name: Sanitizer if: ${{ always() }} run: | diff --git a/cmake/nebula/GeneralCompilerConfig.cmake b/cmake/nebula/GeneralCompilerConfig.cmake index 3512c1c0d3b..ca9f70c4e6c 100644 --- a/cmake/nebula/GeneralCompilerConfig.cmake +++ b/cmake/nebula/GeneralCompilerConfig.cmake @@ -51,6 +51,8 @@ if(ENABLE_TESTING AND ENABLE_COVERAGE) add_compile_options(--coverage) add_compile_options(-g) add_compile_options(-O0) + nebula_add_exe_linker_flag(-coverage) + nebula_add_exe_linker_flag(-lgcov) endif() # TODO(doodle) Add option suggest-override for gnu diff --git a/tests/requirements.txt b/tests/requirements.txt index 1b4170e593e..b61984421d1 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -11,3 +11,4 @@ pytest-yapf3==0.5.1 filelock==3.0.12 ply==3.10 pyyaml==5.4 +fastcov==1.13