Merge branch 'install-tests' into 'master'

Meson: Fix missing files when installing tests

Closes #1527

See merge request GNOME/glib!336
This commit is contained in:
Xavier Claessens 2018-09-21 13:18:32 +00:00
commit 66bf585776
14 changed files with 333 additions and 84 deletions

View File

@ -14,11 +14,12 @@ gdbus_example_objectmanager_generated = custom_target('gdbus-example-objectmanag
'--generate-docbook', 'gdbus-example-objectmanager-generated', '--generate-docbook', 'gdbus-example-objectmanager-generated',
'@INPUT@']) '@INPUT@'])
libgdbus_example_objectmanager = library('libgdbus-example-objectmanager', libgdbus_example_objectmanager = library('gdbus-example-objectmanager',
gdbus_example_objectmanager_generated, gdbus_example_objectmanager_generated,
c_args : gio_c_args, c_args : gio_c_args,
dependencies : [libglib_dep, libgmodule_dep, libgobject_dep, libgio_dep], dependencies : [libglib_dep, libgmodule_dep, libgobject_dep, libgio_dep],
install : false) install : installed_tests_enabled,
install_dir : installed_tests_execdir)
libgdbus_example_objectmanager_dep = declare_dependency(sources : gdbus_example_objectmanager_generated, libgdbus_example_objectmanager_dep = declare_dependency(sources : gdbus_example_objectmanager_generated,
link_with : libgdbus_example_objectmanager) link_with : libgdbus_example_objectmanager)

View File

@ -80,6 +80,7 @@ gio_tests = [{
test_extra_programs = [{ test_extra_programs = [{
'gdbus-connection-flush-helper' : {}, 'gdbus-connection-flush-helper' : {},
'gdbus-testserver' : {}, 'gdbus-testserver' : {},
'gsubprocess-testprog' : {},
}] }]
test_env = environment() test_env = environment()
@ -254,9 +255,10 @@ if host_machine.system() != 'windows'
# This test is currently unreliable # This test is currently unreliable
executable('gdbus-overflow', 'gdbus-overflow.c', executable('gdbus-overflow', 'gdbus-overflow.c',
install : false,
c_args : test_c_args, c_args : test_c_args,
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps,
install_dir : installed_tests_execdir,
install : installed_tests_enabled)
gio_tests += [{ gio_tests += [{
'gdbus-connection-flush' : { 'gdbus-connection-flush' : {
@ -318,7 +320,6 @@ test_extra_programs += [{
'gdbus-example-subtree' : {'install' : false}, 'gdbus-example-subtree' : {'install' : false},
'gdbus-example-watch-name' : {'install' : false}, 'gdbus-example-watch-name' : {'install' : false},
'gdbus-example-watch-proxy' : {'install' : false}, 'gdbus-example-watch-proxy' : {'install' : false},
'gsubprocess-testprog' : {'install' : false},
'httpd' : {'install' : false}, 'httpd' : {'install' : false},
'proxy' : {'install' : false}, 'proxy' : {'install' : false},
'resolver' : {'install' : false}, 'resolver' : {'install' : false},
@ -357,6 +358,25 @@ if host_machine.system() != 'windows'
}] }]
endif endif
if installed_tests_enabled
install_data(
'contexts.c',
'g-icon.c',
'appinfo-test-actions.desktop',
'appinfo-test-gnome.desktop',
'appinfo-test-notgnome.desktop',
'appinfo-test.desktop',
'appinfo-test2.desktop',
'file.c',
'org.gtk.test.dbusappinfo.desktop',
install_dir : installed_tests_execdir,
)
install_subdir('x-content', install_dir : installed_tests_execdir)
install_subdir('desktop-files', install_dir : installed_tests_execdir)
install_subdir('thumbnails', install_dir : installed_tests_execdir)
install_subdir('cert-tests', install_dir : installed_tests_execdir)
endif
if not meson.is_cross_build() or meson.has_exe_wrapper() if not meson.is_cross_build() or meson.has_exe_wrapper()
plugin_resources_c = custom_target('plugin-resources.c', plugin_resources_c = custom_target('plugin-resources.c',
@ -369,9 +389,12 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
'--c-name', '_g_plugin', '--c-name', '_g_plugin',
'@INPUT@']) '@INPUT@'])
shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c, shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
link_args : export_dynamic_ldflags, link_args : export_dynamic_ldflags,
dependencies : common_gio_tests_deps) dependencies : common_gio_tests_deps,
install_dir : installed_tests_execdir,
install : installed_tests_enabled
)
test_gresource = custom_target('test.gresource', test_gresource = custom_target('test.gresource',
input : 'test.gresource.xml', input : 'test.gresource.xml',
@ -380,7 +403,9 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
'--target=@OUTPUT@', '--target=@OUTPUT@',
'--sourcedir=' + meson.current_source_dir(), '--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(), '--sourcedir=' + meson.current_build_dir(),
'@INPUT@']) '@INPUT@'],
install_dir : installed_tests_execdir,
install : installed_tests_enabled)
test_resources2_c = custom_target('test_resources2.c', test_resources2_c = custom_target('test_resources2.c',
input : 'test3.gresource.xml', input : 'test3.gresource.xml',

View File

@ -1,11 +1,13 @@
libtestmodulea = library('testmodulea', 'test-module-a.c', libtestmodulea = shared_module('testmodulea', 'test-module-a.c',
install : false,
dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep], dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep],
c_args : [ ] c_args : [ ],
install : installed_tests_enabled,
install_dir : join_paths(installed_tests_execdir, 'modules'),
) )
libtestmoduleb = library('testmoduleb', 'test-module-b.c', libtestmoduleb = shared_module('testmoduleb', 'test-module-b.c',
install : false,
dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep], dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep],
c_args : [ ] c_args : [ ],
install : installed_tests_enabled,
install_dir : join_paths(installed_tests_execdir, 'modules'),
) )

View File

@ -129,6 +129,21 @@ glib_tests = {
}, },
} }
if installed_tests_enabled
install_data(
'keyfiletest.ini',
'pages.ini',
'keyfile.c',
'empty',
'4096-random-bytes',
'echo-script',
'echo-script.bat',
install_dir : installed_tests_execdir,
)
install_subdir('bookmarks', install_dir : installed_tests_execdir)
install_subdir('markups', install_dir : installed_tests_execdir)
endif
# Not entirely random of course, but at least it changes over time # Not entirely random of course, but at least it changes over time
random_number = minor_version + meson.version().split('.').get(1).to_int() random_number = minor_version + meson.version().split('.').get(1).to_int()

View File

@ -30,3 +30,5 @@ pkg.generate(libraries : [libgthread, thread_dep],
name : 'GThread', name : 'GThread',
description : 'Thread support for GLib', description : 'Thread support for GLib',
) )
libgthread_dep = declare_dependency(link_with : libgthread)

View File

@ -123,7 +123,7 @@ dist-hook: $(BUILT_EXTRA_DIST)
if HAVE_CXX if HAVE_CXX
installed_test_programs += cxx-test installed_test_programs += cxx-test
cxx_test_SOURCES = cxx-test.C cxx_test_SOURCES = cxx-test.cpp
endif endif
if ENABLE_TIMELOOP if ENABLE_TIMELOOP

View File

@ -214,11 +214,11 @@ recv_windows_message (GIOChannel *channel,
{ {
GIOError error; GIOError error;
MSG msg; MSG msg;
guint nb; gsize nb;
while (1) while (1)
{ {
error = g_io_channel_read (channel, &msg, sizeof (MSG), &nb); error = g_io_channel_read (channel, (gchar *) &msg, sizeof (MSG), &nb);
if (error != G_IO_ERROR_NONE) if (error != G_IO_ERROR_NONE)
{ {
@ -232,20 +232,25 @@ recv_windows_message (GIOChannel *channel,
break; break;
} }
g_print ("gio-test: ...Windows message for %#x: %d,%d,%d\n", g_print ("gio-test: ...Windows message for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT "\n",
msg.hwnd, msg.message, msg.wParam, msg.lParam); msg.hwnd, msg.message, msg.wParam, (gintptr)msg.lParam);
return TRUE; return TRUE;
} }
LRESULT CALLBACK window_procedure (HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam);
LRESULT CALLBACK LRESULT CALLBACK
window_procedure (HWND hwnd, window_procedure (HWND hwnd,
UINT message, UINT message,
WPARAM wparam, WPARAM wparam,
LPARAM lparam) LPARAM lparam)
{ {
g_print ("gio-test: window_procedure for %#x: %d,%d,%d\n", g_print ("gio-test: window_procedure for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT "\n",
hwnd, message, wparam, lparam); hwnd, message, wparam, (gintptr)lparam);
return DefWindowProc (hwnd, message, wparam, lparam); return DefWindowProc (hwnd, message, wparam, lparam);
} }
@ -331,7 +336,7 @@ main (int argc,
nrunning++; nrunning++;
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
cmdline = g_strdup_printf ("%d:%d:%d", cmdline = g_strdup_printf ("%d:%d:0x%p",
pipe_to_sub[0], pipe_to_sub[0],
pipe_from_sub[1], pipe_from_sub[1],
hwnd); hwnd);
@ -388,7 +393,7 @@ main (int argc,
sscanf (argv[2], "%d:%d%n", &readfd, &writefd, &n); sscanf (argv[2], "%d:%d%n", &readfd, &writefd, &n);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
sscanf (argv[2] + n, ":%d", &hwnd); sscanf (argv[2] + n, ":0x%p", &hwnd);
#endif #endif
srand (tv.tv_sec ^ (tv.tv_usec / 1000) ^ readfd ^ (writefd << 4)); srand (tv.tv_sec ^ (tv.tv_usec / 1000) ^ readfd ^ (writefd << 4));
@ -413,8 +418,8 @@ main (int argc,
int msg = WM_USER + (rand() % 100); int msg = WM_USER + (rand() % 100);
WPARAM wparam = rand (); WPARAM wparam = rand ();
LPARAM lparam = rand (); LPARAM lparam = rand ();
g_print ("gio-test: child posting message %d,%d,%d to %#x\n", g_print ("gio-test: child posting message %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT " to 0x%p\n",
msg, wparam, lparam, hwnd); msg, wparam, (gintptr)lparam, hwnd);
PostMessage (hwnd, msg, wparam, lparam); PostMessage (hwnd, msg, wparam, lparam);
} }
#endif #endif

View File

@ -1,16 +1,3 @@
gobject_tests = [
['gvalue-test'],
['paramspec-test'],
['deftype'],
['defaultiface', ['defaultiface.c', 'testmodule.c']],
['dynamictype', ['dynamictype.c', 'testmodule.c']],
['override'],
['signals'],
['singleton'],
['references'],
['testgobject'],
]
# We cannot use gnome.genmarshal() here # We cannot use gnome.genmarshal() here
testmarshal_h = custom_target('testmarshal_h', testmarshal_h = custom_target('testmarshal_h',
output : 'testmarshal.h', output : 'testmarshal.h',
@ -39,41 +26,74 @@ testmarshal_c = custom_target('testmarshal_c',
], ],
) )
gobject_tests += [ gobject_tests = {
['accumulator', ['accumulator.c', testmarshal_c, testmarshal_h]], 'gvalue-test' : {},
] 'paramspec-test' : {},
'deftype' : {},
'defaultiface' : {
'extra_sources' : ['testmodule.c'],
},
'dynamictype' : {
'extra_sources' : ['testmodule.c'],
},
'override' : {},
'signals' : {},
'singleton' : {},
'references' : {},
'testgobject' : {},
'accumulator' : {
'extra_sources' : [testmarshal_c, testmarshal_h],
},
}
foreach t : gobject_tests common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
test_name = t.get(0) common_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
test_src = t.get(1, test_name + '.c')
test_extra_cargs = t.get(2, []) foreach test_name, extra_args : gobject_tests
test_timeout = t.get(3, 30) source = extra_args.get('source', test_name + '.c')
test_suite = test_timeout == 30 ? ['gobject'] : ['gobject', 'slow'] extra_sources = extra_args.get('extra_sources', [])
install = installed_tests_enabled and extra_args.get('install', true)
if install
test_conf = configuration_data()
test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name)
configure_file(
input: installed_tests_template,
output: test_name + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf
)
endif
# FIXME? $(GLIB_DEBUG_FLAGS) # FIXME? $(GLIB_DEBUG_FLAGS)
exe = executable(test_name + '-gobject', test_src, exe = executable(test_name, [source, extra_sources],
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'], c_args : common_c_args + extra_args.get('c_args', []),
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep], dependencies : common_deps + extra_args.get('dependencies', []),
install : false, install_dir: installed_tests_execdir,
install: install,
) )
suite = ['gobject'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? 120 : 30
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
test(test_name, exe, env : test_env, timeout : test_timeout, suite : test_suite) test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
endforeach endforeach
# Don't install these ones, and keep them out of 'make check' because they take too long... # Don't install these ones, and keep them out of 'make check' because they take too long...
executable('performance', 'performance.c', executable('performance', 'performance.c',
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'], c_args : common_c_args,
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep], dependencies : common_deps,
install : false) install : false)
executable('performance-threaded', 'performance-threaded.c', executable('performance-threaded', 'performance-threaded.c',
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'], c_args : common_c_args,
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep], dependencies : common_deps,
install : false) install : false)
if host_system != 'windows' and host_system != 'minix' if host_system != 'windows' and host_system != 'minix'
executable('timeloop-closure', 'timeloop-closure.c', executable('timeloop-closure', 'timeloop-closure.c',
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'], c_args : common_c_args,
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep], dependencies : common_deps,
install : false) install : false)
endif endif

View File

@ -25,6 +25,9 @@
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef G_OS_WIN32
#include <process.h>
#endif
static gchar *dir, *filename, *displayname, *childname; static gchar *dir, *filename, *displayname, *childname;
@ -188,7 +191,9 @@ test_child_private (gchar *argv0)
gsize len; gsize len;
gchar *child_argv[4]; gchar *child_argv[4];
GPid child_pid; GPid child_pid;
#ifndef G_OS_WIN32
GMainLoop *loop; GMainLoop *loop;
#endif
gchar pid[100]; gchar pid[100];
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32

View File

@ -1,12 +1,144 @@
# tests # tests
# Not entirely random of course, but at least it changes over time
random_number = minor_version + meson.version().split('.').get(1).to_int()
test_env = environment() test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_DEBUG', 'gc-friendly') test_env.set('G_DEBUG', 'gc-friendly')
test_env.set('MALLOC_CHECK_', '2') test_env.set('MALLOC_CHECK_', '2')
test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
test_cargs = ['-DG_LOG_DOMAIN="GLib"'] test_cargs = ['-DG_LOG_DOMAIN="GLib"']
subdir('gobject') subdir('gobject')
subdir('refcount') subdir('refcount')
# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
# that supports '+=' operator on dictionnaries.
tests = [{
'testglib' : {},
'testgdate' : {},
'datetime' : {},
'atomic-test' : {},
'bit-test' : {},
'child-test' : {},
'completion-test' : {},
'dirname-test' : {},
'file-test' : {},
'env-test' : {},
'gio-test' : {},
'mainloop-test' : {},
'mapping-test' : {},
'onceinit' : {},
'asyncqueue-test' : {},
'qsort-test' : {},
'relation-test' : {},
'slice-concurrent' : {},
'slice-threadinit' : {
'dependencies' : [libgthread_dep],
},
'sources' : {},
'thread-test' : {},
'threadpool-test' : {'suite' : ['slow']},
'type-test' : {},
'unicode-caseconv' : {},
'unicode-encoding' : {},
'module-test' : {
'dependencies' : [libgmodule_dep],
'export_dynamic' : true,
},
'cxx-test' : {
'source' : 'cxx-test.cpp',
'include_directories' : gmoduleinc,
'dependencies' : [libgio_dep],
},
}]
test_extra_programs = {
'slice-test' : {
'extra_sources' : ['memchunks.c'],
},
'slice-color' : {
'extra_sources' : ['memchunks.c'],
},
'assert-msg-test' : {},
'unicode-collate' : {},
}
if host_machine.system() != 'windows'
tests += [{
'timeloop' : {},
'spawn-test' : {},
'iochannel-test' : {},
}]
endif
if installed_tests_enabled
install_data(
'iochannel-test-infile',
'casemap.txt',
'casefold.txt',
'utf8.txt',
install_dir : installed_tests_execdir,
)
endif
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
shared_module(module, 'lib@0@.c'.format(module),
dependencies : [libglib_dep, libgmodule_dep],
install_dir : installed_tests_execdir,
install : installed_tests_enabled
)
endforeach
common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
common_deps = [libm, thread_dep, libglib_dep]
foreach test_dict : tests
foreach test_name, extra_args : test_dict
source = extra_args.get('source', test_name + '.c')
extra_sources = extra_args.get('extra_sources', [])
install = installed_tests_enabled and extra_args.get('install', true)
if install
test_conf = configuration_data()
test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name)
configure_file(
input: installed_tests_template,
output: test_name + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf
)
endif
# FIXME? $(GLIB_DEBUG_FLAGS)
exe = executable(test_name, [source, extra_sources],
c_args : common_c_args + extra_args.get('c_args', []),
dependencies : common_deps + extra_args.get('dependencies', []),
export_dynamic : extra_args.get('export_dynamic', false),
include_directories : extra_args.get('include_directories', []),
install_dir: installed_tests_execdir,
install: install,
)
suite = ['glib'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? 120 : 30
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
endforeach
endforeach
foreach program_name, extra_args : test_extra_programs
source = extra_args.get('source', program_name + '.c')
extra_sources = extra_args.get('extra_sources', [])
install = installed_tests_enabled and extra_args.get('install', true)
executable(program_name, [source, extra_sources],
c_args : common_c_args,
dependencies : common_deps + extra_args.get('dependencies', []),
install_dir : installed_tests_execdir,
install : install,
)
endforeach

View File

@ -1,30 +1,59 @@
refcount_tests = [ refcount_tests = {
['closures', 'closures.c', [], 90], 'closures' : {'suite' : ['slow']},
['objects', 'objects.c', []], 'objects' : {},
['objects2', 'objects2.c', [], 90], 'objects2' : {'suite' : ['slow']},
['properties', 'properties.c', []], 'properties' : {},
['properties2', 'properties2.c', [], 90], 'properties2' : {'suite' : ['slow']},
['properties3', 'properties3.c', [], 90], # extra long timeout 'properties3' : {'suite' : ['slow']},
['properties4', 'properties4.c', []], 'properties4' : {},
['signal1', 'signals.c', ['-DTESTNUM=1']], 'signal1' : {
['signal2', 'signals.c', ['-DTESTNUM=2']], 'source' : 'signals.c',
['signal3', 'signals.c', ['-DTESTNUM=3']], 'c_args' : ['-DTESTNUM=1'],
['signal4', 'signals.c', ['-DTESTNUM=4']], },
] 'signal2' : {
'source' : 'signals.c',
'c_args' : ['-DTESTNUM=2'],
},
'signal3' : {
'source' : 'signals.c',
'c_args' : ['-DTESTNUM=3'],
},
'signal4' : {
'source' : 'signals.c',
'c_args' : ['-DTESTNUM=4'],
},
}
foreach t : refcount_tests common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
test_name = t.get(0) common_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
test_src = t.get(1)
test_extra_cargs = t.get(2) foreach test_name, extra_args : refcount_tests
test_timeout = t.get(3, 30) source = extra_args.get('source', test_name + '.c')
test_suite = test_timeout == 30 ? ['refcount'] : ['refcount', 'slow'] extra_sources = extra_args.get('extra_sources', [])
install = installed_tests_enabled and extra_args.get('install', true)
if install
test_conf = configuration_data()
test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name)
configure_file(
input: installed_tests_template,
output: test_name + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf
)
endif
# FIXME? $(GLIB_DEBUG_FLAGS) # FIXME? $(GLIB_DEBUG_FLAGS)
exe = executable(test_name + '-test', test_src, exe = executable(test_name, [source, extra_sources],
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'], c_args : common_c_args + extra_args.get('c_args', []),
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep], dependencies : common_deps + extra_args.get('dependencies', []),
install : false, install_dir: installed_tests_execdir,
install: install,
) )
suite = ['refcount'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? 120 : 30
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
test(test_name, exe, env : test_env, timeout : test_timeout, suite : test_suite) test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
endforeach endforeach

View File

@ -120,8 +120,13 @@ main (int argc,
gu64t1 = G_GINT64_CONSTANT (0xFAFAFAFAFAFAFAFA); gu64t1 = G_GINT64_CONSTANT (0xFAFAFAFAFAFAFAFA);
#define FORMAT64 "%" G_GINT64_FORMAT " %" G_GUINT64_FORMAT "\n" #define FORMAT64 "%" G_GINT64_FORMAT " %" G_GUINT64_FORMAT "\n"
#ifndef G_OS_WIN32
# define SCAN_FORMAT64 FORMAT64
#else
# define SCAN_FORMAT64 "%I64d %I64u\n"
#endif
string = g_strdup_printf (FORMAT64, gi64t1, gu64t1); string = g_strdup_printf (FORMAT64, gi64t1, gu64t1);
sscanf (string, FORMAT64, &gi64t2, &gu64t2); sscanf (string, SCAN_FORMAT64, &gi64t2, &gu64t2);
g_free (string); g_free (string);
g_assert (gi64t1 == gi64t2); g_assert (gi64t1 == gi64t2);
g_assert (gu64t1 == gu64t2); g_assert (gu64t1 == gu64t2);
@ -130,8 +135,13 @@ main (int argc,
gst1 = 0xFAFAFAFA; gst1 = 0xFAFAFAFA;
#define FORMATSIZE "%" G_GSSIZE_FORMAT " %" G_GSIZE_FORMAT "\n" #define FORMATSIZE "%" G_GSSIZE_FORMAT " %" G_GSIZE_FORMAT "\n"
#ifndef G_OS_WIN32
# define SCAN_FORMATSIZE FORMATSIZE
#else
# define SCAN_FORMATSIZE "%Id %Iu\n"
#endif
string = g_strdup_printf (FORMATSIZE, gsst1, gst1); string = g_strdup_printf (FORMATSIZE, gsst1, gst1);
sscanf (string, FORMATSIZE, &gsst2, &gst2); sscanf (string, SCAN_FORMATSIZE, &gsst2, &gst2);
g_free (string); g_free (string);
g_assert (gsst1 == gsst2); g_assert (gsst1 == gsst2);
g_assert (gst1 == gst2); g_assert (gst1 == gst2);

View File

@ -9,6 +9,8 @@
static gint exit_status = 0; static gint exit_status = 0;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void static void
croak (char *format, ...) croak (char *format, ...)
{ {
@ -32,6 +34,7 @@ fail (char *format, ...)
exit_status |= 1; exit_status |= 1;
} }
#pragma GCC diagnostic pop
typedef enum typedef enum
{ {