[mutter/wip/carlosg/ci-coverage-merge] ci: Run coverage in all tests, and merge results




commit 72f69d5f2952d50e966b1e6dd77c150a231d0c17
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Mar 1 01:12:58 2022 +0100

    ci: Run coverage in all tests, and merge results
    
    Instead of having different coverage outputs for different architectures
    and compilation flags, have each of those tests run coverage in order
    to generate a JSON report, and have that merged at a final common job.

 .gitlab-ci.yml | 30 ++++++++++++++----------------
 meson.build    |  1 -
 2 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5e80d9464f..3f99c5fda0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -286,6 +286,13 @@ build-without-native-backend-and-wayland@x86_64:
   script:
     - dbus-run-session -- xvfb-run -a -s "$XVFB_SERVER_ARGS"
         ./.gitlab-ci/run-meson.sh test -C build --no-rebuild -t 10
+  after_script:
+    - pushd build
+    - gcovr --root=..
+        --filter='\.\./src/' --filter='\.\./clutter/' --filter='\.\./cogl/'
+        --exclude='\.\./build/.*\.[ch]$' --exclude='.*/tests/.*\.[ch]$'
+        --json --output=../coverage-${CI_JOB_NAME}.json
+    - popd
   artifacts:
     expire_in: 1 day
     reports:
@@ -294,6 +301,7 @@ build-without-native-backend-and-wayland@x86_64:
     when: always
     paths:
       - build
+      - coverage-*.json
 
 test-mutter@x86_64:
   extends:
@@ -309,30 +317,20 @@ test-mutter@aarch64:
   needs:
     - build-mutter@aarch64
 
-.test-mutter-coverage:
+coverage:
   extends:
     - .fdo.distribution-image@fedora
+    - .mutter.fedora:35@x86_64
   stage: analyze
   script:
-    - ninja -C build coverage
-    - cat build/meson-logs/coverage.txt
+    - mkdir coveragereport
+    - gcovr --add-tracefile coverage-*.json --html-details --print-summary --output coveragereport/index.html
   artifacts:
     paths:
-      - build/meson-logs/coveragereport
-  coverage: '/^TOTAL.*\s+(\d+\%)$/'
-
-test-mutter-coverage@x86_64:
-  extends:
-    - .test-mutter-coverage
-    - .mutter.fedora:35@x86_64
+      - coveragereport
+  coverage: '/^lines: (\d+\.\d+\%)/'
   needs:
     - test-mutter@x86_64
-
-test-mutter-coverage@aarch64:
-  extends:
-    - .test-mutter-coverage
-    - .mutter.fedora:35@aarch64
-  needs:
     - test-mutter@aarch64
 
 can-build-gnome-shell@x86_64:
diff --git a/meson.build b/meson.build
index b6522f93d3..547f940884 100644
--- a/meson.build
+++ b/meson.build
@@ -333,7 +333,6 @@ if have_tests
     ],
     exe_wrapper: [
       default_test_wrappers,
-      find_program('catchsegv'),
       find_program('xvfb-run'), '-a', '-s', '+iglx -noreset',
     ],
     timeout_multiplier: 10,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]