mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 12:41:50 +01:00
tests: Mark tests with AddressSanitizer-detected leaks
Various tests have leaks where it isn't clear whether the data is intentionally not freed, or leaked due to a bug. If we mark these tests as TODO, we can skip them under AddressSanitizer and get the rest to pass, giving us a baseline from which to avoid regressions. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
41ed1c6d5d
commit
f378352051
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
#include "glib/glib-private.h"
|
||||||
|
|
||||||
/* How long to wait in ms for each iteration */
|
/* How long to wait in ms for each iteration */
|
||||||
#define WAIT_ITERATION (10)
|
#define WAIT_ITERATION (10)
|
||||||
|
|
||||||
@ -257,6 +259,11 @@ threaded_dispose_thread_cb (gpointer user_data)
|
|||||||
static void
|
static void
|
||||||
test_cancellable_source_threaded_dispose (void)
|
test_cancellable_source_threaded_dispose (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks lots of GCancellableSource objects, see glib#2309");
|
||||||
|
(void) cancelled_cb;
|
||||||
|
(void) threaded_dispose_thread_cb;
|
||||||
|
#else
|
||||||
ThreadedDisposeData data;
|
ThreadedDisposeData data;
|
||||||
GThread *thread = NULL;
|
GThread *thread = NULL;
|
||||||
guint i;
|
guint i;
|
||||||
@ -326,6 +333,7 @@ test_cancellable_source_threaded_dispose (void)
|
|||||||
g_cond_clear (&data.cond);
|
g_cond_clear (&data.cond);
|
||||||
|
|
||||||
g_ptr_array_unref (cancellables_pending_unref);
|
g_ptr_array_unref (cancellables_pending_unref);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "glib/glib-private.h"
|
||||||
|
|
||||||
#define g_assert_content_type_equals(s1, s2) \
|
#define g_assert_content_type_equals(s1, s2) \
|
||||||
do { \
|
do { \
|
||||||
const char *__s1 = (s1), *__s2 = (s2); \
|
const char *__s1 = (s1), *__s2 = (s2); \
|
||||||
@ -16,6 +18,9 @@
|
|||||||
static void
|
static void
|
||||||
test_guess (void)
|
test_guess (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
gchar *res;
|
gchar *res;
|
||||||
gchar *expected;
|
gchar *expected;
|
||||||
gchar *existing_directory;
|
gchar *existing_directory;
|
||||||
@ -126,11 +131,15 @@ test_guess (void)
|
|||||||
g_assert_false (uncertain);
|
g_assert_false (uncertain);
|
||||||
g_free (res);
|
g_free (res);
|
||||||
g_free (expected);
|
g_free (expected);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_unknown (void)
|
test_unknown (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
gchar *unknown;
|
gchar *unknown;
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
||||||
@ -140,11 +149,15 @@ test_unknown (void)
|
|||||||
g_assert_cmpstr (str, ==, "application/octet-stream");
|
g_assert_cmpstr (str, ==, "application/octet-stream");
|
||||||
g_free (str);
|
g_free (str);
|
||||||
g_free (unknown);
|
g_free (unknown);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_subtype (void)
|
test_subtype (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
gchar *plain;
|
gchar *plain;
|
||||||
gchar *xml;
|
gchar *xml;
|
||||||
|
|
||||||
@ -156,6 +169,7 @@ test_subtype (void)
|
|||||||
|
|
||||||
g_free (plain);
|
g_free (plain);
|
||||||
g_free (xml);
|
g_free (xml);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -169,6 +183,10 @@ find_mime (gconstpointer a, gconstpointer b)
|
|||||||
static void
|
static void
|
||||||
test_list (void)
|
test_list (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
(void) find_mime;
|
||||||
|
#else
|
||||||
GList *types;
|
GList *types;
|
||||||
gchar *plain;
|
gchar *plain;
|
||||||
gchar *xml;
|
gchar *xml;
|
||||||
@ -193,11 +211,15 @@ test_list (void)
|
|||||||
|
|
||||||
g_free (plain);
|
g_free (plain);
|
||||||
g_free (xml);
|
g_free (xml);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_executable (void)
|
test_executable (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
gchar *type;
|
gchar *type;
|
||||||
|
|
||||||
type = g_content_type_from_mime_type ("application/x-executable");
|
type = g_content_type_from_mime_type ("application/x-executable");
|
||||||
@ -211,11 +233,15 @@ test_executable (void)
|
|||||||
type = g_content_type_from_mime_type ("image/png");
|
type = g_content_type_from_mime_type ("image/png");
|
||||||
g_assert_false (g_content_type_can_be_executable (type));
|
g_assert_false (g_content_type_can_be_executable (type));
|
||||||
g_free (type);
|
g_free (type);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_description (void)
|
test_description (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
gchar *type;
|
gchar *type;
|
||||||
gchar *desc;
|
gchar *desc;
|
||||||
|
|
||||||
@ -225,11 +251,15 @@ test_description (void)
|
|||||||
|
|
||||||
g_free (desc);
|
g_free (desc);
|
||||||
g_free (type);
|
g_free (type);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_icon (void)
|
test_icon (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
gchar *type;
|
gchar *type;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
|
|
||||||
@ -266,12 +296,15 @@ test_icon (void)
|
|||||||
}
|
}
|
||||||
g_object_unref (icon);
|
g_object_unref (icon);
|
||||||
g_free (type);
|
g_free (type);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_symbolic_icon (void)
|
test_symbolic_icon (void)
|
||||||
{
|
{
|
||||||
#ifndef G_OS_WIN32
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#elif !defined(G_OS_WIN32)
|
||||||
gchar *type;
|
gchar *type;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
|
|
||||||
@ -319,6 +352,9 @@ test_symbolic_icon (void)
|
|||||||
static void
|
static void
|
||||||
test_tree (void)
|
test_tree (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
const gchar *tests[] = {
|
const gchar *tests[] = {
|
||||||
"x-content/image-dcf",
|
"x-content/image-dcf",
|
||||||
"x-content/unix-software",
|
"x-content/unix-software",
|
||||||
@ -343,11 +379,15 @@ test_tree (void)
|
|||||||
g_strfreev (types);
|
g_strfreev (types);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_type_is_a_special_case (void)
|
test_type_is_a_special_case (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
g_test_bug ("782311");
|
g_test_bug ("782311");
|
||||||
@ -359,11 +399,15 @@ test_type_is_a_special_case (void)
|
|||||||
res = g_content_type_is_a ("anything", "application/octet-stream");
|
res = g_content_type_is_a ("anything", "application/octet-stream");
|
||||||
g_assert_true (res);
|
g_assert_true (res);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_guess_svg_from_data (void)
|
test_guess_svg_from_data (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#else
|
||||||
const gchar svgfilecontent[] = "<svg xmlns=\"http://www.w3.org/2000/svg\"\
|
const gchar svgfilecontent[] = "<svg xmlns=\"http://www.w3.org/2000/svg\"\
|
||||||
xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n\
|
xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n\
|
||||||
<rect x=\"10\" y=\"10\" height=\"100\" width=\"100\"\n\
|
<rect x=\"10\" y=\"10\" height=\"100\" width=\"100\"\n\
|
||||||
@ -382,12 +426,15 @@ test_guess_svg_from_data (void)
|
|||||||
#endif
|
#endif
|
||||||
g_assert_false (uncertain);
|
g_assert_false (uncertain);
|
||||||
g_free (res);
|
g_free (res);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_mime_from_content (void)
|
test_mime_from_content (void)
|
||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks xdgmime internal data, see glib#2310");
|
||||||
|
#elif defined(__APPLE__)
|
||||||
gchar *mime_type;
|
gchar *mime_type;
|
||||||
mime_type = g_content_type_get_mime_type ("com.microsoft.bmp");
|
mime_type = g_content_type_get_mime_type ("com.microsoft.bmp");
|
||||||
g_assert_cmpstr (mime_type, ==, "image/bmp");
|
g_assert_cmpstr (mime_type, ==, "image/bmp");
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "glib/glib-private.h"
|
||||||
|
|
||||||
#include "gdbus-tests.h"
|
#include "gdbus-tests.h"
|
||||||
|
|
||||||
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64
|
#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64
|
||||||
@ -1302,6 +1304,18 @@ static gpointer
|
|||||||
check_proxies_in_thread (gpointer user_data)
|
check_proxies_in_thread (gpointer user_data)
|
||||||
{
|
{
|
||||||
GMainLoop *loop = user_data;
|
GMainLoop *loop = user_data;
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
|
||||||
|
/* Silence "Not available before 2.38" when using old API */
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
|
g_test_incomplete ("FIXME: Leaks a GWeakRef, see glib#2312");
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
|
|
||||||
|
(void) check_thread_proxies;
|
||||||
|
(void) check_authorize_proxy;
|
||||||
|
(void) check_bat_proxy;
|
||||||
|
(void) check_bar_proxy;
|
||||||
|
#else
|
||||||
GMainContext *thread_context;
|
GMainContext *thread_context;
|
||||||
GMainLoop *thread_loop;
|
GMainLoop *thread_loop;
|
||||||
GError *error;
|
GError *error;
|
||||||
@ -1370,6 +1384,7 @@ check_proxies_in_thread (gpointer user_data)
|
|||||||
|
|
||||||
g_main_loop_unref (thread_loop);
|
g_main_loop_unref (thread_loop);
|
||||||
g_main_context_unref (thread_context);
|
g_main_context_unref (thread_context);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* this breaks out of the loop in main() (below) */
|
/* this breaks out of the loop in main() (below) */
|
||||||
g_main_loop_quit (loop);
|
g_main_loop_quit (loop);
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "gdbus-sessionbus.h"
|
#include "gdbus-sessionbus.h"
|
||||||
|
|
||||||
|
#include "glib/glib-private.h"
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
time_out (gpointer unused G_GNUC_UNUSED)
|
time_out (gpointer unused G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
@ -1012,11 +1014,17 @@ test_dbus_roundtrip (void)
|
|||||||
static void
|
static void
|
||||||
test_dbus_peer_roundtrip (void)
|
test_dbus_peer_roundtrip (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks a GCancellableSource, see glib#2313");
|
||||||
|
(void) peer_connection_up;
|
||||||
|
(void) peer_connection_down;
|
||||||
|
#else
|
||||||
PeerConnection peer;
|
PeerConnection peer;
|
||||||
|
|
||||||
peer_connection_up (&peer);
|
peer_connection_up (&peer);
|
||||||
do_roundtrip (peer.server_connection, peer.client_connection);
|
do_roundtrip (peer.server_connection, peer.client_connection);
|
||||||
peer_connection_down (&peer);
|
peer_connection_down (&peer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint items_changed_count;
|
static gint items_changed_count;
|
||||||
@ -1145,11 +1153,17 @@ test_dbus_subscriptions (void)
|
|||||||
static void
|
static void
|
||||||
test_dbus_peer_subscriptions (void)
|
test_dbus_peer_subscriptions (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks a GCancellableSource, see glib#2313");
|
||||||
|
(void) peer_connection_up;
|
||||||
|
(void) peer_connection_down;
|
||||||
|
#else
|
||||||
PeerConnection peer;
|
PeerConnection peer;
|
||||||
|
|
||||||
peer_connection_up (&peer);
|
peer_connection_up (&peer);
|
||||||
do_subscriptions (peer.server_connection, peer.client_connection);
|
do_subscriptions (peer.server_connection, peer.client_connection);
|
||||||
peer_connection_down (&peer);
|
peer_connection_down (&peer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
#include "glib/glib-private.h"
|
||||||
|
|
||||||
/* These tests were written for the inotify implementation.
|
/* These tests were written for the inotify implementation.
|
||||||
* Other implementations may require slight adjustments in
|
* Other implementations may require slight adjustments in
|
||||||
* the tests, e.g. the length of timeouts
|
* the tests, e.g. the length of timeouts
|
||||||
@ -954,6 +956,11 @@ static void
|
|||||||
test_file_hard_links (Fixture *fixture,
|
test_file_hard_links (Fixture *fixture,
|
||||||
gconstpointer user_data)
|
gconstpointer user_data)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks an inotify data structure, see glib#2311");
|
||||||
|
(void) file_hard_links_output;
|
||||||
|
(void) file_hard_links_step;
|
||||||
|
#else
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
TestData data;
|
TestData data;
|
||||||
|
|
||||||
@ -1004,6 +1011,7 @@ test_file_hard_links (Fixture *fixture,
|
|||||||
g_object_unref (data.monitor);
|
g_object_unref (data.monitor);
|
||||||
g_object_unref (data.file);
|
g_object_unref (data.file);
|
||||||
g_object_unref (data.output_stream);
|
g_object_unref (data.output_stream);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1645,6 +1645,10 @@ threadf (gpointer data)
|
|||||||
static void
|
static void
|
||||||
test_mainloop_wait (void)
|
test_mainloop_wait (void)
|
||||||
{
|
{
|
||||||
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
(void) threadf;
|
||||||
|
g_test_incomplete ("FIXME: Leaks a GMainLoop, see glib#2307");
|
||||||
|
#else
|
||||||
GMainContext *context;
|
GMainContext *context;
|
||||||
GThread *t1, *t2;
|
GThread *t1, *t2;
|
||||||
|
|
||||||
@ -1657,6 +1661,7 @@ test_mainloop_wait (void)
|
|||||||
g_thread_join (t2);
|
g_thread_join (t2);
|
||||||
|
|
||||||
g_main_context_unref (context);
|
g_main_context_unref (context);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "glib/glib-private.h"
|
||||||
|
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
@ -132,7 +134,9 @@ test_thread3 (void)
|
|||||||
static void
|
static void
|
||||||
test_thread4 (void)
|
test_thread4 (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PRLIMIT
|
#ifdef _GLIB_ADDRESS_SANITIZER
|
||||||
|
g_test_incomplete ("FIXME: Leaks a GSystemThread's name, see glib#2308");
|
||||||
|
#elif defined(HAVE_PRLIMIT)
|
||||||
struct rlimit ol, nl;
|
struct rlimit ol, nl;
|
||||||
GThread *thread;
|
GThread *thread;
|
||||||
GError *error;
|
GError *error;
|
||||||
|
Loading…
Reference in New Issue
Block a user