Improve code coverage collection by utilizing the "-i" flag
prior to the run.  This allows coverage on #ifdef'ed code.

Also, archive the code coverage files for later analysis if
desired.

Signed-off-by: Tom Hromatka <tom.hroma...@oracle.com>
---
 .github/actions/setup-libcgroup/action.yml   |  2 ++
 .github/workflows/continuous-integration.yml | 36 ++++++++++++++++----
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/.github/actions/setup-libcgroup/action.yml 
b/.github/actions/setup-libcgroup/action.yml
index 6eeb169d5709..fba984286f1f 100644
--- a/.github/actions/setup-libcgroup/action.yml
+++ b/.github/actions/setup-libcgroup/action.yml
@@ -32,3 +32,5 @@ runs:
     shell: bash
   - run: make
     shell: bash
+  - run: lcov -i -d . -c -o lcov.base
+    shell: bash
diff --git a/.github/workflows/continuous-integration.yml 
b/.github/workflows/continuous-integration.yml
index 6c47ebd82609..997da9de08dd 100644
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -42,14 +42,22 @@ jobs:
       if: ${{ always() }}
       run: cat tests/gunit/test-suite.log
     - name: Collate code coverage results
-      run: lcov -d . -c > lcov.info
+      run: |
+        lcov -d . -c -o lcov.tests
+        lcov -a lcov.base -a lcov.tests -o lcov.total
     - name: Upload code coverage results
       uses: coverallsapp/github-action@master
       with:
         github-token: ${{ secrets.GITHUB_TOKEN }}
-        path-to-lcov: ./lcov.info
+        path-to-lcov: ./lcov.total
         flag-name: "Unit Tests"
         parallel: True
+    - name: Archive code coverage results
+      if: ${{ always() }}
+      uses: actions/upload-artifact@v2
+      with:
+        name: Unit Test Code Coverage
+        path: lcov.*
 
   functionaltestsv1:
     name: Cgroup v1 Functional Tests
@@ -77,14 +85,22 @@ jobs:
         name: Cgroup v1 test logs
         path: tests/ftests/*.log
     - name: Collate code coverage results
-      run: lcov -d . -c > lcov.info
+      run: |
+        lcov -d . -c -o lcov.tests
+        lcov -a lcov.base -a lcov.tests -o lcov.total
     - name: Upload code coverage results
       uses: coverallsapp/github-action@master
       with:
         github-token: ${{ secrets.GITHUB_TOKEN }}
-        path-to-lcov: ./lcov.info
+        path-to-lcov: ./lcov.total
         flag-name: "Cgroup v1 Functional Tests"
         parallel: True
+    - name: Archive code coverage results
+      if: ${{ always() }}
+      uses: actions/upload-artifact@v2
+      with:
+        name: Cgroup v1 Code Coverage
+        path: lcov.*
 
   functionaltestsv2:
     name: Cgroup v2 Functional Tests
@@ -122,14 +138,22 @@ jobs:
         name: Cgroup v2 test logs
         path: tests/ftests/*.log
     - name: Collate code coverage results
-      run: lcov -d . -c > lcov.info
+      run: |
+        lcov -d . -c -o lcov.tests
+        lcov -a lcov.base -a lcov.tests -o lcov.total
     - name: Upload code coverage results
       uses: coverallsapp/github-action@master
       with:
         github-token: ${{ secrets.GITHUB_TOKEN }}
-        path-to-lcov: ./lcov.info
+        path-to-lcov: ./lcov.total
         flag-name: "Cgroup v2 Functional Tests"
         parallel: True
+    - name: Archive code coverage results
+      if: ${{ always() }}
+      uses: actions/upload-artifact@v2
+      with:
+        name: Cgroup v2 Code Coverage
+        path: lcov.*
 
   finalize:
     name: Finalize the test run
-- 
2.26.2



_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to