[glib: 3/10] ci: Add valgrind memcheck support on Fedora



commit 197eff3fc8c79fae20be353801f79de9a52ce387
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Jun 26 17:23:09 2018 +0100

    ci: Add valgrind memcheck support on Fedora
    
    Add a separate CI job which runs memcheck on the unit tests. This is
    done as a separate job from the main build, since we don’t want it to
    interact with code coverage at all.
    
    Currently, failure of this job is ignored. Issue #333 will eventually
    fix that.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Fixes: #487

 .gitlab-ci.yml          | 34 ++++++++++++++++++++++++++++++++++
 .gitlab-ci/run-tests.sh | 15 +++++++++++++--
 2 files changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4ccd9cb8f..0f091e761 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -111,6 +111,40 @@ G_DISABLE_ASSERT:
       - "_build/meson-logs"
       - "_build/${CI_JOB_NAME}-report.xml"
 
+valgrind:
+  image: registry.gitlab.gnome.org/gnome/glib/fedora:v3
+  stage: analysis
+  except:
+    - tags
+  variables:
+    MESON_TEST_TIMEOUT_MULTIPLIER: 10
+  script:
+    - meson ${MESON_COMMON_OPTIONS}
+            --werror
+            -Dsystemtap=true
+            -Ddtrace=true
+            -Dfam=true
+            -Dinstalled_tests=true
+            _build
+    - ninja -C _build
+    - bash -x ./.gitlab-ci/run-tests.sh
+                 --log-file _build/meson-logs/testlog-valgrind.json
+                 --wrap "valgrind --tool=memcheck --error-exitcode=1 --track-origins=yes --leak-check=full 
--leak-resolution=high --num-callers=50 --show-leak-kinds=definite,possible --show-error-list=yes 
--suppressions=${CI_PROJECT_DIR}/glib.supp"
+                 --no-suite no-valgrind
+                 --no-suite slow
+  # FIXME: Remove this when we have zero valgrind leaks.
+  # https://gitlab.gnome.org/GNOME/glib/issues/333
+  allow_failure: true
+  artifacts:
+    reports:
+      junit: "_build/${CI_JOB_NAME}-report.xml"
+    name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
+    when: always
+    paths:
+      - "_build/config.h"
+      - "_build/glib/glibconfig.h"
+      - "_build/meson-logs"
+
 .cross-template: &cross-template
   stage: build
   except:
diff --git a/.gitlab-ci/run-tests.sh b/.gitlab-ci/run-tests.sh
index ca02816f9..539726e9a 100755
--- a/.gitlab-ci/run-tests.sh
+++ b/.gitlab-ci/run-tests.sh
@@ -2,10 +2,21 @@
 
 set +e
 
+case "$1" in
+  --log-file)
+    log_file="$2"
+    shift
+    shift
+    ;;
+  *)
+    log_file="_build/meson-logs/testlog.json"
+esac
+
 meson test \
         -C _build \
         --timeout-multiplier ${MESON_TEST_TIMEOUT_MULTIPLIER} \
-        --no-suite flaky
+        --no-suite flaky \
+        "$@"
 
 exit_code=$?
 
@@ -13,6 +24,6 @@ python3 .gitlab-ci/meson-junit-report.py \
         --project-name=glib \
         --job-id "${CI_JOB_NAME}" \
         --output "_build/${CI_JOB_NAME}-report.xml" \
-        _build/meson-logs/testlog.json
+        "${log_file}"
 
 exit $exit_code


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