Two "make check" fixes for late changes to the thread-context patch

g_simple_async_result_complete() now checks that it's being run from
the correct main loop, so tests/gio/simple-async-result was failing,
because it called it from outside any main loop. (And gio's pltcheck
was failing because I hadn't added g_main_current_source() to it.)
This commit is contained in:
Dan Winship 2009-07-01 13:52:49 -04:00
parent 2262d76b33
commit 29e6525b1e
2 changed files with 31 additions and 8 deletions

View File

@ -9,7 +9,7 @@ if ! which readelf 2>/dev/null >/dev/null; then
exit 0 exit 0
fi fi
SKIP='\<g_access\|\<g_array_\|\<g_ascii\|\<g_list_\|\<g_assertion_message\|\<g_warn_message\|\<g_atomic\|\<g_bit_\|\<g_boxed\|\<g_build_filename\|\<g_byte_array\|\<g_checksum\|\<g_child_watch\|\<g_clear_error\|\<g_convert\|\<g_dir_\|\<g_enum_\|\<g_error_\|\<g_prefix_error\|\<g_file_error_quark\|\<g_file_get_contents\|\<g_file_set_contents\|\<g_file_test\|\<g_file_read_link\|\<g_filename_\|\<g_find_program_in_path\|\<g_flags_\|\<g_free\|\<g_get_\|\<g_getenv\|\<g_setenv\|\<g_hash_table_\|\<g_hostname_\|\<g_idle_\|\<g_intern_static_string\|\<g_io_add_watch\|\<g_io_channel_\|\<g_io_create_watch\|\<g_key_file_\|\<g_listenv\|\<g_locale_to_utf8\|\<g_log\|\<g_main_context_\|\<g_main_loop_\|\<g_malloc\|\<g_markup_\|\<g_mkdir_\|\<g_mkstemp\|\<g_module_\|\<g_object_\|\<g_once_\|\<g_param_spec_\|\<g_path_\|\<g_poll\|\<g_printerr\|\<g_propagate_error\|\<g_ptr_array_\|\<g_qsort_\|\<g_quark_\|\<g_queue_\|\<g_random_int_range\|\<g_realloc\|\<g_return_if_fail\|\<g_set_error\|\<g_shell_\|\<g_signal_\|\<g_slice_\|\<g_slist_\|\<g_snprintf\|\<g_source_\|\<g_spawn_\|\<g_static_\|\<g_str\|\<g_thread_pool_\|\<g_time_val_add\|\<g_timeout_\|\<g_type_\|\<g_unlink\|\<g_uri_\|\<g_utf8_\|\<g_value_' SKIP='\<g_access\|\<g_array_\|\<g_ascii\|\<g_list_\|\<g_assertion_message\|\<g_warn_message\|\<g_atomic\|\<g_bit_\|\<g_boxed\|\<g_build_filename\|\<g_byte_array\|\<g_checksum\|\<g_child_watch\|\<g_clear_error\|\<g_convert\|\<g_dir_\|\<g_enum_\|\<g_error_\|\<g_prefix_error\|\<g_file_error_quark\|\<g_file_get_contents\|\<g_file_set_contents\|\<g_file_test\|\<g_file_read_link\|\<g_filename_\|\<g_find_program_in_path\|\<g_flags_\|\<g_free\|\<g_get_\|\<g_getenv\|\<g_setenv\|\<g_hash_table_\|\<g_hostname_\|\<g_idle_\|\<g_intern_static_string\|\<g_io_add_watch\|\<g_io_channel_\|\<g_io_create_watch\|\<g_key_file_\|\<g_listenv\|\<g_locale_to_utf8\|\<g_log\|\<g_main_context_\|\<g_main_current_source\|\<g_main_loop_\|\<g_malloc\|\<g_markup_\|\<g_mkdir_\|\<g_mkstemp\|\<g_module_\|\<g_object_\|\<g_once_\|\<g_param_spec_\|\<g_path_\|\<g_poll\|\<g_printerr\|\<g_propagate_error\|\<g_ptr_array_\|\<g_qsort_\|\<g_quark_\|\<g_queue_\|\<g_random_int_range\|\<g_realloc\|\<g_return_if_fail\|\<g_set_error\|\<g_shell_\|\<g_signal_\|\<g_slice_\|\<g_slist_\|\<g_snprintf\|\<g_source_\|\<g_spawn_\|\<g_static_\|\<g_str\|\<g_thread_pool_\|\<g_time_val_add\|\<g_timeout_\|\<g_type_\|\<g_unlink\|\<g_uri_\|\<g_utf8_\|\<g_value_'
for so in .libs/lib*.so; do for so in .libs/lib*.so; do
echo Checking $so for local PLT entries echo Checking $so for local PLT entries

View File

@ -56,31 +56,55 @@ callback_func (GObject *source,
got_user_data = user_data; got_user_data = user_data;
} }
static void static gboolean
test_simple_async (void) test_simple_async_idle (gpointer user_data)
{ {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
GObject *a, *b, *c; GObject *a, *b, *c;
gboolean *ran = user_data;
a = g_object_new (G_TYPE_OBJECT, NULL); a = g_object_new (G_TYPE_OBJECT, NULL);
b = g_object_new (G_TYPE_OBJECT, NULL); b = g_object_new (G_TYPE_OBJECT, NULL);
c = g_object_new (G_TYPE_OBJECT, NULL); c = g_object_new (G_TYPE_OBJECT, NULL);
result = g_simple_async_result_new (a, callback_func, b, test_simple_async); result = g_simple_async_result_new (a, callback_func, b, test_simple_async_idle);
check (NULL, NULL, NULL); check (NULL, NULL, NULL);
g_simple_async_result_complete (result); g_simple_async_result_complete (result);
check (a, result, b); check (a, result, b);
g_object_unref (result); g_object_unref (result);
g_assert (g_simple_async_result_is_valid (got_result, a, test_simple_async)); g_assert (g_simple_async_result_is_valid (got_result, a, test_simple_async_idle));
g_assert (!g_simple_async_result_is_valid (got_result, b, test_simple_async)); g_assert (!g_simple_async_result_is_valid (got_result, b, test_simple_async_idle));
g_assert (!g_simple_async_result_is_valid (got_result, c, test_simple_async)); g_assert (!g_simple_async_result_is_valid (got_result, c, test_simple_async_idle));
g_assert (!g_simple_async_result_is_valid (got_result, b, callback_func)); g_assert (!g_simple_async_result_is_valid (got_result, b, callback_func));
g_assert (!g_simple_async_result_is_valid ((gpointer) a, NULL, NULL)); g_assert (!g_simple_async_result_is_valid ((gpointer) a, NULL, NULL));
reset (); reset ();
reset (); reset ();
reset (); reset ();
ensure_destroyed (a);
ensure_destroyed (b);
ensure_destroyed (c);
*ran = TRUE;
return FALSE;
}
static void
test_simple_async (void)
{
GSimpleAsyncResult *result;
GObject *a, *b;
gboolean ran_test_in_idle = FALSE;
g_idle_add (test_simple_async_idle, &ran_test_in_idle);
g_main_context_iteration (NULL, FALSE);
g_assert (ran_test_in_idle);
a = g_object_new (G_TYPE_OBJECT, NULL);
b = g_object_new (G_TYPE_OBJECT, NULL);
result = g_simple_async_result_new (a, callback_func, b, test_simple_async); result = g_simple_async_result_new (a, callback_func, b, test_simple_async);
check (NULL, NULL, NULL); check (NULL, NULL, NULL);
g_simple_async_result_complete_in_idle (result); g_simple_async_result_complete_in_idle (result);
@ -92,7 +116,6 @@ test_simple_async (void)
ensure_destroyed (a); ensure_destroyed (a);
ensure_destroyed (b); ensure_destroyed (b);
ensure_destroyed (c);
} }
int int