From a2eb3b3ea94cf65918f074e4166676342f7e51c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCck?= Date: Sat, 21 Dec 2024 20:53:15 +0100 Subject: [PATCH 1/3] Coverage in CI --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f897362..0299ce1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,16 +43,16 @@ jobs: include: - llvm-version: 12 os: ubuntu-20.04 - preset: develop + preset: coverage - llvm-version: 14 os: ubuntu-22.04 - preset: develop + preset: coverage - llvm-version: 15 os: ubuntu-22.04 - preset: develop + preset: coverage - llvm-version: 18 os: ubuntu-24.04 - preset: develop + preset: coverage runs-on: ${{ matrix.os }} @@ -68,6 +68,9 @@ jobs: - name: Install Clang run: sudo apt-get install clang-${{ matrix.llvm-version }} clang-tidy-${{ matrix.llvm-version }} + - name: Install lcov + run: sudo apt-get install lcov + - name: Setup env run: | sudo ln -f -s /usr/bin/clang-${{ matrix.llvm-version }} /usr/bin/clang @@ -83,3 +86,24 @@ jobs: - name: Test with lit-suite run: cmake --build build --target check-dimeta + + - name: Build coverage report + run: cmake --build build --target dimeta-coverage + + - name: Coveralls (parallel) + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: build/coverage.info + flag-name: ${{ matrix.llvm-version }}-${{ matrix.os }} + parallel: true + + finish-coverage: + needs: lit-suite + runs-on: ubuntu-22.04 + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true \ No newline at end of file From 4424d7a3d17f7105f9f6a1b9f38db71f38b2de42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCck?= Date: Sat, 21 Dec 2024 21:11:12 +0100 Subject: [PATCH 2/3] Config flags for lcov --- cmake/modules/coverage-lcov.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/modules/coverage-lcov.cmake b/cmake/modules/coverage-lcov.cmake index 8f180cc..07dcd92 100644 --- a/cmake/modules/coverage-lcov.cmake +++ b/cmake/modules/coverage-lcov.cmake @@ -25,7 +25,7 @@ endif() set( DIMETA_COVERAGE_TRACE_COMMAND - ${DIMETA_LCOV_EXEC} ${GCOV_TOOL} -c -q + ${DIMETA_LCOV_EXEC} ${GCOV_TOOL} --rc branch_coverage=1 --rc derive_function_end_line=0 -c -q -o "${PROJECT_BINARY_DIR}/coverage.info" -d "${PROJECT_BINARY_DIR}" --include "${PROJECT_SOURCE_DIR}/*" @@ -35,7 +35,7 @@ set( set( DIMETA_COVERAGE_HTML_COMMAND - ${DIMETA_GENHTML_EXEC} --legend -f -q + ${DIMETA_GENHTML_EXEC} --rc branch_coverage=1 --rc derive_function_end_line=0 --legend -f -q "${PROJECT_BINARY_DIR}/coverage.info" -p "${PROJECT_SOURCE_DIR}" -o "${PROJECT_BINARY_DIR}/coverage_html" From 2e39ad847a9b63f122604dcb5e8e6d9596338ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20H=C3=BCck?= Date: Sat, 21 Dec 2024 21:22:54 +0100 Subject: [PATCH 3/3] Coverage badge --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0299ce1..5b6d63f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,4 +106,4 @@ jobs: uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} - parallel-finished: true \ No newline at end of file + parallel-finished: true diff --git a/README.md b/README.md index 624feb7..b81ee91 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# llvm-dimeta · [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) +# llvm-dimeta · [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![Coverage Status](https://coveralls.io/repos/github/ahueck/llvm-dimeta/badge.svg?branch=main)](https://coveralls.io/github/ahueck/llvm-dimeta) llvm-dimeta is library to determine the type of stack (`AllocaInst`), globals (`GlobalVariables`) and heap allocations in LLVM IR based only on the LLVM debug information and metadata.