From bcdb865c597b9201b717f0d4b420e73a2393e5ff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 12 Oct 2011 00:37:02 -0400 Subject: [PATCH] Disable deprecations where appropriate in tests --- glib/tests/cache.c | 3 +++ glib/tests/cond.c | 3 +++ glib/tests/date.c | 3 +++ glib/tests/fileutils.c | 4 ++++ glib/tests/mainloop.c | 38 ++++++++++++++++++++++++++++++++++++++ glib/tests/mappedfile.c | 2 ++ glib/tests/mutex.c | 3 +++ glib/tests/once.c | 2 +- glib/tests/private.c | 5 +++-- glib/tests/rec-mutex.c | 3 +++ glib/tests/rwlock.c | 3 +++ glib/tests/strfuncs.c | 6 +++--- glib/tests/string.c | 3 +++ glib/tests/thread.c | 2 -- glib/tests/tree.c | 3 +++ glib/tests/unicode.c | 3 +++ 16 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 glib/tests/mainloop.c diff --git a/glib/tests/cache.c b/glib/tests/cache.c index 5ece83d..31ea9fa 100644 --- a/glib/tests/cache.c +++ b/glib/tests/cache.c @@ -16,6 +16,9 @@ * Boston, MA 02111-1307, USA. */ +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include static gint value_create_count = 0; diff --git a/glib/tests/cond.c b/glib/tests/cond.c index ac9e8dc..26a5dbf 100644 --- a/glib/tests/cond.c +++ b/glib/tests/cond.c @@ -20,6 +20,9 @@ * if advised of the possibility of such damage. */ +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include static GCond cond; diff --git a/glib/tests/date.c b/glib/tests/date.c index 772e965..39b792f 100644 --- a/glib/tests/date.c +++ b/glib/tests/date.c @@ -1,6 +1,9 @@ #undef G_DISABLE_ASSERT #undef G_LOG_DOMAIN +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include "glib.h" #include diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index f429fd9..544ec60 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -21,6 +21,10 @@ #include #include + +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include #include diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c new file mode 100644 index 0000000..14034a9 --- /dev/null +++ b/glib/tests/mainloop.c @@ -0,0 +1,38 @@ +/* Unit tests for GMainLoop + * Copyright (C) 2011 Red Hat, Inc + * Author: Matthias Clasen + * + * This work is provided "as is"; redistribution and modification + * in whole or in part, in any medium, physical or electronic is + * permitted without restriction. + * + * This work is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * In no event shall the authors or contributors be liable for any + * direct, indirect, incidental, special, exemplary, or consequential + * damages (including, but not limited to, procurement of substitute + * goods or services; loss of use, data, or profits; or business + * interruption) however caused and on any theory of liability, whether + * in contract, strict liability, or tort (including negligence or + * otherwise) arising in any way out of the use of this software, even + * if advised of the possibility of such damage. + */ + +#include + +static void +test_unref (void) +{ +} + +int +main (int argc, char *argv[]) +{ + g_test_init (&argc, &argv, NULL); + + g_test_add_func ("/mainloop/unref", test_unref); + + return g_test_run (); +} diff --git a/glib/tests/mappedfile.c b/glib/tests/mappedfile.c index be2e6f6..5387a64 100644 --- a/glib/tests/mappedfile.c +++ b/glib/tests/mappedfile.c @@ -1,3 +1,5 @@ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include #include #include diff --git a/glib/tests/mutex.c b/glib/tests/mutex.c index 17959c2..3bd2e2f 100644 --- a/glib/tests/mutex.c +++ b/glib/tests/mutex.c @@ -20,6 +20,9 @@ * if advised of the possibility of such damage. */ +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include #include diff --git a/glib/tests/once.c b/glib/tests/once.c index dcb8e29..c59cb4d 100644 --- a/glib/tests/once.c +++ b/glib/tests/once.c @@ -104,7 +104,7 @@ test_once3 (void) shared = 0; for (i = 0; i < THREADS; i++) - threads[i] = g_thread_create (thread_func, NULL, TRUE, NULL); + threads[i] = g_thread_new ("once3", thread_func, NULL, TRUE, NULL); for (i = 0; i < THREADS; i++) g_thread_join (threads[i]); diff --git a/glib/tests/private.c b/glib/tests/private.c index 4cd60ce..c21aacf 100644 --- a/glib/tests/private.c +++ b/glib/tests/private.c @@ -20,6 +20,9 @@ * if advised of the possibility of such damage. */ +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include /* test basics: @@ -374,8 +377,6 @@ main (int argc, char *argv[]) { g_test_init (&argc, &argv, NULL); - g_assert (g_thread_get_initialized ()); - g_test_add_func ("/thread/private1", test_private1); g_test_add_func ("/thread/private2", test_private2); g_test_add_func ("/thread/private3", test_private3); diff --git a/glib/tests/rec-mutex.c b/glib/tests/rec-mutex.c index e587156..4fd6156 100644 --- a/glib/tests/rec-mutex.c +++ b/glib/tests/rec-mutex.c @@ -20,6 +20,9 @@ * if advised of the possibility of such damage. */ +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include #include diff --git a/glib/tests/rwlock.c b/glib/tests/rwlock.c index d3d0f9d..9d51b30 100644 --- a/glib/tests/rwlock.c +++ b/glib/tests/rwlock.c @@ -20,6 +20,9 @@ * if advised of the possibility of such damage. */ +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include static void diff --git a/glib/tests/strfuncs.c b/glib/tests/strfuncs.c index 38aa16a..d4bac4a 100644 --- a/glib/tests/strfuncs.c +++ b/glib/tests/strfuncs.c @@ -1077,8 +1077,8 @@ test_bounds (void) file = g_mapped_file_new ("4096-random-bytes", TRUE, NULL); after = g_mapped_file_new ("4096-random-bytes", TRUE, NULL); - g_mapped_file_free (before); - g_mapped_file_free (after); + g_mapped_file_unref (before); + g_mapped_file_unref (after); g_assert (file != NULL); g_assert_cmpint (g_mapped_file_get_length (file), ==, 4096); @@ -1212,7 +1212,7 @@ test_bounds (void) g_free (tmp2); g_free (tmp); - g_mapped_file_free (file); + g_mapped_file_unref (file); } static void diff --git a/glib/tests/string.c b/glib/tests/string.c index 1143414..9a5944c 100644 --- a/glib/tests/string.c +++ b/glib/tests/string.c @@ -19,6 +19,9 @@ * if advised of the possibility of such damage. */ +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include #include #include "glib.h" diff --git a/glib/tests/thread.c b/glib/tests/thread.c index ea49129..fe2aca0 100644 --- a/glib/tests/thread.c +++ b/glib/tests/thread.c @@ -146,8 +146,6 @@ main (int argc, char *argv[]) { g_test_init (&argc, &argv, NULL); - g_assert (g_thread_get_initialized ()); - g_test_add_func ("/thread/thread1", test_thread1); g_test_add_func ("/thread/thread2", test_thread2); g_test_add_func ("/thread/thread3", test_thread3); diff --git a/glib/tests/tree.c b/glib/tests/tree.c index b2db158..fa74186 100644 --- a/glib/tests/tree.c +++ b/glib/tests/tree.c @@ -27,6 +27,9 @@ #undef G_DISABLE_ASSERT #undef G_LOG_DOMAIN +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include #include #include "glib.h" diff --git a/glib/tests/unicode.c b/glib/tests/unicode.c index 00dd0f5..1032601 100644 --- a/glib/tests/unicode.c +++ b/glib/tests/unicode.c @@ -22,6 +22,9 @@ * Author: Matthias Clasen, Behdad Esfahbod */ +/* We are testing some deprecated APIs here */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include "glib.h" static void -- 2.7.4