From 8bbb7216367890b9a8d0e5bc7899d180e3af1e87 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 8 Jun 2016 14:57:46 +0300 Subject: [PATCH] [Qt][build] Updated valgrind supression and make it a target for Qt --- Makefile | 10 +- configure | 1 + platform/qt/scripts/configure.sh | 2 + scripts/valgrind.sh | 16 +++ scripts/valgrind.sup | 179 +++++++++++++++++++++++-------- 5 files changed, 161 insertions(+), 47 deletions(-) create mode 100755 scripts/valgrind.sh diff --git a/Makefile b/Makefile index ad1ebba79..3f8332938 100644 --- a/Makefile +++ b/Makefile @@ -239,6 +239,13 @@ run-qt-app: qt-app run-qt-qml-app: qt-qml-app cd $(QT_OUTPUT_PATH)/$(BUILDTYPE) && ./qquickmapboxgl +test-valgrind-qt: $(QT_MAKEFILE) node_modules + $(QT_ENV) $(MAKE) -j$(JOBS) -C $(QT_OUTPUT_PATH) test + ./scripts/valgrind.sh $(QT_OUTPUT_PATH)/$(BUILDTYPE)/test --gtest_catch_exceptions=0 --gtest_filter=-*.Load + +run-valgrind-qt-app: qt-app + ./scripts/valgrind.sh $(QT_OUTPUT_PATH)/$(BUILDTYPE)/qmapboxgl --test -platform offscreen + #### Linux targets ##################################################### LINUX_OUTPUT_PATH = build/linux-$(shell uname -m) @@ -270,9 +277,6 @@ test: $(LINUX_MAKEFILE) run-glfw-app: glfw-app cd $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) && ./mapbox-glfw -run-valgrind-glfw-app: glfw-app - cd $(LINUX_OUTPUT_PATH)/$(BUILDTYPE) && valgrind --leak-check=full --suppressions=../../../scripts/valgrind.sup ./mapbox-glfw - ifneq (,$(shell which gdb)) GDB = gdb -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args endif diff --git a/configure b/configure index 69acbde01..67148de71 100755 --- a/configure +++ b/configure @@ -123,6 +123,7 @@ print_flags webp static_libs cflags ldflags print_flags jni.hpp cflags print_flags earcut cflags print_flags benchmark static_libs cflags ldflags +print_flags valgrind CONFIG+=" } } diff --git a/platform/qt/scripts/configure.sh b/platform/qt/scripts/configure.sh index 4b855f7c5..5f31c853d 100644 --- a/platform/qt/scripts/configure.sh +++ b/platform/qt/scripts/configure.sh @@ -28,6 +28,8 @@ if [ "$MASON_PLATFORM" == "osx" ]; then CONFIG+=" 'opengl_ldflags%': ['-framework OpenGL', '-framework CoreFoundation'],"$LN } else + VALGRIND_VERSION=latest + function print_opengl_flags { CONFIG+=" 'opengl_cflags%': $(quote_flags $(pkg-config gl x11 --cflags)),"$LN CONFIG+=" 'opengl_ldflags%': $(quote_flags $(pkg-config gl x11 --libs)),"$LN diff --git a/scripts/valgrind.sh b/scripts/valgrind.sh new file mode 100755 index 000000000..009e18c43 --- /dev/null +++ b/scripts/valgrind.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +PARAMS="\ + --leak-check=full \ + --show-leak-kinds=definite \ + --errors-for-leak-kinds=definite \ + --error-exitcode=1 \ + --gen-suppressions=all \ + --suppressions=scripts/valgrind.sup" + +export VALGRIND_LIB=$(.mason/mason prefix valgrind latest)/lib/valgrind + +$(.mason/mason prefix valgrind latest)/bin/valgrind $PARAMS $@ diff --git a/scripts/valgrind.sup b/scripts/valgrind.sup index fcde049d9..f21f54be5 100644 --- a/scripts/valgrind.sup +++ b/scripts/valgrind.sup @@ -1,91 +1,182 @@ { - Valgrind gets confused with buffers managed by the graphics driver + Graphics driver buffers Memcheck:Leak ... - obj:/usr/*/dri/r600_dri.so + obj:*/r600_dri.* + obj:*/r600_dri.* + obj:*/r600_dri.* ... } { - GLFW _glfwCreateCursor() + Graphics driver buffers Memcheck:Leak - match-leak-kinds: reachable ... - obj:/usr/*/libX11.so.6.3.0 - ... - fun:_glfwCreateCursor + obj:*/i965_dri.* + obj:*/i965_dri.* + obj:*/i965_dri.* ... } { - GLFW _glfwPlatform*() + Graphics driver buffers Memcheck:Leak - match-leak-kinds: reachable ... - fun:_glfwPlatform* + obj:*/nouveau_dri.* + obj:*/nouveau_dri.* + obj:*/nouveau_dri.* ... } { - Buffer managed by OpenGL? + Ubuntu 16.04 - GLFW + Memcheck:Leak + ... + fun:glfwInit + ... +} +{ + Ubuntu 16.04 - GLFW Memcheck:Cond ... - fun:_ZN4mbgl*Uniform* - ... - fun:_ZN8GLFWView10invalidateEv + fun:glfwInit ... } { - Buffer managed by OpenGL? + Ubuntu 16.04 - Qt + glib Memcheck:Cond - fun:_ZNSt7__equalILb0EE5equalIPKfS3_EEbT_S4_T0_ - ... - fun:_ZN4mbgl7Painter11renderLayerERKNS_10StyleLayerEPKNS_4Tile2IDEPKSt5arrayIfLm16EE -} -{ - Valgrind doesn't like our make_unique (C++14 polyfill) - Memcheck:Leak - match-leak-kinds: reachable - fun:malloc - ... - fun:_ZN4mbgl4util11make_unique* + fun:g_utf8_offset_to_pointer ... } { - dlopen doing its magic - Memcheck:Leak - match-leak-kinds: reachable + Ubuntu 16.04 - Qt + glib + Memcheck:Cond ... - fun:_dl_open + fun:g_signal_emit_valist + ... + fun:*QApplicationPrivate* ... } { - X11 false positive - Memcheck:Leak - match-leak-kinds: reachable + Ubuntu 16.04 - Qt + X11 + Memcheck:Param + writev(vector[...]) ... - obj:/usr/*/libX11.so.6.3.0 - ... - fun:_XrmInitParseInfo + obj:*/libxcb.* + fun:xcb_flush ... } { - OpenSSL false positive + Ubuntu 16.04 - Qt + X11 Memcheck:Leak ... - fun:CRYPTO_malloc + fun:_XmbTextListToTextProperty + ... + fun:*QWidget*setVisible* ... } { - OpenSSL false positive + Ubuntu 16.04 - Qt + Fontconfig Memcheck:Leak ... - fun:CRYPTO_realloc + obj:*/libfontconfig.* + obj:*/libfontconfig.* + ... + fun:FcFontRenderPrepare ... } { - Libcurl false positive + Ubuntu 16.04 - Qt + Fontconfig + Memcheck:Leak + ... + obj:*/libfontconfig.* + obj:*/libfontconfig.* + ... + fun:FcPatternAddInteger + ... +} +{ + Ubuntu 16.04 - Qt + Fontconfig + Memcheck:Leak + ... + obj:*/libfontconfig.* + obj:*/libfontconfig.* + ... + fun:FcConfigParseAndLoad + ... +} +{ + Ubuntu 16.04 - Qt + Dbus + Memcheck:Leak + ... + fun:dbus_connection_send_with_reply + ... + fun:*QWidget* +} +{ + Ubuntu 16.04 - Qt + Dbus + Memcheck:Leak + ... + fun:px_proxy_factory_get_proxies + obj:*/libQt5Network.* +} +{ + Ubuntu 16.04 - Qt + Memcheck:Leak + ... + fun:*QGuiApplicationPrivate*createEventDispatcher* + fun:*QCoreApplication*init* + ... +} +{ + Ubuntu 16.04 - Qt + Memcheck:Leak + ... + fun:*QWidget*setWindowTitle* + ... +} +{ + Ubuntu 16.04 - Qt + Memcheck:Leak + ... + fun:*QNetworkConfigurationManagerPrivate*updateConfigurations* + ... +} +{ + Ubuntu 16.04 - Mysterious leak when running utests + Memcheck:Leak + fun:calloc + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* +} +{ + Ubuntu 16.04 - Mysterious leak when running utests Memcheck:Leak fun:malloc - ... - obj:/usr/*/libcurl.so.4.3.0 - fun:curl_multi_socket_action + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* + obj:* +} +{ + Ubuntu 14.04 - Travis CI bot using swrast + Memcheck:Cond + fun:do_stencil_test + fun:_swrast_stencil_and_ztest_span + fun:_swrast_write_rgba_span + fun:draw_wide_line ... }