Merge branch '1543-glib-2-58-backports' into 'glib-2-58'

Resolve "Backport recent Meson/pkg-config/test fixes to glib-2-58"

See merge request GNOME/glib!392
This commit is contained in:
Xavier Claessens 2018-10-19 13:37:17 +00:00
commit 8c6ec7615c
61 changed files with 956 additions and 299 deletions

View File

@ -145,8 +145,7 @@ prebuilt binaries are included in the "dev" packages.
Please note that the ./configure mechanism should not blindly be used Please note that the ./configure mechanism should not blindly be used
to build a GLib to be distributed to other developers because it to build a GLib to be distributed to other developers because it
produces a compiler-dependent glibconfig.h. For instance, the typedef produces a compiler-dependent glibconfig.h.
for gint64 is long long with gcc, but __int64 with MSVC.
Except for this and a few other minor issues, there shouldn't be any Except for this and a few other minor issues, there shouldn't be any
reason to distribute separate GLib headers and DLLs for gcc and MSVC6 reason to distribute separate GLib headers and DLLs for gcc and MSVC6

View File

@ -477,7 +477,6 @@ AS_IF([test "$glib_native_win32" = "yes"], [
AM_CONDITIONAL(OS_WIN32_AND_DLL_COMPILATION, [test x$glib_native_win32 = xyes -a x$glib_win32_static_compilation != xyes]) AM_CONDITIONAL(OS_WIN32_AND_DLL_COMPILATION, [test x$glib_native_win32 = xyes -a x$glib_win32_static_compilation != xyes])
# Checks for library functions. # Checks for library functions.
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 issetugid) AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 issetugid)
AC_CHECK_FUNCS(timegm gmtime_r posix_spawn) AC_CHECK_FUNCS(timegm gmtime_r posix_spawn)
AC_FUNC_STRERROR_R() AC_FUNC_STRERROR_R()
@ -534,8 +533,6 @@ AS_IF([test x$ac_cv_sizeof_long_long = x8], [
], [AC_MSG_RESULT(none)]) ], [AC_MSG_RESULT(none)])
]) ])
AC_C_CONST
dnl dnl
dnl check in which direction the stack grows dnl check in which direction the stack grows
dnl dnl
@ -641,6 +638,8 @@ AC_CHECK_HEADERS([sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h sys/filio.h
AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h]) AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h])
AC_CHECK_HEADERS([linux/magic.h]) AC_CHECK_HEADERS([linux/magic.h])
AC_CHECK_HEADERS([termios.h]) AC_CHECK_HEADERS([termios.h])
AC_CHECK_HEADERS([alloca.h])
AC_CHECK_HEADERS([spawn.h])
# Some versions of MSC lack these # Some versions of MSC lack these
AC_CHECK_HEADERS([dirent.h sys/time.h]) AC_CHECK_HEADERS([dirent.h sys/time.h])
@ -1788,9 +1787,13 @@ fi
]) ])
if test x$have_libmount = xyes; then if test x$have_libmount = xyes; then
LIBMOUNT_REQUIRES="mount >= 2.23"
AC_DEFINE(HAVE_LIBMOUNT, 1, [Define if libmount is available]) AC_DEFINE(HAVE_LIBMOUNT, 1, [Define if libmount is available])
else
LIBMOUNT_REQUIRES=""
fi fi
AM_CONDITIONAL(HAVE_LIBMOUNT, [test x$have_libmount = xyes]) AM_CONDITIONAL(HAVE_LIBMOUNT, [test x$have_libmount = xyes])
AC_SUBST([LIBMOUNT_REQUIRES])
dnl **************************************** dnl ****************************************
dnl *** platform dependent source checks *** dnl *** platform dependent source checks ***
@ -1855,7 +1858,7 @@ FUNC_NO_LOCALTIME_R="the 'g_date_set_time' function will not be MT-safe
AIX_COMPILE_INFO="AIX's C compiler needs to be called by a different name, when AIX_COMPILE_INFO="AIX's C compiler needs to be called by a different name, when
linking threaded applications. As GLib cannot do that linking threaded applications. As GLib cannot do that
automatically, you will get an linkg error everytime you are automatically, you will get an linking error every time you are
not using the right compiler. In that case you have to relink not using the right compiler. In that case you have to relink
with the right compiler. Ususally just '_r' is appended with the right compiler. Ususally just '_r' is appended
to the compiler name." to the compiler name."
@ -2985,10 +2988,8 @@ _______EOF
# on variable expansion in case labels. Look at the generated config.status # on variable expansion in case labels. Look at the generated config.status
# for a hint. # for a hint.
if test "x${ac_cv_working_alloca_h+set}" = xset ; then if test x$ac_cv_header_alloca_h = xyes ; then
glib_header_alloca_h="$ac_cv_working_alloca_h" glib_header_alloca_h=yes
else
glib_header_alloca_h="$ac_cv_header_alloca_h"
fi fi
if test x$enable_included_printf = xyes ; then if test x$enable_included_printf = xyes ; then
@ -3412,7 +3413,7 @@ AS_IF([test "x$enable_compile_warnings" != xno], [
-Wno-bad-function-cast \ -Wno-bad-function-cast \
-Werror=declaration-after-statement \ -Werror=declaration-after-statement \
-Werror=missing-prototypes -Werror=implicit-function-declaration \ -Werror=missing-prototypes -Werror=implicit-function-declaration \
-Werror=pointer-arith -Werror=init-self -Werror=format-security \ -Werror=pointer-arith -Werror=init-self \
-Werror=format=2 -Werror=missing-include-dirs]) -Werror=format=2 -Werror=missing-include-dirs])
]) ])
AC_SUBST(GLIB_WARN_CFLAGS) AC_SUBST(GLIB_WARN_CFLAGS)

View File

@ -869,7 +869,7 @@ my_app_frobber_proxy_new_sync (GDBusConnection *connection,
subclass. For example, to handle subclass. For example, to handle
<function>HelloWorld()</function> method invocations, set the <function>HelloWorld()</function> method invocations, set the
vfunc for <function>handle_hello_hello_world()</function> in the vfunc for <function>handle_hello_hello_world()</function> in the
<type>MyAppFrobberIface</type> structure. Similary, to handle <type>MyAppFrobberIface</type> structure. Similarly, to handle
the <parameter>net.Corp.MyApp.Frobber:Verbose</parameter> the <parameter>net.Corp.MyApp.Frobber:Verbose</parameter>
property override the <parameter>:verbose</parameter> #GObject property override the <parameter>:verbose</parameter> #GObject
property from the subclass. To emit a signal, use property from the subclass. To emit a signal, use
@ -941,7 +941,7 @@ on_handle_hello_world (MyAppFrobber *interface,
received. The queue is drained in an idle handler (which is called from the received. The queue is drained in an idle handler (which is called from the
<link linkend="g-main-context-push-thread-default">thread-default main loop</link> <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
of the thread where the skeleton object was of the thread where the skeleton object was
contructed) and will cause emissions of the <ulink constructed) and will cause emissions of the <ulink
url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties">org.freedesktop.DBus.Properties::PropertiesChanged</ulink> url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties">org.freedesktop.DBus.Properties::PropertiesChanged</ulink>
signal with all the properties that have changed. Use signal with all the properties that have changed. Use
g_dbus_interface_skeleton_flush() or g_dbus_interface_skeleton_flush() or

View File

@ -374,7 +374,7 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-D</option>, <option>--direct=<replaceable>LOCATION</replaceable></option></term> <term><option>-D</option>, <option>--direct=<replaceable>LOCATION</replaceable></option></term>
<listitem><para>Monitor the file directly. This allows to capture changes made via hardlinks.</para></listitem> <listitem><para>Monitor the file directly. This allows changes made via hardlinks to be captured.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>-s</option>, <option>--silent=<replaceable>LOCATION</replaceable></option></term> <term><option>-s</option>, <option>--silent=<replaceable>LOCATION</replaceable></option></term>
@ -599,7 +599,7 @@
<arg choice="plain" rep="repeat"><replaceable>VALUE</replaceable></arg> <arg choice="plain" rep="repeat"><replaceable>VALUE</replaceable></arg>
</term> </term>
<listitem> <listitem>
<para>Allows to set a file attribute on a file.</para> <para>Sets a file attribute on a file.</para>
<para>File attributes can be specified with their GIO name, e.g <para>File attributes can be specified with their GIO name, e.g
standard::icon. Note that not all GIO file attributes are writable. standard::icon. Note that not all GIO file attributes are writable.
Use the --query-writable option of the info command to list Use the --query-writable option of the info command to list

View File

@ -221,8 +221,8 @@ if get_option('gtk_doc')
], ],
fixxref_args: [ fixxref_args: [
'--html-dir=' + docpath, '--html-dir=' + docpath,
'--extra-dir=' + join_paths(meson.current_build_dir(), '../glib/html'), '--extra-dir=' + join_paths('gio', '..', 'glib', 'html'),
'--extra-dir=' + join_paths(meson.current_build_dir(), '../gobject/html'), '--extra-dir=' + join_paths('gio', '..', 'gobject', 'html'),
], ],
install: true install: true
) )

View File

@ -84,8 +84,8 @@ meson --cross_file cross_file.txt builddir
overridden by setting the overridden by setting the
<literal>have_<replaceable>function</replaceable></literal> property <literal>have_<replaceable>function</replaceable></literal> property
to <constant>true</constant> or <constant>false</constant>. to <constant>true</constant> or <constant>false</constant>.
For example <programlisting>Checking for function "alloca" : YES</programlisting> For example <programlisting>Checking for function "fsync" : YES</programlisting>
can be overridden by setting <programlisting>have_alloca = false</programlisting> can be overridden by setting <programlisting>have_fsync = false</programlisting>
</para> </para>
</formalpara> </formalpara>
<formalpara> <formalpara>

View File

@ -140,7 +140,6 @@ if get_option('gtk_doc')
], ],
fixxref_args: [ fixxref_args: [
'--html-dir=' + docpath, '--html-dir=' + docpath,
# TODO: gobject/gio extra dirs
], ],
install: true) install: true)
endif endif

View File

@ -253,7 +253,7 @@ will be appended to the template's <literal>file-tail</literal> section.
<varlistentry> <varlistentry>
<term><option>--eprod</option> <replaceable>TEXT</replaceable></term> <term><option>--eprod</option> <replaceable>TEXT</replaceable></term>
<listitem><para> <listitem><para>
Emits <replaceable>TEXT</replaceable> everytime an enum is encountered Emits <replaceable>TEXT</replaceable> every time an enum is encountered
in the input files. in the input files.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@ -333,7 +333,7 @@ where section may be <literal>file-header</literal>,
<varlistentry> <varlistentry>
<term><option>--identifier-prefix</option> <replaceable>PREFIX</replaceable></term> <term><option>--identifier-prefix</option> <replaceable>PREFIX</replaceable></term>
<listitem><para> <listitem><para>
Indicates what portion of the enum name should be intepreted as the Indicates what portion of the enum name should be interpreted as the
prefix (eg, the "<literal>Gtk</literal>" in prefix (eg, the "<literal>Gtk</literal>" in
"<literal>GtkDirectionType</literal>"). Normally this will be figured "<literal>GtkDirectionType</literal>"). Normally this will be figured
out automatically, but you may need to override the default if your out automatically, but you may need to override the default if your

View File

@ -103,7 +103,7 @@ if get_option('gtk_doc')
], ],
fixxref_args: [ fixxref_args: [
'--html-dir=' + docpath, '--html-dir=' + docpath,
'--extra-dir=' + join_paths(meson.current_build_dir(), '../glib/html'), '--extra-dir=' + join_paths('gobject', '..', 'glib', 'html'),
], ],
install: true install: true
) )

View File

@ -15,7 +15,7 @@ Name: GIO
Description: glib I/O library Description: glib I/O library
Version: @VERSION@ Version: @VERSION@
Requires: glib-2.0 gobject-2.0 Requires: glib-2.0 gobject-2.0
Requires.private: gmodule-no-export-2.0 Requires.private: gmodule-no-export-2.0 @LIBMOUNT_REQUIRES@
Libs: -L${libdir} -lgio-2.0 Libs: -L${libdir} -lgio-2.0
Libs.private: @ZLIB_LIBS@ @NETWORK_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@ @LIBMOUNT_LIBS@ Libs.private: @ZLIB_LIBS@ @NETWORK_LIBS@ @SELINUX_LIBS@ @COCOA_LIBS@ @CARBON_LIBS@
Cflags: Cflags:

View File

@ -990,6 +990,7 @@ gio_SOURCES = \
$(NULL) $(NULL)
gio_LDADD = libgio-2.0.la \ gio_LDADD = libgio-2.0.la \
$(top_builddir)/gobject/libgobject-2.0.la \ $(top_builddir)/gobject/libgobject-2.0.la \
$(top_builddir)/gmodule/libgmodule-2.0.la \
$(top_builddir)/glib/libglib-2.0.la \ $(top_builddir)/glib/libglib-2.0.la \
$(NULL) $(NULL)

0
gio/completion/gio Executable file → Normal file
View File

0
gio/gdbus-2.0/codegen/codegen_main.py Executable file → Normal file
View File

View File

@ -3088,7 +3088,7 @@ static volatile guint _global_filter_id = 1;
* dispatched anywhere else - not even the standard dispatch machinery * dispatched anywhere else - not even the standard dispatch machinery
* (that API such as g_dbus_connection_signal_subscribe() and * (that API such as g_dbus_connection_signal_subscribe() and
* g_dbus_connection_send_message_with_reply() relies on) will see the * g_dbus_connection_send_message_with_reply() relies on) will see the
* message. Similary, if a filter consumes an outgoing message, the * message. Similarly, if a filter consumes an outgoing message, the
* message will not be sent to the other peer. * message will not be sent to the other peer.
* *
* If @user_data_free_func is non-%NULL, it will be called (in the * If @user_data_free_func is non-%NULL, it will be called (in the

View File

@ -85,6 +85,8 @@
#define G_FILE_ATTRIBUTE_ID_UNIX_IS_MOUNTPOINT (7340032 + 10) #define G_FILE_ATTRIBUTE_ID_UNIX_IS_MOUNTPOINT (7340032 + 10)
#define G_FILE_ATTRIBUTE_ID_DOS_IS_ARCHIVE (8388608 + 1) #define G_FILE_ATTRIBUTE_ID_DOS_IS_ARCHIVE (8388608 + 1)
#define G_FILE_ATTRIBUTE_ID_DOS_IS_SYSTEM (8388608 + 2) #define G_FILE_ATTRIBUTE_ID_DOS_IS_SYSTEM (8388608 + 2)
#define G_FILE_ATTRIBUTE_ID_DOS_IS_MOUNTPOINT (8388608 + 3)
#define G_FILE_ATTRIBUTE_ID_DOS_REPARSE_POINT_TAG (8388608 + 4)
#define G_FILE_ATTRIBUTE_ID_OWNER_USER (9437184 + 1) #define G_FILE_ATTRIBUTE_ID_OWNER_USER (9437184 + 1)
#define G_FILE_ATTRIBUTE_ID_OWNER_USER_REAL (9437184 + 2) #define G_FILE_ATTRIBUTE_ID_OWNER_USER_REAL (9437184 + 2)
#define G_FILE_ATTRIBUTE_ID_OWNER_GROUP (9437184 + 3) #define G_FILE_ATTRIBUTE_ID_OWNER_GROUP (9437184 + 3)

View File

@ -245,6 +245,8 @@ ensure_attribute_hash (void)
REGISTER_ATTRIBUTE (UNIX_IS_MOUNTPOINT); REGISTER_ATTRIBUTE (UNIX_IS_MOUNTPOINT);
REGISTER_ATTRIBUTE (DOS_IS_ARCHIVE); REGISTER_ATTRIBUTE (DOS_IS_ARCHIVE);
REGISTER_ATTRIBUTE (DOS_IS_SYSTEM); REGISTER_ATTRIBUTE (DOS_IS_SYSTEM);
REGISTER_ATTRIBUTE (DOS_IS_MOUNTPOINT);
REGISTER_ATTRIBUTE (DOS_REPARSE_POINT_TAG);
REGISTER_ATTRIBUTE (OWNER_USER); REGISTER_ATTRIBUTE (OWNER_USER);
REGISTER_ATTRIBUTE (OWNER_USER_REAL); REGISTER_ATTRIBUTE (OWNER_USER_REAL);
REGISTER_ATTRIBUTE (OWNER_GROUP); REGISTER_ATTRIBUTE (OWNER_GROUP);

View File

@ -672,6 +672,33 @@ typedef struct _GFileInfoClass GFileInfoClass;
**/ **/
#define G_FILE_ATTRIBUTE_DOS_IS_SYSTEM "dos::is-system" /* boolean */ #define G_FILE_ATTRIBUTE_DOS_IS_SYSTEM "dos::is-system" /* boolean */
/**
* G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT:
*
* A key in the "dos" namespace for checking if the file is a NTFS mount point
* (a volume mount or a junction point).
* This attribute is %TRUE if file is a reparse point of type
* [IO_REPARSE_TAG_MOUNT_POINT](https://msdn.microsoft.com/en-us/library/dd541667.aspx).
* This attribute is only available for DOS file systems.
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
*
* Since: 2.60
**/
#define G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT "dos::is-mountpoint" /* boolean */
/**
* G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG:
*
* A key in the "dos" namespace for getting the file NTFS reparse tag.
* This value is 0 for files that are not reparse points.
* See the [Reparse Tags](https://msdn.microsoft.com/en-us/library/dd541667.aspx)
* page for possible reparse tag values. Corresponding #GFileAttributeType
* is %G_FILE_ATTRIBUTE_TYPE_UINT32.
*
* Since: 2.60
**/
#define G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG "dos::reparse-point-tag" /* uint32 */
/* Owner attributes */ /* Owner attributes */
/** /**

View File

@ -115,7 +115,7 @@ attribute_type_to_string (GFileAttributeType type)
case G_FILE_ATTRIBUTE_TYPE_OBJECT: case G_FILE_ATTRIBUTE_TYPE_OBJECT:
return "object"; return "object";
default: default:
return "uknown type"; return "unknown type";
} }
} }

View File

@ -1867,6 +1867,12 @@ _g_local_file_info_get (const char *basename,
if (statbuf.attributes & FILE_ATTRIBUTE_SYSTEM) if (statbuf.attributes & FILE_ATTRIBUTE_SYSTEM)
_g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_DOS_IS_SYSTEM, TRUE); _g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_DOS_IS_SYSTEM, TRUE);
if (statbuf.reparse_tag == IO_REPARSE_TAG_MOUNT_POINT)
_g_file_info_set_attribute_boolean_by_id (info, G_FILE_ATTRIBUTE_ID_DOS_IS_MOUNTPOINT, TRUE);
if (statbuf.reparse_tag != 0)
_g_file_info_set_attribute_uint32_by_id (info, G_FILE_ATTRIBUTE_ID_DOS_REPARSE_POINT_TAG, statbuf.reparse_tag);
#endif #endif
symlink_target = NULL; symlink_target = NULL;

View File

@ -621,7 +621,7 @@ _g_mount_get_for_mount_path (const gchar *mount_path,
* also listen for the "removed" signal on the returned object * also listen for the "removed" signal on the returned object
* and give up its reference when handling that signal * and give up its reference when handling that signal
* *
* Similary, if implementing g_volume_monitor_adopt_orphan_mount(), * Similarly, if implementing g_volume_monitor_adopt_orphan_mount(),
* the implementor must take a reference to @mount and return it in * the implementor must take a reference to @mount and return it in
* its g_volume_get_mount() implemented. Also, the implementor must * its g_volume_get_mount() implemented. Also, the implementor must
* listen for the "unmounted" signal on @mount and give up its * listen for the "unmounted" signal on @mount and give up its

View File

@ -351,6 +351,12 @@ local_sources = files(
platform_deps = [] platform_deps = []
internal_deps = [] internal_deps = []
# TODO: internal_objects is a workaround for
# <https://github.com/mesonbuild/meson/issues/3934> and
# <https://github.com/mesonbuild/meson/issues/3937>. When we can depend
# on a meson version where those are fixed, revert the commit that
# introduced this workaround.
internal_objects = []
appinfo_sources = [] appinfo_sources = []
contenttype_sources = [] contenttype_sources = []
portal_sources = [] portal_sources = []
@ -424,6 +430,7 @@ if host_system != 'windows'
subdir('xdgmime') subdir('xdgmime')
internal_deps += [xdgmime_lib] internal_deps += [xdgmime_lib]
internal_objects += [xdgmime_lib.extract_all_objects()]
install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio') install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio')
@ -749,17 +756,20 @@ gioenumtypes_dep = declare_dependency(sources : [gioenumtypes_h])
if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1 if glib_conf.has('HAVE_SYS_INOTIFY_H') and have_func_inotify_init1
subdir('inotify') subdir('inotify')
internal_deps += [ inotify_lib ] internal_deps += [ inotify_lib ]
internal_objects += [inotify_lib.extract_all_objects()]
endif endif
# kevent # kevent
if have_func_kqueue and have_func_kevent if have_func_kqueue and have_func_kevent
subdir('kqueue') subdir('kqueue')
internal_deps += [ kqueue_lib ] internal_deps += [ kqueue_lib ]
internal_objects += [kqueue_lib.extract_all_objects()]
endif endif
if host_system == 'windows' if host_system == 'windows'
subdir('win32') subdir('win32')
internal_deps += [ giowin32_lib ] internal_deps += [ giowin32_lib ]
internal_objects += [giowin32_lib.extract_all_objects()]
endif endif
if have_bash if have_bash
@ -784,11 +794,11 @@ endif
libgio = library('gio-2.0', libgio = library('gio-2.0',
gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources, gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
gio_dtrace_hdr, gio_dtrace_obj, gio_dtrace_hdr, gio_dtrace_obj,
objects : internal_objects,
version : library_version, version : library_version,
soversion : soversion, soversion : soversion,
install : true, install : true,
include_directories : [configinc, gioinc], include_directories : [configinc, gioinc],
link_with : internal_deps,
# '$(gio_win32_res_ldflag)', # '$(gio_win32_res_ldflag)',
dependencies : [libz_dep, libdl_dep, libmount_dep, libglib_dep, dependencies : [libz_dep, libdl_dep, libmount_dep, libglib_dep,
libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep, libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,
@ -979,7 +989,4 @@ if enable_systemtap
endif endif
subdir('fam') subdir('fam')
subdir('tests')
if host_system != 'windows'
subdir('tests')
endif

View File

View File

@ -29,8 +29,9 @@
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
#include <stdio.h> #include <stdio.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <Windows.h> #include <windows.h>
#include <Shlobj.h> #include <shlobj.h>
#include <io.h> /* for _get_osfhandle */
#endif #endif
#define TEST_NAME "Prilis zlutoucky kun" #define TEST_NAME "Prilis zlutoucky kun"
@ -180,16 +181,24 @@ test_internal_enhanced_stdio (void)
gchar *programdata; gchar *programdata;
gchar *users_dir; gchar *users_dir;
gchar *allusers; gchar *allusers;
GFile *gf_programdata, *gf_allusers; gchar *commondata;
GFileInfo *fi_programdata, *fi_allusers, *fi_allusers_target; GFile *gf_programdata, *gf_allusers, *gf_commondata;
GFileInfo *fi_programdata, *fi_allusers, *fi_allusers_target, *fi_commondata, *fi_commondata_target;
GFileType ft_allusers; GFileType ft_allusers;
GFileType ft_allusers_target; GFileType ft_allusers_target;
GFileType ft_programdata; GFileType ft_programdata;
GFileType ft_commondata;
gboolean allusers_is_symlink; gboolean allusers_is_symlink;
gboolean commondata_is_symlink;
gboolean commondata_is_mount_point;
guint32 allusers_reparse_tag;
guint32 commondata_reparse_tag;
const gchar *id_allusers; const gchar *id_allusers;
const gchar *id_allusers_target; const gchar *id_allusers_target;
const gchar *id_commondata_target;
const gchar *id_programdata; const gchar *id_programdata;
const gchar *allusers_target; const gchar *allusers_target;
const gchar *commondata_target;
/* C:/ProgramData */ /* C:/ProgramData */
programdata = g_utf16_to_utf8 (programdata_dir_w, -1, NULL, NULL, NULL); programdata = g_utf16_to_utf8 (programdata_dir_w, -1, NULL, NULL, NULL);
@ -201,7 +210,11 @@ test_internal_enhanced_stdio (void)
* for "C:/ProgramData". * for "C:/ProgramData".
*/ */
allusers = g_build_filename (users_dir, "All Users", NULL); allusers = g_build_filename (users_dir, "All Users", NULL);
g_assert_nonnull (allusers);
/* "C:/Users/All Users/Application Data" is a known
* junction for "C:/ProgramData"
*/
commondata = g_build_filename (allusers, "Application Data", NULL);
/* We don't test g_stat() and g_lstat() on these directories, /* We don't test g_stat() and g_lstat() on these directories,
* because it is pointless - there's no way to tell that these * because it is pointless - there's no way to tell that these
@ -213,6 +226,7 @@ test_internal_enhanced_stdio (void)
*/ */
gf_programdata = g_file_new_for_path (programdata); gf_programdata = g_file_new_for_path (programdata);
gf_allusers = g_file_new_for_path (allusers); gf_allusers = g_file_new_for_path (allusers);
gf_commondata = g_file_new_for_path (commondata);
fi_programdata = g_file_query_info (gf_programdata, fi_programdata = g_file_query_info (gf_programdata,
G_FILE_ATTRIBUTE_ID_FILE "," G_FILE_ATTRIBUTE_ID_FILE ","
@ -229,52 +243,99 @@ test_internal_enhanced_stdio (void)
fi_allusers = g_file_query_info (gf_allusers, fi_allusers = g_file_query_info (gf_allusers,
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET "," G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK "," G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK ","
G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG ","
G_FILE_ATTRIBUTE_ID_FILE "," G_FILE_ATTRIBUTE_ID_FILE ","
G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL, NULL); NULL, NULL);
g_assert (g_file_info_has_attribute (fi_programdata, G_FILE_ATTRIBUTE_ID_FILE)); fi_commondata = g_file_query_info (gf_commondata,
g_assert (g_file_info_has_attribute (fi_programdata, G_FILE_ATTRIBUTE_STANDARD_TYPE)); G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK ","
G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT ","
G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG ","
G_FILE_ATTRIBUTE_ID_FILE ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL, NULL);
g_assert (g_file_info_has_attribute (fi_allusers_target, G_FILE_ATTRIBUTE_ID_FILE)); fi_commondata_target = g_file_query_info (gf_commondata,
g_assert (g_file_info_has_attribute (fi_allusers_target, G_FILE_ATTRIBUTE_STANDARD_TYPE)); G_FILE_ATTRIBUTE_ID_FILE ","
G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE,
NULL, NULL);
g_assert (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_ID_FILE)); g_assert_true (g_file_info_has_attribute (fi_programdata, G_FILE_ATTRIBUTE_ID_FILE));
g_assert (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_STANDARD_TYPE)); g_assert_true (g_file_info_has_attribute (fi_programdata, G_FILE_ATTRIBUTE_STANDARD_TYPE));
g_assert (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK));
g_assert (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET)); g_assert_true (g_file_info_has_attribute (fi_allusers_target, G_FILE_ATTRIBUTE_ID_FILE));
g_assert_true (g_file_info_has_attribute (fi_allusers_target, G_FILE_ATTRIBUTE_STANDARD_TYPE));
g_assert_true (g_file_info_has_attribute (fi_commondata_target, G_FILE_ATTRIBUTE_ID_FILE));
g_assert_true (g_file_info_has_attribute (fi_commondata_target, G_FILE_ATTRIBUTE_STANDARD_TYPE));
g_assert_true (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_ID_FILE));
g_assert_true (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_STANDARD_TYPE));
g_assert_true (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK));
g_assert_true (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG));
g_assert_true (g_file_info_has_attribute (fi_allusers, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET));
g_assert_true (g_file_info_has_attribute (fi_commondata, G_FILE_ATTRIBUTE_ID_FILE));
g_assert_true (g_file_info_has_attribute (fi_commondata, G_FILE_ATTRIBUTE_STANDARD_TYPE));
g_assert_true (g_file_info_has_attribute (fi_commondata, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK));
g_assert_true (g_file_info_has_attribute (fi_commondata, G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT));
g_assert_true (g_file_info_has_attribute (fi_commondata, G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG));
g_assert_true (g_file_info_has_attribute (fi_commondata, G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET));
ft_allusers = g_file_info_get_file_type (fi_allusers); ft_allusers = g_file_info_get_file_type (fi_allusers);
ft_allusers_target = g_file_info_get_file_type (fi_allusers_target); ft_allusers_target = g_file_info_get_file_type (fi_allusers_target);
ft_programdata = g_file_info_get_file_type (fi_programdata); ft_programdata = g_file_info_get_file_type (fi_programdata);
ft_commondata = g_file_info_get_file_type (fi_commondata);
g_assert (ft_allusers == G_FILE_TYPE_SYMBOLIC_LINK); g_assert_cmpint (ft_allusers, ==, G_FILE_TYPE_SYMBOLIC_LINK);
g_assert (ft_allusers_target == G_FILE_TYPE_DIRECTORY); g_assert_cmpint (ft_allusers_target, ==, G_FILE_TYPE_DIRECTORY);
g_assert (ft_programdata == G_FILE_TYPE_DIRECTORY); g_assert_cmpint (ft_programdata, ==, G_FILE_TYPE_DIRECTORY);
g_assert_cmpint (ft_commondata, ==, G_FILE_TYPE_SYMBOLIC_LINK);
allusers_is_symlink = g_file_info_get_attribute_boolean (fi_allusers, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK); allusers_is_symlink = g_file_info_get_attribute_boolean (fi_allusers, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK);
allusers_reparse_tag = g_file_info_get_attribute_uint32 (fi_allusers, G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG);
commondata_is_symlink = g_file_info_get_attribute_boolean (fi_commondata, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK);
commondata_is_mount_point = g_file_info_get_attribute_boolean (fi_commondata, G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT);
commondata_reparse_tag = g_file_info_get_attribute_uint32 (fi_commondata, G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG);
g_assert_true (allusers_is_symlink); g_assert_true (allusers_is_symlink);
g_assert_cmpuint (allusers_reparse_tag, ==, IO_REPARSE_TAG_SYMLINK);
g_assert_true (commondata_is_symlink);
g_assert_true (commondata_is_mount_point);
g_assert_cmpuint (commondata_reparse_tag, ==, IO_REPARSE_TAG_MOUNT_POINT);
id_allusers = g_file_info_get_attribute_string (fi_allusers, G_FILE_ATTRIBUTE_ID_FILE); id_allusers = g_file_info_get_attribute_string (fi_allusers, G_FILE_ATTRIBUTE_ID_FILE);
id_allusers_target = g_file_info_get_attribute_string (fi_allusers_target, G_FILE_ATTRIBUTE_ID_FILE); id_allusers_target = g_file_info_get_attribute_string (fi_allusers_target, G_FILE_ATTRIBUTE_ID_FILE);
id_commondata_target = g_file_info_get_attribute_string (fi_commondata_target, G_FILE_ATTRIBUTE_ID_FILE);
id_programdata = g_file_info_get_attribute_string (fi_programdata, G_FILE_ATTRIBUTE_ID_FILE); id_programdata = g_file_info_get_attribute_string (fi_programdata, G_FILE_ATTRIBUTE_ID_FILE);
g_assert_cmpstr (id_allusers_target, ==, id_programdata); g_assert_cmpstr (id_allusers_target, ==, id_programdata);
g_assert_cmpstr (id_commondata_target, ==, id_programdata);
g_assert_cmpstr (id_allusers, !=, id_programdata); g_assert_cmpstr (id_allusers, !=, id_programdata);
allusers_target = g_file_info_get_symlink_target (fi_allusers); allusers_target = g_file_info_get_symlink_target (fi_allusers);
g_assert_true (g_str_has_suffix (allusers_target, "ProgramData")); g_assert_true (g_str_has_suffix (allusers_target, "ProgramData"));
commondata_target = g_file_info_get_symlink_target (fi_commondata);
g_assert_true (g_str_has_suffix (commondata_target, "ProgramData"));
g_object_unref (fi_allusers); g_object_unref (fi_allusers);
g_object_unref (fi_allusers_target); g_object_unref (fi_allusers_target);
g_object_unref (fi_commondata);
g_object_unref (fi_commondata_target);
g_object_unref (fi_programdata); g_object_unref (fi_programdata);
g_object_unref (gf_allusers); g_object_unref (gf_allusers);
g_object_unref (gf_commondata);
g_object_unref (gf_programdata); g_object_unref (gf_programdata);
g_free (allusers); g_free (allusers);
g_free (commondata);
g_free (users_dir); g_free (users_dir);
g_free (programdata); g_free (programdata);
} }
@ -325,7 +386,7 @@ test_internal_enhanced_stdio (void)
g_assert_nonnull (f); g_assert_nonnull (f);
h = (HANDLE) _get_osfhandle (fileno (f)); h = (HANDLE) _get_osfhandle (fileno (f));
g_assert (h != INVALID_HANDLE_VALUE); g_assert_cmpuint ((guintptr) h, !=, (guintptr) INVALID_HANDLE_VALUE);
ssb.SetSparse = TRUE; ssb.SetSparse = TRUE;
g_assert_true (DeviceIoControl (h, g_assert_true (DeviceIoControl (h,
@ -364,8 +425,8 @@ test_internal_enhanced_stdio (void)
g_remove (ps); g_remove (ps);
g_assert (g_file_info_has_attribute (fi_ps, G_FILE_ATTRIBUTE_STANDARD_SIZE)); g_assert_true (g_file_info_has_attribute (fi_ps, G_FILE_ATTRIBUTE_STANDARD_SIZE));
g_assert (g_file_info_has_attribute (fi_ps, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE)); g_assert_true (g_file_info_has_attribute (fi_ps, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE));
size_ps = g_file_info_get_attribute_uint64 (fi_ps, G_FILE_ATTRIBUTE_STANDARD_SIZE); size_ps = g_file_info_get_attribute_uint64 (fi_ps, G_FILE_ATTRIBUTE_STANDARD_SIZE);
alsize_ps = g_file_info_get_attribute_uint64 (fi_ps, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE); alsize_ps = g_file_info_get_attribute_uint64 (fi_ps, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE);
@ -404,7 +465,7 @@ test_internal_enhanced_stdio (void)
g_assert_nonnull (f); g_assert_nonnull (f);
h = (HANDLE) _get_osfhandle (fileno (f)); h = (HANDLE) _get_osfhandle (fileno (f));
g_assert (h != INVALID_HANDLE_VALUE); g_assert_cmpuint ((guintptr) h, !=, (guintptr) INVALID_HANDLE_VALUE);
fprintf (f, "1"); fprintf (f, "1");
fflush (f); fflush (f);
@ -443,15 +504,15 @@ test_internal_enhanced_stdio (void)
G_FILE_QUERY_INFO_NONE, G_FILE_QUERY_INFO_NONE,
NULL, NULL); NULL, NULL);
g_assert (g_file_info_has_attribute (fi_p0, G_FILE_ATTRIBUTE_STANDARD_SIZE)); g_assert_true (g_file_info_has_attribute (fi_p0, G_FILE_ATTRIBUTE_STANDARD_SIZE));
g_assert (g_file_info_has_attribute (fi_p0, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE)); g_assert_true (g_file_info_has_attribute (fi_p0, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE));
g_assert (g_file_info_has_attribute (fi_p0, G_FILE_ATTRIBUTE_ID_FILE)); g_assert_true (g_file_info_has_attribute (fi_p0, G_FILE_ATTRIBUTE_ID_FILE));
g_assert (g_file_info_has_attribute (fi_p0, G_FILE_ATTRIBUTE_TIME_MODIFIED)); g_assert_true (g_file_info_has_attribute (fi_p0, G_FILE_ATTRIBUTE_TIME_MODIFIED));
g_assert (g_file_info_has_attribute (fi_p1, G_FILE_ATTRIBUTE_STANDARD_SIZE)); g_assert_true (g_file_info_has_attribute (fi_p1, G_FILE_ATTRIBUTE_STANDARD_SIZE));
g_assert (g_file_info_has_attribute (fi_p1, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE)); g_assert_true (g_file_info_has_attribute (fi_p1, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE));
g_assert (g_file_info_has_attribute (fi_p1, G_FILE_ATTRIBUTE_ID_FILE)); g_assert_true (g_file_info_has_attribute (fi_p1, G_FILE_ATTRIBUTE_ID_FILE));
g_assert (g_file_info_has_attribute (fi_p1, G_FILE_ATTRIBUTE_TIME_MODIFIED)); g_assert_true (g_file_info_has_attribute (fi_p1, G_FILE_ATTRIBUTE_TIME_MODIFIED));
size_p0 = g_file_info_get_attribute_uint64 (fi_p0, G_FILE_ATTRIBUTE_STANDARD_SIZE); size_p0 = g_file_info_get_attribute_uint64 (fi_p0, G_FILE_ATTRIBUTE_STANDARD_SIZE);
alsize_p0 = g_file_info_get_attribute_uint64 (fi_p0, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE); alsize_p0 = g_file_info_get_attribute_uint64 (fi_p0, G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE);
@ -469,7 +530,7 @@ test_internal_enhanced_stdio (void)
/* st_ino from W32 stat() is useless for file identification. /* st_ino from W32 stat() is useless for file identification.
* It will be either 0, or it will be the same for both files. * It will be either 0, or it will be the same for both files.
*/ */
g_assert (statbuf_p0.st_ino == statbuf_p1.st_ino); g_assert_cmpint (statbuf_p0.st_ino, ==, statbuf_p1.st_ino);
g_assert_cmpstr (id_p0, !=, id_p1); g_assert_cmpstr (id_p0, !=, id_p1);
time_p0 = g_file_info_get_attribute_uint64 (fi_p0, G_FILE_ATTRIBUTE_TIME_MODIFIED); time_p0 = g_file_info_get_attribute_uint64 (fi_p0, G_FILE_ATTRIBUTE_TIME_MODIFIED);
@ -481,7 +542,7 @@ test_internal_enhanced_stdio (void)
* and 64-bit on 64-bit Windows, usually), * and 64-bit on 64-bit Windows, usually),
* so it *can* pass this test in some cases. * so it *can* pass this test in some cases.
*/ */
g_assert (time_p0 > G_GUINT64_CONSTANT (0xFFFFFFFF)); g_assert_cmpuint (time_p0, >, G_GUINT64_CONSTANT (0xFFFFFFFF));
g_object_unref (fi_p0); g_object_unref (fi_p0);
g_object_unref (fi_p1); g_object_unref (fi_p1);

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

@ -22,7 +22,9 @@
#include <gio/gio.h> #include <gio/gio.h>
#include <string.h> #include <string.h>
#ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
#endif
#include <dbus/dbus.h> #include <dbus/dbus.h>
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -19,7 +19,9 @@
*/ */
#include <gio/gio.h> #include <gio/gio.h>
#ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
#endif
#include "gdbus-tests.h" #include "gdbus-tests.h"

View File

@ -5,6 +5,10 @@ common_gio_tests_deps = [
libgio_dep, libgio_dep,
] ]
if host_machine.system() == 'windows'
common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
endif
subdir('gdbus-object-manager-example') subdir('gdbus-object-manager-example')
gengiotypefuncs_prog = find_program('gengiotypefuncs.py') gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
@ -75,6 +79,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()
@ -139,9 +144,11 @@ if host_machine.system() != 'windows'
gio_tests += [{ gio_tests += [{
'appinfo' : { 'appinfo' : {
'install' : false, 'install' : false,
'is_parallel' : false,
}, },
'desktop-app-info' : { 'desktop-app-info' : {
'install' : false, 'install' : false,
'is_parallel' : false,
}, },
}] }]
endif endif
@ -221,7 +228,10 @@ if host_machine.system() != 'windows'
'extra_sources' : extra_sources, 'extra_sources' : extra_sources,
'suite' : ['slow'], 'suite' : ['slow'],
}, },
'gmenumodel' : {'extra_sources' : extra_sources}, 'gmenumodel' : {
'extra_sources' : extra_sources,
'suite' : ['slow'],
},
'gnotification' : { 'gnotification' : {
'extra_sources' : [extra_sources, 'gnotification-server.c'], 'extra_sources' : [extra_sources, 'gnotification-server.c'],
}, },
@ -246,9 +256,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' : {
@ -310,7 +321,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},
@ -320,22 +330,27 @@ test_extra_programs += [{
'extra_sources' : ['gtlsconsoleinteraction.c'], 'extra_sources' : ['gtlsconsoleinteraction.c'],
'install' : false, 'install' : false,
}, },
# These three are manual-run tests because they need a session bus but don't bring one up themselves
# FIXME: these build but don't seem to work!
'gdbus-example-objectmanager-client' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
'gdbus-example-objectmanager-server' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
'gdbus-test-fixture' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
}] }]
if cc.get_id() != 'msvc'
test_extra_programs += [{
# These three are manual-run tests because they need a session bus but don't bring one up themselves
# FIXME: these build but don't seem to work!
'gdbus-example-objectmanager-client' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
'gdbus-example-objectmanager-server' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
'gdbus-test-fixture' : {
'dependencies' : [libgdbus_example_objectmanager_dep],
'install' : false,
},
}]
endif
if host_machine.system() != 'windows' if host_machine.system() != 'windows'
test_extra_programs += [{ test_extra_programs += [{
'gdbus-example-unix-fd-client' : { 'gdbus-example-unix-fd-client' : {
@ -344,6 +359,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',
@ -356,14 +390,12 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
'--c-name', '_g_plugin', '--c-name', '_g_plugin',
'@INPUT@']) '@INPUT@'])
if host_system == 'windows' shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
resource_plugin_platform_link_args = ['-no-undefined'] link_args : export_dynamic_ldflags,
else dependencies : common_gio_tests_deps,
resource_plugin_platform_link_args = [] install_dir : installed_tests_execdir,
endif install : installed_tests_enabled
shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c, )
link_args : export_dynamic_ldflags + resource_plugin_platform_link_args,
dependencies : common_gio_tests_deps)
test_gresource = custom_target('test.gresource', test_gresource = custom_target('test.gresource',
input : 'test.gresource.xml', input : 'test.gresource.xml',
@ -372,7 +404,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',
@ -431,7 +465,7 @@ foreach test_dict : gio_tests
test_conf.set('installed_tests_dir', installed_tests_execdir) test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name) test_conf.set('program', test_name)
configure_file( configure_file(
input: installed_tests_template, input: installed_tests_template_tap,
output: test_name + '.test', output: test_name + '.test',
install_dir: installed_tests_metadir, install_dir: installed_tests_metadir,
configuration: test_conf configuration: test_conf
@ -447,7 +481,13 @@ foreach test_dict : gio_tests
suite = ['gio'] + extra_args.get('suite', []) suite = ['gio'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? 120 : 30 timeout = suite.contains('slow') ? 120 : 30
test(test_name, exe, env : test_env, timeout : timeout, suite : suite) test(test_name, exe,
env : test_env,
timeout : timeout,
suite : suite,
args : ['--tap'],
is_parallel : extra_args.get('is_parallel', true),
)
endforeach endforeach
endforeach endforeach

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

@ -20,6 +20,8 @@
* if advised of the possibility of such damage. * if advised of the possibility of such damage.
*/ */
#include "config.h" /* for _GLIB_EXTERN */
#include <gio/gio.h> #include <gio/gio.h>
#include "symbol-visibility.h" #include "symbol-visibility.h"

View File

@ -20,6 +20,8 @@
* if advised of the possibility of such damage. * if advised of the possibility of such damage.
*/ */
#include "config.h" /* for _GLIB_EXTERN */
#include <gio/gio.h> #include <gio/gio.h>
#include "symbol-visibility.h" #include "symbol-visibility.h"

View File

@ -6,6 +6,9 @@
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef G_OS_WIN32
#include <io.h> /* for close() */
#endif
static const char *original_data = "This is some test data that we can put in a file..."; static const char *original_data = "This is some test data that we can put in a file...";
static const char *new_data = "new data.."; static const char *new_data = "new data..";

View File

@ -3,7 +3,6 @@
#GTESTER = gtester # for non-GLIB packages #GTESTER = gtester # for non-GLIB packages
#GTESTER_REPORT = gtester-report # for non-GLIB packages #GTESTER_REPORT = gtester-report # for non-GLIB packages
GTESTER = $(top_builddir)/glib/gtester # for the GLIB package GTESTER = $(top_builddir)/glib/gtester # for the GLIB package
GTESTER_REPORT = $(top_builddir)/glib/gtester-report # for the GLIB package
NULL = NULL =
# initialize variables for unconditional += appending # initialize variables for unconditional += appending

View File

@ -454,24 +454,17 @@ bin_PROGRAMS += gtester
gtester_SOURCES = gtester.c gtester_SOURCES = gtester.c
gtester_LDADD = libglib-2.0.la gtester_LDADD = libglib-2.0.la
auto_config_binscripts = gtester-report bin_SCRIPTS = gtester-report
bin_SCRIPTS = ${auto_config_binscripts} EXTRA_DIST += gtester-report.in
EXTRA_DIST += ${auto_config_binscripts}
CONFIGVARS = \ gtester-report: gtester-report.in Makefile
"bindir" : "${bindir}", \ $(AM_V_GEN) set -e ; \
"glib-version" : "${GLIB_VERSION}" sed < $< > $@.tmp \
-e '1,1s|#!.*|#!${PYTHON}|' \
install-exec-hook: -e 's|[@]GLIB_VERSION[@]|${GLIB_VERSION}|' \
for sf in ${auto_config_binscripts} ; do \
mv -f "$(DESTDIR)$(bindir)/$$sf" "$(DESTDIR)$(bindir)/$$sf".tmp \
&& sed < "$(DESTDIR)$(bindir)/$$sf".tmp > "$(DESTDIR)$(bindir)/$$sf" \
-e '1,24s|^ *#@PKGINSTALL_CONFIGVARS_IN24LINES@| ${CONFIGVARS}|' \
-e '1,1s|#! /usr/bin/env python.*|#!${PYTHON}|' \
|| exit $$? ; \ || exit $$? ; \
chmod a+x $(DESTDIR)$(bindir)/$$sf ; \ chmod +x $@.tmp ; \
rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \ mv $@.tmp $@
done
endif endif

View File

@ -3360,8 +3360,8 @@ expand_exec_line (const gchar *exec_fmt,
* @stamp: (out) (optional): return location for the last registration time, or %NULL * @stamp: (out) (optional): return location for the last registration time, or %NULL
* @error: return location for a #GError, or %NULL * @error: return location for a #GError, or %NULL
* *
* Gets the registration informations of @app_name for the bookmark for * Gets the registration information of @app_name for the bookmark for
* @uri. See g_bookmark_file_set_app_info() for more informations about * @uri. See g_bookmark_file_set_app_info() for more information about
* the returned data. * the returned data.
* *
* The string returned in @app_exec must be freed. * The string returned in @app_exec must be freed.

View File

@ -55,7 +55,9 @@
#ifndef VASNPRINTF #ifndef VASNPRINTF
# include <config.h> # include <config.h>
#endif #endif
/* galloca.h also defines alloca and HAVE_ALLOCA makes the code below use it */
#include "glib/galloca.h" #include "glib/galloca.h"
#define HAVE_ALLOCA 1
#include "g-gnulib.h" #include "g-gnulib.h"

View File

@ -1697,12 +1697,7 @@ g_scanner_get_token_i (GScanner *scanner,
*token_p = G_TOKEN_FLOAT; *token_p = G_TOKEN_FLOAT;
if (scanner->config->store_int64) if (scanner->config->store_int64)
{ {
#ifdef _MSC_VER
/* work around error C2520, see gvaluetransform.c */
value_p->v_float = (__int64)value_p->v_int64;
#else
value_p->v_float = value_p->v_int64; value_p->v_float = value_p->v_int64;
#endif
} }
else else
value_p->v_float = value_p->v_int; value_p->v_float = value_p->v_int;

View File

@ -30,7 +30,10 @@
#include <string.h> #include <string.h>
#include <stdlib.h> /* for fdwalk */ #include <stdlib.h> /* for fdwalk */
#include <dirent.h> #include <dirent.h>
#ifdef HAVE_SPAWN_H
#include <spawn.h> #include <spawn.h>
#endif /* HAVE_SPAWN_H */
#ifdef HAVE_CRT_EXTERNS_H #ifdef HAVE_CRT_EXTERNS_H
#include <crt_externs.h> /* for _NSGetEnviron */ #include <crt_externs.h> /* for _NSGetEnviron */

77
glib/gstdio-private.c Normal file
View File

@ -0,0 +1,77 @@
/* gstdio-private.c - private glib functions for gstdio.c
*
* Copyright 2004 Tor Lillqvist
* Copyright 2018 Руслан Ижбулатов
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
/* Strips "\\\\?\\" extended prefix or
* "\\??\\" NT Object Manager prefix from
* @str in-place, using memmove.
* @str_size must point to the size of @str
* in gunichar2s, including NUL-terminator
* (if @str is NUL-terminated; it doesn't have to be).
* On return @str_size will correctly reflect changes
* in @str size (if any).
* Returns TRUE if @str was modified.
*/
static gboolean
_g_win32_strip_extended_ntobjm_prefix (gunichar2 *str,
gsize *str_size)
{
const wchar_t *extended_prefix = L"\\\\?\\";
const gsize extended_prefix_len = wcslen (extended_prefix);
const gsize extended_prefix_len_bytes = sizeof (gunichar2) * extended_prefix_len;
const gsize extended_prefix_with_drive_len_bytes = sizeof (gunichar2) * (extended_prefix_len + 2);
const wchar_t *ntobjm_prefix = L"\\??\\";
const gsize ntobjm_prefix_len = wcslen (ntobjm_prefix);
const gsize ntobjm_prefix_len_bytes = sizeof (gunichar2) * ntobjm_prefix_len;
const gsize ntobjm_prefix_with_drive_len_bytes = sizeof (gunichar2) * (ntobjm_prefix_len + 2);
gboolean do_move = FALSE;
gsize move_shift = 0;
if ((*str_size) * sizeof (gunichar2) > extended_prefix_with_drive_len_bytes &&
memcmp (str,
extended_prefix,
extended_prefix_len_bytes) == 0 &&
iswascii (str[extended_prefix_len]) &&
iswalpha (str[extended_prefix_len]) &&
str[extended_prefix_len + 1] == L':')
{
do_move = TRUE;
move_shift = extended_prefix_len;
}
else if ((*str_size) * sizeof (gunichar2) > ntobjm_prefix_with_drive_len_bytes &&
memcmp (str,
ntobjm_prefix,
ntobjm_prefix_len_bytes) == 0 &&
iswascii (str[ntobjm_prefix_len]) &&
iswalpha (str[ntobjm_prefix_len]) &&
str[ntobjm_prefix_len + 1] == L':')
{
do_move = TRUE;
move_shift = ntobjm_prefix_len;
}
if (do_move)
{
*str_size -= move_shift;
memmove (str,
str + move_shift,
(*str_size) * sizeof (gunichar2));
}
return do_move;
}

View File

@ -121,6 +121,8 @@ w32_error_to_errno (DWORD error_code)
} }
} }
#include "gstdio-private.c"
static int static int
_g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename, _g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename,
int fd, int fd,
@ -259,15 +261,11 @@ _g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename,
if (new_len > 0) if (new_len > 0)
{ {
const wchar_t *extended_prefix = L"\\\\?\\";
const gsize extended_prefix_len = wcslen (extended_prefix);
const gsize extended_prefix_len_bytes = sizeof (wchar_t) * extended_prefix_len;
/* Pretend that new_len doesn't count the terminating NUL char, /* Pretend that new_len doesn't count the terminating NUL char,
* and ask for a bit more space than is needed. * and ask for a bit more space than is needed, and allocate even more.
*/ */
filename_target_len = new_len + 5; filename_target_len = new_len + 3;
filename_target = g_malloc (filename_target_len * sizeof (wchar_t)); filename_target = g_malloc ((filename_target_len + 1) * sizeof (wchar_t));
new_len = GetFinalPathNameByHandleW (file_handle, new_len = GetFinalPathNameByHandleW (file_handle,
filename_target, filename_target,
@ -284,17 +282,32 @@ _g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename,
error_code = ERROR_BUFFER_OVERFLOW; error_code = ERROR_BUFFER_OVERFLOW;
g_clear_pointer (&filename_target, g_free); g_clear_pointer (&filename_target, g_free);
} }
/* GetFinalPathNameByHandle() is documented to return extended paths, else if (new_len == 0)
* strip the extended prefix.
*/
else if (new_len > extended_prefix_len &&
memcmp (filename_target, extended_prefix, extended_prefix_len_bytes) == 0)
{ {
new_len -= extended_prefix_len; g_clear_pointer (&filename_target, g_free);
memmove (filename_target,
filename_target + extended_prefix_len,
(new_len + 1) * sizeof (wchar_t));
} }
/* GetFinalPathNameByHandle() is documented to return extended paths,
* strip the extended prefix, if it is followed by a drive letter
* and a colon. Otherwise keep it (the path could be
* \\\\?\\Volume{GUID}\\ - it's only usable in extended form).
*/
else if (new_len > 0)
{
gsize len = new_len;
/* Account for NUL-terminator maybe not being counted.
* This is why we overallocated earlier.
*/
if (filename_target[len] != L'\0')
{
len++;
filename_target[len] = L'\0';
}
_g_win32_strip_extended_ntobjm_prefix (filename_target, &len);
new_len = len;
}
} }
if (new_len == 0) if (new_len == 0)
@ -453,8 +466,9 @@ _g_win32_readlink_utf16_raw (const gunichar2 *filename,
* point and use DeviceIoControl() on it. * point and use DeviceIoControl() on it.
*/ */
h = CreateFileW (filename, h = CreateFileW (filename,
FILE_READ_ATTRIBUTES | SYNCHRONIZE | GENERIC_READ, FILE_READ_EA,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL FILE_ATTRIBUTE_NORMAL
| FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_OPEN_REPARSE_POINT
| (attributes & FILE_ATTRIBUTE_DIRECTORY ? FILE_FLAG_BACKUP_SEMANTICS : 0), | (attributes & FILE_ATTRIBUTE_DIRECTORY ? FILE_FLAG_BACKUP_SEMANTICS : 0),
@ -513,10 +527,8 @@ _g_win32_readlink_utf16 (const gunichar2 *filename,
gunichar2 *buf, gunichar2 *buf,
gsize buf_size) gsize buf_size)
{ {
const wchar_t *ntobjm_prefix = L"\\??\\"; int result = _g_win32_readlink_utf16_raw (filename, buf, buf_size);
const gsize ntobjm_prefix_len_unichar2 = wcslen (ntobjm_prefix); gsize string_size;
const gsize ntobjm_prefix_len_bytes = sizeof (gunichar2) * ntobjm_prefix_len_unichar2;
int result = _g_win32_readlink_utf16_raw (filename, buf, buf_size);
if (result <= 0) if (result <= 0)
return result; return result;
@ -532,16 +544,16 @@ _g_win32_readlink_utf16 (const gunichar2 *filename,
/* DeviceIoControl () tends to return filenames as NT Object Manager /* DeviceIoControl () tends to return filenames as NT Object Manager
* names , i.e. "\\??\\C:\\foo\\bar". * names , i.e. "\\??\\C:\\foo\\bar".
* Remove the leading 4-byte \??\ prefix, as glib (as well as many W32 API * Remove the leading 4-byte \??\ prefix, as glib (as well as many W32 API
* functions) is unprepared to deal with it. * functions) is unprepared to deal with it. Unless it has no 'x:' drive
* letter part after the prefix, in which case we leave everything
* as-is, because the path could be "\??\Volume{GUID}" - stripping
* the prefix will allow it to be confused with relative links
* targeting "Volume{GUID}".
*/ */
if (result > ntobjm_prefix_len_bytes && string_size = result / sizeof (gunichar2);
memcmp (buf, ntobjm_prefix, ntobjm_prefix_len_bytes) == 0) _g_win32_strip_extended_ntobjm_prefix (buf, &string_size);
{
result -= ntobjm_prefix_len_bytes;
memmove (buf, buf + ntobjm_prefix_len_unichar2, result);
}
return result; return string_size * sizeof (gunichar2);
} }
static gchar * static gchar *

8
glib/gtester-report → glib/gtester-report.in Executable file → Normal file
View File

@ -1,4 +1,4 @@
#! /usr/bin/env python #! /usr/bin/env @PYTHON@
# GLib Testing Framework Utility -*- Mode: python; -*- # GLib Testing Framework Utility -*- Mode: python; -*-
# Copyright (C) 2007 Imendio AB # Copyright (C) 2007 Imendio AB
# Authors: Tim Janik # Authors: Tim Janik
@ -28,10 +28,6 @@ except ImportError:
subunit = None subunit = None
pkginstall_configvars = {
#@PKGINSTALL_CONFIGVARS_IN24LINES@ # configvars are substituted upon script installation
}
# xml utilities # xml utilities
def find_child (node, child_name): def find_child (node, child_name):
for child in node.childNodes: for child in node.childNodes:
@ -454,7 +450,7 @@ def parse_opts():
:return: An options object and the program arguments. :return: An options object and the program arguments.
""" """
parser = optparse.OptionParser() parser = optparse.OptionParser()
parser.version = pkginstall_configvars.get ('glib-version', '0.0-uninstalled') parser.version = '@GLIB_VERSION@'
parser.usage = "%prog [OPTIONS] <gtester-log.xml>" parser.usage = "%prog [OPTIONS] <gtester-log.xml>"
parser.description = "Generate HTML reports from the XML log files generated by gtester." parser.description = "Generate HTML reports from the XML log files generated by gtester."
parser.epilog = "gtester-report (GLib utils) version %s."% (parser.version,) parser.epilog = "gtester-report (GLib utils) version %s."% (parser.version,)

View File

@ -500,7 +500,7 @@ usage (gboolean just_version)
g_print ("Help Options:\n"); g_print ("Help Options:\n");
g_print (" -h, --help Show this help message\n\n"); g_print (" -h, --help Show this help message\n\n");
g_print ("Utility Options:\n"); g_print ("Utility Options:\n");
g_print (" -v, --version Print version informations\n"); g_print (" -v, --version Print version information\n");
g_print (" --g-fatal-warnings Make warnings fatal (abort)\n"); g_print (" --g-fatal-warnings Make warnings fatal (abort)\n");
g_print (" -k, --keep-going Continue running after tests failed\n"); g_print (" -k, --keep-going Continue running after tests failed\n");
g_print (" -l List paths of available test cases\n"); g_print (" -l List paths of available test cases\n");

View File

@ -7,10 +7,18 @@ subdir('libcharset')
if not use_system_pcre if not use_system_pcre
subdir('pcre') subdir('pcre')
endif endif
# TODO: gnulib_objects, pcre_objects and pcre_deps are a workaround for
# <https://github.com/mesonbuild/meson/issues/3934> and
# <https://github.com/mesonbuild/meson/issues/3937>. When we can depend
# on a meson version where those are fixed, revert the commit that
# introduced this workaround.
if have_good_vsnprintf and have_good_snprintf if have_good_vsnprintf and have_good_snprintf
gnulib_lib = [] gnulib_lib = []
gnulib_objects = []
else else
subdir('gnulib') subdir('gnulib')
gnulib_objects = [gnulib_lib.extract_all_objects()]
endif endif
glib_headers = files( glib_headers = files(
@ -234,17 +242,25 @@ if use_pcre_static_flag
pcre_static_args = ['-DPCRE_STATIC'] pcre_static_args = ['-DPCRE_STATIC']
endif endif
if use_system_pcre
pcre_deps = [pcre]
pcre_objects = []
else
pcre_deps = []
pcre_objects = [libpcre.extract_all_objects()]
endif
libglib = library('glib-2.0', libglib = library('glib-2.0',
glib_dtrace_obj, glib_dtrace_hdr, glib_dtrace_obj, glib_dtrace_hdr,
sources : [deprecated_sources, glib_sources], sources : [deprecated_sources, glib_sources],
objects : [charset_lib.extract_all_objects()] + gnulib_objects + pcre_objects,
version : library_version, version : library_version,
soversion : soversion, soversion : soversion,
install : true, install : true,
# intl.lib is not compatible with SAFESEH # intl.lib is not compatible with SAFESEH
link_args : [noseh_link_args, glib_link_flags, win32_ldflags], link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
include_directories : configinc, include_directories : configinc,
link_with : [charset_lib, gnulib_lib], dependencies : pcre_deps + [thread_dep, libintl, librt] + libiconv + platform_deps,
dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args
) )
@ -303,7 +319,16 @@ else
dependencies : [libglib_dep]) dependencies : [libglib_dep])
endif endif
install_data('gtester-report', install_dir : get_option('bindir')) report_conf = configuration_data()
report_conf.set('GLIB_VERSION', glib_version)
report_conf.set('PYTHON', python_name)
configure_file(
input: 'gtester-report.in',
output: 'gtester-report',
install_dir: get_option('bindir'),
configuration: report_conf,
install_mode: 'rwxr-xr-x'
)
install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb')) install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))

View File

@ -1009,6 +1009,139 @@ test_fopen_modes (void)
g_free (path); g_free (path);
} }
#ifdef G_OS_WIN32
#include "../gstdio-private.c"
static int
g_wcscmp0 (const gunichar2 *str1,
const gunichar2 *str2)
{
if (!str1)
return -(str1 != str2);
if (!str2)
return str1 != str2;
return wcscmp (str1, str2);
}
#define g_assert_cmpwcs(s1, cmp, s2, s1u8, s2u8) \
G_STMT_START { \
const gunichar2 *__s1 = (s1), *__s2 = (s2); \
if (g_wcscmp0 (__s1, __s2) cmp 0) ; else \
g_assertion_message_cmpstr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
#s1u8 " " #cmp " " #s2u8, s1u8, #cmp, s2u8); \
} G_STMT_END
static void
test_win32_pathstrip (void)
{
gunichar2 *buf;
gsize i;
#define IDENTITY_TEST(x) { x, x, FALSE }
struct
{
gunichar2 *in;
gunichar2 *out;
gboolean result;
} testcases[] = {
IDENTITY_TEST (L"\\\\?\\V"),
IDENTITY_TEST (L"\\\\?\\Vo"),
IDENTITY_TEST (L"\\\\?\\Volume{0700f3d3-6d24-11e3-8b2f-806e6f6e6963}\\"),
IDENTITY_TEST (L"\\??\\V"),
IDENTITY_TEST (L"\\??\\Vo"),
IDENTITY_TEST (L"\\??\\Volume{0700f3d3-6d24-11e3-8b2f-806e6f6e6963}\\"),
IDENTITY_TEST (L"\\\\?\\\x0441:\\"),
IDENTITY_TEST (L"\\??\\\x0441:\\"),
IDENTITY_TEST (L"a:\\"),
IDENTITY_TEST (L"a:\\b\\c"),
IDENTITY_TEST (L"x"),
#undef IDENTITY_TEST
{
L"\\\\?\\c:\\",
L"c:\\",
TRUE,
},
{
L"\\\\?\\C:\\",
L"C:\\",
TRUE,
},
{
L"\\\\?\\c:\\",
L"c:\\",
TRUE,
},
{
L"\\\\?\\C:\\",
L"C:\\",
TRUE,
},
{
L"\\\\?\\C:\\",
L"C:\\",
TRUE,
},
{ 0, }
};
for (i = 0; testcases[i].in; i++)
{
gsize str_len = wcslen (testcases[i].in) + 1;
gchar *in_u8 = g_utf16_to_utf8 (testcases[i].in, -1, NULL, NULL, NULL);
gchar *out_u8 = g_utf16_to_utf8 (testcases[i].out, -1, NULL, NULL, NULL);
g_assert_nonnull (in_u8);
g_assert_nonnull (out_u8);
buf = g_new0 (gunichar2, str_len);
memcpy (buf, testcases[i].in, str_len * sizeof (gunichar2));
_g_win32_strip_extended_ntobjm_prefix (buf, &str_len);
g_assert_cmpwcs (buf, ==, testcases[i].out, in_u8, out_u8);
g_free (buf);
g_free (in_u8);
g_free (out_u8);
}
/* Check for correct behaviour on non-NUL-terminated strings */
for (i = 0; testcases[i].in; i++)
{
gsize str_len = wcslen (testcases[i].in) + 1;
wchar_t old_endchar;
gchar *in_u8 = g_utf16_to_utf8 (testcases[i].in, -1, NULL, NULL, NULL);
gchar *out_u8 = g_utf16_to_utf8 (testcases[i].out, -1, NULL, NULL, NULL);
g_assert_nonnull (in_u8);
g_assert_nonnull (out_u8);
buf = g_new0 (gunichar2, str_len);
memcpy (buf, testcases[i].in, (str_len) * sizeof (gunichar2));
old_endchar = buf[wcslen (testcases[i].out)];
str_len -= 1;
if (testcases[i].result)
{
/* Given "\\\\?\\C:\\" (len 7, unterminated),
* we should get "C:\\" (len 3, unterminated).
* Put a character different from "\\" (4-th character of the buffer)
* at the end of the unterminated source buffer, into a position
* where NUL-terminator would normally be. Then later test that 4-th character
* in the buffer is still the old "\\".
* After that terminate the string and use normal g_wcscmp0().
*/
buf[str_len] = old_endchar - 1;
}
_g_win32_strip_extended_ntobjm_prefix (buf, &str_len);
g_assert_cmpuint (old_endchar, ==, buf[wcslen (testcases[i].out)]);
buf[str_len] = L'\0';
g_assert_cmpwcs (buf, ==, testcases[i].out, in_u8, out_u8);
g_free (buf);
g_free (in_u8);
g_free (out_u8);
}
}
#endif
int int
main (int argc, main (int argc,
char *argv[]) char *argv[])
@ -1018,6 +1151,9 @@ main (int argc,
g_test_bug_base ("https://gitlab.gnome.org/GNOME/glib/merge_requests/"); g_test_bug_base ("https://gitlab.gnome.org/GNOME/glib/merge_requests/");
#ifdef G_OS_WIN32
g_test_add_func ("/fileutils/stdio-win32-pathstrip", test_win32_pathstrip);
#endif
g_test_add_func ("/fileutils/build-path", test_build_path); g_test_add_func ("/fileutils/build-path", test_build_path);
g_test_add_func ("/fileutils/build-pathv", test_build_pathv); g_test_add_func ("/fileutils/build-pathv", test_build_pathv);
g_test_add_func ("/fileutils/build-filename", test_build_filename); g_test_add_func ("/fileutils/build-filename", test_build_filename);

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()
@ -155,7 +170,7 @@ foreach test_name, extra_args : glib_tests
test_conf.set('installed_tests_dir', installed_tests_execdir) test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name) test_conf.set('program', test_name)
configure_file( configure_file(
input: installed_tests_template, input: installed_tests_template_tap,
output: test_name + '.test', output: test_name + '.test',
install_dir: installed_tests_metadir, install_dir: installed_tests_metadir,
configuration: test_conf configuration: test_conf
@ -171,7 +186,8 @@ foreach test_name, extra_args : glib_tests
suite = ['glib'] + extra_args.get('suite', []) suite = ['glib'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? 120 : 30 timeout = suite.contains('slow') ? 120 : 30
test(test_name, exe, env : test_env, timeout : timeout, suite : suite) test(test_name, exe, env : test_env, timeout : timeout, suite : suite,
args : ['--tap'])
endif endif
endforeach endforeach

View File

@ -99,7 +99,7 @@ static gint
help (gchar *arg) help (gchar *arg)
{ {
g_fprintf (stderr, "usage: gobject-query <qualifier> [-r <type>] [-{i|b} \"\"] [-s #] [-{h|x|y}]\n"); g_fprintf (stderr, "usage: gobject-query <qualifier> [-r <type>] [-{i|b} \"\"] [-s #] [-{h|x|y}]\n");
g_fprintf (stderr, " -r specifiy root type\n"); g_fprintf (stderr, " -r specify root type\n");
g_fprintf (stderr, " -n don't descend type tree\n"); g_fprintf (stderr, " -n don't descend type tree\n");
g_fprintf (stderr, " -h guess what ;)\n"); g_fprintf (stderr, " -h guess what ;)\n");
g_fprintf (stderr, " -b specify indent string\n"); g_fprintf (stderr, " -b specify indent string\n");

View File

@ -73,7 +73,7 @@ foreach test_name, extra_args : gobject_tests
test_conf.set('installed_tests_dir', installed_tests_execdir) test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name) test_conf.set('program', test_name)
configure_file( configure_file(
input: installed_tests_template, input: installed_tests_template_tap,
output: test_name + '.test', output: test_name + '.test',
install_dir: installed_tests_metadir, install_dir: installed_tests_metadir,
configuration: test_conf configuration: test_conf
@ -89,7 +89,8 @@ foreach test_name, extra_args : gobject_tests
suite = ['gobject'] + extra_args.get('suite', []) suite = ['gobject'] + extra_args.get('suite', [])
timeout = suite.contains('slow') ? 120 : 30 timeout = suite.contains('slow') ? 120 : 30
test(test_name, exe, env : test_env, timeout : timeout, suite : suite) test(test_name, exe, env : test_env, timeout : timeout, suite : suite,
args: ['--tap'])
endforeach endforeach
test( test(

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

@ -2,7 +2,7 @@
# Owen Taylor 1997-2001 # Owen Taylor 1997-2001
# Increment this whenever this file is changed. # Increment this whenever this file is changed.
#serial 1 #serial 3
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject, dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
@ -12,10 +12,16 @@ AC_DEFUN([AM_PATH_GLIB_2_0],
[dnl [dnl
dnl Get the cflags and libraries from pkg-config dnl Get the cflags and libraries from pkg-config
dnl dnl
dnl We can't use PKG_PREREQ because that needs 0.29.
m4_ifndef([PKG_PROG_PKG_CONFIG],
[pkg.m4 version 0.28 or later is required])
AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
, enable_glibtest=yes) , enable_glibtest=yes)
pkg_config_args=glib-2.0 min_glib_version=ifelse([$1], [], [2.0.0], [$1])
pkg_config_args="glib-2.0 >= $min_glib_version"
for module in . $4 for module in . $4
do do
case "$module" in case "$module" in
@ -46,7 +52,15 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
PKG_CONFIG=no PKG_CONFIG=no
fi fi
min_glib_version=ifelse([$1], ,2.0.0,$1) dnl For GLIB_CFLAGS and GLIB_LIBS
PKG_CHECK_MODULES([GLIB], [$pkg_config_args], [:], [:])
dnl For the tools
PKG_CHECK_VAR([GLIB_GENMARSHAL], [glib-2.0], [glib_genmarshal])
PKG_CHECK_VAR([GOBJECT_QUERY], [glib-2.0], [gobject_query])
PKG_CHECK_VAR([GLIB_MKENUMS], [glib-2.0], [glib_mkenums])
PKG_CHECK_VAR([GLIB_COMPILE_RESOURCES], [gio-2.0], [glib_compile_resources])
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
if test x$PKG_CONFIG != xno ; then if test x$PKG_CONFIG != xno ; then
@ -64,13 +78,6 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
fi fi
if test x"$no_glib" = x ; then if test x"$no_glib" = x ; then
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0`
GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
@ -204,11 +211,5 @@ main (void)
GLIB_COMPILE_RESOURCES="" GLIB_COMPILE_RESOURCES=""
ifelse([$3], , :, [$3]) ifelse([$3], , :, [$3])
fi fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_GENMARSHAL)
AC_SUBST(GOBJECT_QUERY)
AC_SUBST(GLIB_MKENUMS)
AC_SUBST(GLIB_COMPILE_RESOURCES)
rm -f conf.glibtest rm -f conf.glibtest
]) ])

View File

@ -1,5 +1,5 @@
# Increment this whenever this file is changed. # Increment this whenever this file is changed.
#serial 1 #serial 2
dnl GLIB_GSETTINGS dnl GLIB_GSETTINGS
dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
@ -8,6 +8,10 @@ dnl
AC_DEFUN([GLIB_GSETTINGS], AC_DEFUN([GLIB_GSETTINGS],
[ [
dnl We can't use PKG_PREREQ because that needs 0.29.
m4_ifndef([PKG_PROG_PKG_CONFIG],
[pkg.m4 version 0.28 or later is required])
m4_pattern_allow([AM_V_GEN]) m4_pattern_allow([AM_V_GEN])
AC_ARG_ENABLE(schemas-compile, AC_ARG_ENABLE(schemas-compile,
AS_HELP_STRING([--disable-schemas-compile], AS_HELP_STRING([--disable-schemas-compile],
@ -20,11 +24,9 @@ AC_DEFUN([GLIB_GSETTINGS],
AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE]) AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
PKG_PROG_PKG_CONFIG([0.16]) PKG_PROG_PKG_CONFIG([0.16])
AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas]) AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
if test x$cross_compiling != xyes; then AS_IF([test x$cross_compiling != xyes],
GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0` [PKG_CHECK_VAR([GLIB_COMPILE_SCHEMAS], [gio-2.0], [glib_compile_schemas])],
else [AC_PATH_PROG([GLIB_COMPILE_SCHEMAS], [glib-compile-schemas])])
AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
fi
AC_SUBST(GLIB_COMPILE_SCHEMAS) AC_SUBST(GLIB_COMPILE_SCHEMAS)
if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2]) ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])

View File

@ -71,6 +71,7 @@ installed_tests_metadir = join_paths(glib_datadir, 'installed-tests', meson.proj
installed_tests_execdir = join_paths(glib_libexecdir, 'installed-tests', meson.project_name()) installed_tests_execdir = join_paths(glib_libexecdir, 'installed-tests', meson.project_name())
installed_tests_enabled = get_option('installed_tests') installed_tests_enabled = get_option('installed_tests')
installed_tests_template = files('template.test.in') installed_tests_template = files('template.test.in')
installed_tests_template_tap = files('template-tap.test.in')
add_project_arguments('-D_GNU_SOURCE', language: 'c') add_project_arguments('-D_GNU_SOURCE', language: 'c')
@ -226,6 +227,7 @@ headers = [
'poll.h', 'poll.h',
'pwd.h', 'pwd.h',
'sched.h', 'sched.h',
'spawn.h',
'stdint.h', 'stdint.h',
'stdlib.h', 'stdlib.h',
'string.h', 'string.h',
@ -352,7 +354,6 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
'-Wno-bad-function-cast', '-Wno-bad-function-cast',
'-Werror=declaration-after-statement', '-Werror=declaration-after-statement',
'-Werror=format=2', '-Werror=format=2',
'-Werror=format-security',
'-Werror=implicit-function-declaration', '-Werror=implicit-function-declaration',
'-Werror=init-self', '-Werror=init-self',
'-Werror=missing-include-dirs', '-Werror=missing-include-dirs',
@ -386,7 +387,6 @@ if host_system == 'windows'
endif endif
functions = [ functions = [
'alloca',
'endmntent', 'endmntent',
'endservent', 'endservent',
'fallocate', 'fallocate',
@ -739,12 +739,14 @@ if cc.compiles('''#include <fcntl.h>
endif endif
# Check whether there is a vsnprintf() function with C99 semantics installed. # Check whether there is a vsnprintf() function with C99 semantics installed.
# AC_FUNC_VSNPRINTF_C99 # (similar tests to AC_FUNC_VSNPRINTF_C99)
# Check whether there is a snprintf() function with C99 semantics installed. # Check whether there is a snprintf() function with C99 semantics installed.
# AC_FUNC_SNPRINTF_C99 # (similar tests to AC_FUNC_SNPRINTF_C99)
# Check whether there is a printf() function with Unix98 semantics installed.
# (similar tests to AC_FUNC_PRINTF_UNIX98)
have_good_vsnprintf = false have_good_vsnprintf = false
have_good_snprintf = false have_good_snprintf = false
have_good_printf = false
if host_system == 'windows' and cc.get_id() == 'msvc' if host_system == 'windows' and cc.get_id() == 'msvc'
# Unfortunately the Visual Studio 2015+ implementations of C99-style # Unfortunately the Visual Studio 2015+ implementations of C99-style
@ -755,6 +757,7 @@ if host_system == 'windows' and cc.get_id() == 'msvc'
# rigorous enough to notice, though. # rigorous enough to notice, though.
glib_conf.set('HAVE_C99_SNPRINTF', false) glib_conf.set('HAVE_C99_SNPRINTF', false)
glib_conf.set('HAVE_C99_VSNPRINTF', false) glib_conf.set('HAVE_C99_VSNPRINTF', false)
glib_conf.set('HAVE_UNIX98_PRINTF', false)
else else
vsnprintf_c99_test_code = ''' vsnprintf_c99_test_code = '''
#include <stdio.h> #include <stdio.h>
@ -851,6 +854,31 @@ main(void)
have_good_snprintf = meson.get_cross_property('have_c99_snprintf', false) have_good_snprintf = meson.get_cross_property('have_c99_snprintf', false)
glib_conf.set('HAVE_C99_SNPRINTF', have_good_snprintf) glib_conf.set('HAVE_C99_SNPRINTF', have_good_snprintf)
endif endif
printf_unix98_test_code = '''
#include <stdio.h>
int
main (void)
{
char buffer[128];
sprintf (buffer, "%2\$d %3\$d %1\$d", 1, 2, 3);
if (strcmp ("2 3 1", buffer) == 0)
exit (0);
exit (1);
}'''
if cc_can_run
rres = cc.run(printf_unix98_test_code, name : 'Unix98 printf positional parameters')
if rres.compiled() and rres.returncode() == 0
glib_conf.set('HAVE_UNIX98_PRINTF', 1)
have_good_printf = true
endif
else
have_good_printf = meson.get_cross_property('have_unix98_printf', false)
glib_conf.set('HAVE_UNIX98_PRINTF', have_good_printf)
endif
endif endif
if host_system == 'windows' if host_system == 'windows'
@ -859,20 +887,22 @@ else
glib_conf.set('EXEEXT', '') glib_conf.set('EXEEXT', '')
endif endif
if have_good_vsnprintf and have_good_snprintf if have_good_vsnprintf and have_good_snprintf and have_good_printf
# Our printf is 'good' only if vsnpintf()/snprintf() supports C99 well enough # Our printf is 'good' only if vsnpintf()/snprintf()/printf() supports C99 well enough
glib_conf.set('HAVE_GOOD_PRINTF', 1) # FIXME: Check for HAVE_UNIX98_PRINTF? glib_conf.set('HAVE_GOOD_PRINTF', 1)
else else
glib_conf.set('HAVE_VASPRINTF', 1) glib_conf.set('HAVE_VASPRINTF', 1)
endif endif
glibconfig_conf.set('GLIB_USING_SYSTEM_PRINTF',
have_good_vsnprintf and have_good_snprintf and have_good_printf)
# Check whether the printf() family supports Unix98 %n$ positional parameters # Check whether the printf() family supports Unix98 %n$ positional parameters
# AC_FUNC_PRINTF_UNIX98 # AC_FUNC_PRINTF_UNIX98
# Nothing uses HAVE_UNIX98_PRINTF # Nothing uses HAVE_UNIX98_PRINTF
# Check for nl_langinfo and CODESET # Check for nl_langinfo and CODESET
# FIXME: Check for HAVE_BIND_TEXTDOMAIN_CODESET
if cc.links('''#include <langinfo.h> if cc.links('''#include <langinfo.h>
int main (int argc, char ** argv) { int main (int argc, char ** argv) {
char *codeset = nl_langinfo (CODESET); char *codeset = nl_langinfo (CODESET);
@ -1494,8 +1524,6 @@ foreach d : inet_defines
glibconfig_conf.set(d[1], val) glibconfig_conf.set(d[1], val)
endforeach endforeach
glibconfig_conf.set('GLIB_USING_SYSTEM_PRINTF', true) # FIXME!
# We need a more robust approach here... # We need a more robust approach here...
host_cpu_family = host_machine.cpu_family() host_cpu_family = host_machine.cpu_family()
if host_cpu_family == 'x86' or host_cpu_family == 'x86_64' or host_cpu_family == 's390' or host_cpu_family == 's390x' or host_cpu_family.startswith('arm') or host_cpu_family.startswith('crisv32') or host_cpu_family.startswith('etrax') if host_cpu_family == 'x86' or host_cpu_family == 'x86_64' or host_cpu_family == 's390' or host_cpu_family == 's390x' or host_cpu_family.startswith('arm') or host_cpu_family.startswith('crisv32') or host_cpu_family.startswith('etrax')
@ -1634,7 +1662,7 @@ else
growing_stack = meson.get_cross_property('growing_stack', false) growing_stack = meson.get_cross_property('growing_stack', false)
endif endif
glibconfig_conf.set('G_HAVE_GROWING_STACK', growing_stack) glibconfig_conf.set10('G_HAVE_GROWING_STACK', growing_stack)
# Tests for iconv # Tests for iconv
# #
@ -1746,13 +1774,20 @@ endif
# implementations. This could be extended if issues are found in some platforms. # implementations. This could be extended if issues are found in some platforms.
if cc.has_function('ngettext') if cc.has_function('ngettext')
libintl = [] libintl = []
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
else else
libintl = cc.find_library('intl', required : false) libintl = cc.find_library('intl', required : false)
if not libintl.found() if not libintl.found()
libintl = subproject('proxy-libintl').get_variable('intl_dep') libintl = subproject('proxy-libintl').get_variable('intl_dep')
have_bind_textdomain_codeset = true # proxy-libintl supports it
else
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset',
dependencies : libintl)
endif endif
endif endif
glib_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
# We require gettext to always be present # We require gettext to always be present
glib_conf.set('HAVE_DCGETTEXT', 1) glib_conf.set('HAVE_DCGETTEXT', 1)
glib_conf.set('HAVE_GETTEXT', 1) glib_conf.set('HAVE_GETTEXT', 1)
@ -1845,15 +1880,8 @@ python_name = 'python3'
# Determine which user environment-dependent files that we want to install # Determine which user environment-dependent files that we want to install
have_bash = find_program('bash', required : false).found() # For completion scripts have_bash = find_program('bash', required : false).found() # For completion scripts
have_m4 = find_program('m4', required : false).found() # For m4 macros
have_sh = find_program('sh', required : false).found() # For glib-gettextize have_sh = find_program('sh', required : false).found() # For glib-gettextize
# FIXME: defines in config.h that are not actually used anywhere
# (we add them for now to minimise the diff)
glib_conf.set('HAVE_DLFCN_H', 1)
glib_conf.set('STDC_HEADERS', 1)
glib_conf.set('SIZEOF___INT64', 8)
# FIXME: How to detect Solaris? https://github.com/mesonbuild/meson/issues/1578 # FIXME: How to detect Solaris? https://github.com/mesonbuild/meson/issues/1578
if host_system == 'sunos' if host_system == 'sunos'
glib_conf.set('_XOPEN_SOURCE_EXTENDED', 1) glib_conf.set('_XOPEN_SOURCE_EXTENDED', 1)
@ -1963,11 +1991,9 @@ if have_sh
configuration : gettextize_conf) configuration : gettextize_conf)
endif endif
if have_m4 # Install m4 macros that other projects use
# Install m4 macros that other projects use install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4',
install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4', install_dir : join_paths(get_option('datadir'), 'aclocal'))
install_dir : join_paths(get_option('datadir'), 'aclocal'))
endif
if host_system != 'windows' if host_system != 'windows'
# Install Valgrind suppression file (except on Windows, # Install Valgrind suppression file (except on Windows,

4
template-tap.test.in Normal file
View File

@ -0,0 +1,4 @@
[Test]
Type=session
Exec=@installed_tests_dir@/@program@ --tap
Output=TAP

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

@ -51,24 +51,20 @@ if ENABLE_TIMELOOP
installed_test_programs += timeloop-closure installed_test_programs += timeloop-closure
endif endif
# The marshal test requires running a binary, which means we cannot
# build it when cross-compiling
if !CROSS_COMPILING
glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal
testmarshal.h: stamp-testmarshal.h testmarshal.h: stamp-testmarshal.h
@true @true
stamp-testmarshal.h: testmarshal.list $(glib_genmarshal) stamp-testmarshal.h: testmarshal.list $(glib_genmarshal)
$(AM_V_GEN) $(glib_genmarshal) --prefix=test_marshal $(srcdir)/testmarshal.list --header >> xgen-gmh \ $(AM_V_GEN) $(PYTHON) $(glib_genmarshal) --prefix=test_marshal $(srcdir)/testmarshal.list --header >> xgen-gmh \
&& (cmp -s xgen-gmh testmarshal.h 2>/dev/null || cp xgen-gmh testmarshal.h) \ && (cmp -s xgen-gmh testmarshal.h 2>/dev/null || cp xgen-gmh testmarshal.h) \
&& rm -f xgen-gmh xgen-gmh~ \ && rm -f xgen-gmh xgen-gmh~ \
&& echo timestamp > $@ && echo timestamp > $@
testmarshal.c: testmarshal.h testmarshal.list $(glib_genmarshal) testmarshal.c: testmarshal.h testmarshal.list $(glib_genmarshal)
$(AM_V_GEN) (echo "#include \"testmarshal.h\""; $(glib_genmarshal) --prefix=test_marshal $(srcdir)/testmarshal.list --body) >> xgen-gmc \ $(AM_V_GEN) (echo "#include \"testmarshal.h\""; $(PYTHON) $(glib_genmarshal) --prefix=test_marshal $(srcdir)/testmarshal.list --body) >> xgen-gmc \
&& cp xgen-gmc testmarshal.c \ && cp xgen-gmc testmarshal.c \
&& rm -f xgen-gmc xgen-gmc~ && rm -f xgen-gmc xgen-gmc~
BUILT_SOURCES += testmarshal.h testmarshal.c BUILT_SOURCES += testmarshal.h testmarshal.c
CLEANFILES += stamp-testmarshal.h testmarshal.h testmarshal.c CLEANFILES += stamp-testmarshal.h testmarshal.h testmarshal.c
EXTRA_DIST += testcommon.h testmarshal.list EXTRA_DIST += testcommon.h testmarshal.list
endif # !CROSS_COMPILING

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,80 @@ testmarshal_c = custom_target('testmarshal_c',
], ],
) )
gobject_tests += [ # FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
['accumulator', ['accumulator.c', testmarshal_c, testmarshal_h]], # that supports '+=' operator on dictionnaries.
] gobject_tests = [{
'gvalue-test' : {'tap' : true},
'paramspec-test' : {'tap' : true},
'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 if host_system != 'windows'
test_name = t.get(0) gobject_tests += [{
test_src = t.get(1, test_name + '.c') 'timeloop-closure' : {},
test_extra_cargs = t.get(2, []) }]
test_timeout = t.get(3, 30) endif
test_suite = test_timeout == 30 ? ['gobject'] : ['gobject', 'slow']
# FIXME? $(GLIB_DEBUG_FLAGS) common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
exe = executable(test_name + '-gobject', test_src, common_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep], foreach test_dict : gobject_tests
install : false, foreach test_name, extra_args : test_dict
) source = extra_args.get('source', test_name + '.c')
# FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset extra_sources = extra_args.get('extra_sources', [])
test(test_name, exe, env : test_env, timeout : test_timeout, suite : test_suite) install = installed_tests_enabled and extra_args.get('install', true)
template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template
test_command_args = extra_args.get('tap', false) ? ['--tap'] : []
if install
test_conf = configuration_data()
test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name)
configure_file(
input: 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', []),
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
test(test_name, exe, env : test_env, timeout : timeout, suite : suite,
args : test_command_args)
endforeach
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'
executable('timeloop-closure', 'timeloop-closure.c',
c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
install : false)
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,147 @@
# 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' : {'tap' : true},
'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)
template = extra_args.get('tap', false) ? installed_tests_template_tap : installed_tests_template
test_command_args = extra_args.get('tap', false) ? ['--tap'] : []
if install
test_conf = configuration_data()
test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name)
configure_file(
input: 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,
args : test_command_args)
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', []], '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,7 @@
static gint exit_status = 0; static gint exit_status = 0;
G_GNUC_PRINTF (1, 2)
static void static void
croak (char *format, ...) croak (char *format, ...)
{ {
@ -21,6 +22,7 @@ croak (char *format, ...)
exit (1); exit (1);
} }
G_GNUC_PRINTF (1, 2)
static void static void
fail (char *format, ...) fail (char *format, ...)
{ {