]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
github: Improve code coverage collection 56/head
authorTom Hromatka <tom.hromatka@oracle.com>
Tue, 6 Jul 2021 19:26:34 +0000 (13:26 -0600)
committerTom Hromatka <tom.hromatka@oracle.com>
Tue, 6 Jul 2021 19:44:38 +0000 (13:44 -0600)
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.hromatka@oracle.com>
.github/actions/setup-libcgroup/action.yml
.github/workflows/continuous-integration.yml

index 18615853a5e31c8e258c0d2def76967c93718b7f..fae416c8a410c9ed7cbf8997fb7e505769c1921b 100644 (file)
@@ -36,3 +36,5 @@ runs:
     shell: bash
   - run: make
     shell: bash
+  - run: lcov -i -d . -c -o lcov.base
+    shell: bash
index 1eb29d59bcefaa4f4fc3ec311266c82c4ee3ee71..06722b461a8caa4646c005b3f3898c3faf70ce11 100644 (file)
@@ -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
@@ -80,14 +88,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.*
 
   functionaltestsv1v2:
     name: Cgroup v1/v2 Functional Tests
@@ -136,6 +152,12 @@ jobs:
         path-to-lcov: ./lcov.info
         flag-name: "Cgroup v1/v2 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
@@ -164,14 +186,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