mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-25 08:36:52 +02:00
parent
a83ccbd251
commit
ddb0585e65
@ -105,6 +105,7 @@ glib_tests = {
|
|||||||
'extra_sources' : ['memchunks.c'],
|
'extra_sources' : ['memchunks.c'],
|
||||||
},
|
},
|
||||||
'slice-concurrent' : {},
|
'slice-concurrent' : {},
|
||||||
|
'slice-known-pages' : {},
|
||||||
'slist' : {},
|
'slist' : {},
|
||||||
'sort' : {},
|
'sort' : {},
|
||||||
'spawn-multithreaded' : {},
|
'spawn-multithreaded' : {},
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* slice-threadinit.c - test GSlice across g_thread_init
|
/* slice-known-pages.c - test GSlice across known pages
|
||||||
* Copyright (C) 2007 Tim Janik
|
* Copyright (C) 2007 Tim Janik
|
||||||
*
|
*
|
||||||
* This work is provided "as is"; redistribution and modification
|
* This work is provided "as is"; redistribution and modification
|
||||||
@ -19,17 +19,15 @@
|
|||||||
* if advised of the possibility of such damage.
|
* if advised of the possibility of such damage.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* We are testing threadinit which is deprecated */
|
|
||||||
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
#define GLIB_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#define N_PAGES (101) /* number of pages to sample */
|
#define N_PAGES (101) /* number of pages to sample */
|
||||||
#define SAMPLE_SIZE (7)
|
#define SAMPLE_SIZE (7)
|
||||||
#define PAGE_SIZE (128) /* must be <= minimum GSlice alignment block */
|
#define PAGE_SIZE (128) /* must be <= minimum GSlice alignment block */
|
||||||
#define MAGAZINE_PROBES { 97, 265, 347 } /* block sizes hopefully unused by g_thread_init */
|
#define MAGAZINE_PROBES \
|
||||||
|
{ \
|
||||||
|
97, 265, 347 \
|
||||||
|
} /* block sizes hopefully unused */
|
||||||
#define MAX_PROBE_TRIALS (1031) /* must be >= maximum magazine size */
|
#define MAX_PROBE_TRIALS (1031) /* must be >= maximum magazine size */
|
||||||
|
|
||||||
#define ALIGN(size, base) \
|
#define ALIGN(size, base) \
|
||||||
@ -75,7 +73,7 @@ allocate_from_known_page (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_slice_thread_init (void)
|
test_slice_known_pages (void)
|
||||||
{
|
{
|
||||||
gsize j, n_pages = 0;
|
gsize j, n_pages = 0;
|
||||||
void *mps[N_MAGAZINE_PROBES];
|
void *mps[N_MAGAZINE_PROBES];
|
||||||
@ -133,14 +131,11 @@ test_slice_thread_init (void)
|
|||||||
}
|
}
|
||||||
/* mps[*] now contains pointers to reallocated slices */
|
/* mps[*] now contains pointers to reallocated slices */
|
||||||
|
|
||||||
/* release magazine probes to be retained across g_thread_init */
|
/* release magazine probes to be retained across known pages */
|
||||||
for (j = 0; j < N_MAGAZINE_PROBES; j++)
|
for (j = 0; j < N_MAGAZINE_PROBES; j++)
|
||||||
g_slice_free1 (magazine_probes[j], mps[j]);
|
g_slice_free1 (magazine_probes[j], mps[j]);
|
||||||
/* mps[*] now contains pointers to released slices */
|
/* mps[*] now contains pointers to released slices */
|
||||||
|
|
||||||
/* initialize threading (should retain allocator state) */
|
|
||||||
g_thread_init (NULL);
|
|
||||||
|
|
||||||
/* ensure probes were retained */
|
/* ensure probes were retained */
|
||||||
for (j = 0; j < N_MAGAZINE_PROBES; j++)
|
for (j = 0; j < N_MAGAZINE_PROBES; j++)
|
||||||
{
|
{
|
||||||
@ -172,7 +167,7 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/slice/thread-init", test_slice_thread_init);
|
g_test_add_func ("/slice/known_pages", test_slice_known_pages);
|
||||||
|
|
||||||
return g_test_run ();
|
return g_test_run ();
|
||||||
}
|
}
|
@ -16,9 +16,6 @@ subdir('gobject')
|
|||||||
subdir('refcount')
|
subdir('refcount')
|
||||||
|
|
||||||
tests = {
|
tests = {
|
||||||
'slice-threadinit' : {
|
|
||||||
'dependencies' : [libgthread_dep],
|
|
||||||
},
|
|
||||||
'module-test-library' : {
|
'module-test-library' : {
|
||||||
'dependencies' : [libgmodule_dep],
|
'dependencies' : [libgmodule_dep],
|
||||||
'export_dynamic' : true,
|
'export_dynamic' : true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user