diff --git a/README.win32 b/README.win32
index 1683d54b9..62236d016 100644
--- a/README.win32
+++ b/README.win32
@@ -145,8 +145,7 @@ prebuilt binaries are included in the "dev" packages.
Please note that the ./configure mechanism should not blindly be used
to build a GLib to be distributed to other developers because it
-produces a compiler-dependent glibconfig.h. For instance, the typedef
-for gint64 is long long with gcc, but __int64 with MSVC.
+produces a compiler-dependent glibconfig.h.
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
diff --git a/configure.ac b/configure.ac
index 37b2f4858..5a1cab287 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
# Checks for library functions.
-AC_FUNC_ALLOCA
AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 issetugid)
AC_CHECK_FUNCS(timegm gmtime_r posix_spawn)
AC_FUNC_STRERROR_R()
@@ -534,8 +533,6 @@ AS_IF([test x$ac_cv_sizeof_long_long = x8], [
], [AC_MSG_RESULT(none)])
])
-AC_C_CONST
-
dnl
dnl check in which direction the stack grows
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([linux/magic.h])
AC_CHECK_HEADERS([termios.h])
+AC_CHECK_HEADERS([alloca.h])
+AC_CHECK_HEADERS([spawn.h])
# Some versions of MSC lack these
AC_CHECK_HEADERS([dirent.h sys/time.h])
@@ -1788,9 +1787,13 @@ fi
])
if test x$have_libmount = xyes; then
+ LIBMOUNT_REQUIRES="mount >= 2.23"
AC_DEFINE(HAVE_LIBMOUNT, 1, [Define if libmount is available])
+else
+ LIBMOUNT_REQUIRES=""
fi
AM_CONDITIONAL(HAVE_LIBMOUNT, [test x$have_libmount = xyes])
+AC_SUBST([LIBMOUNT_REQUIRES])
dnl ****************************************
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
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
with the right compiler. Ususally just '_r' is appended
to the compiler name."
@@ -2985,10 +2988,8 @@ _______EOF
# on variable expansion in case labels. Look at the generated config.status
# for a hint.
-if test "x${ac_cv_working_alloca_h+set}" = xset ; then
- glib_header_alloca_h="$ac_cv_working_alloca_h"
-else
- glib_header_alloca_h="$ac_cv_header_alloca_h"
+if test x$ac_cv_header_alloca_h = xyes ; then
+ glib_header_alloca_h=yes
fi
if test x$enable_included_printf = xyes ; then
@@ -3412,7 +3413,7 @@ AS_IF([test "x$enable_compile_warnings" != xno], [
-Wno-bad-function-cast \
-Werror=declaration-after-statement \
-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])
])
AC_SUBST(GLIB_WARN_CFLAGS)
diff --git a/docs/reference/gio/gdbus-codegen.xml b/docs/reference/gio/gdbus-codegen.xml
index e4192084d..fdd367bc5 100644
--- a/docs/reference/gio/gdbus-codegen.xml
+++ b/docs/reference/gio/gdbus-codegen.xml
@@ -869,7 +869,7 @@ my_app_frobber_proxy_new_sync (GDBusConnection *connection,
subclass. For example, to handle
HelloWorld() method invocations, set the
vfunc for handle_hello_hello_world() in the
- MyAppFrobberIface structure. Similary, to handle
+ MyAppFrobberIface structure. Similarly, to handle
the net.Corp.MyApp.Frobber:Verbose
property override the :verbose #GObject
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
thread-default main loop
of the thread where the skeleton object was
- contructed) and will cause emissions of the org.freedesktop.DBus.Properties::PropertiesChanged
signal with all the properties that have changed. Use
g_dbus_interface_skeleton_flush() or
diff --git a/docs/reference/gio/gio.xml b/docs/reference/gio/gio.xml
index f2635d0b3..c348c43e5 100644
--- a/docs/reference/gio/gio.xml
+++ b/docs/reference/gio/gio.xml
@@ -374,7 +374,7 @@
,
- Monitor the file directly. This allows to capture changes made via hardlinks.
+ Monitor the file directly. This allows changes made via hardlinks to be captured.
,
@@ -599,7 +599,7 @@
VALUE
- Allows to set a file attribute on a file.
+ Sets a file attribute on a file.
File attributes can be specified with their GIO name, e.g
standard::icon. Note that not all GIO file attributes are writable.
Use the --query-writable option of the info command to list
diff --git a/docs/reference/gio/meson.build b/docs/reference/gio/meson.build
index c7ca62abb..f1880cc0c 100644
--- a/docs/reference/gio/meson.build
+++ b/docs/reference/gio/meson.build
@@ -221,8 +221,8 @@ if get_option('gtk_doc')
],
fixxref_args: [
'--html-dir=' + docpath,
- '--extra-dir=' + join_paths(meson.current_build_dir(), '../glib/html'),
- '--extra-dir=' + join_paths(meson.current_build_dir(), '../gobject/html'),
+ '--extra-dir=' + join_paths('gio', '..', 'glib', 'html'),
+ '--extra-dir=' + join_paths('gio', '..', 'gobject', 'html'),
],
install: true
)
diff --git a/docs/reference/glib/cross.xml b/docs/reference/glib/cross.xml
index c45200437..aba4c75ef 100644
--- a/docs/reference/glib/cross.xml
+++ b/docs/reference/glib/cross.xml
@@ -84,8 +84,8 @@ meson --cross_file cross_file.txt builddir
overridden by setting the
have_function property
to true or false.
- For example Checking for function "alloca" : YES
- can be overridden by setting have_alloca = false
+ For example Checking for function "fsync" : YES
+ can be overridden by setting have_fsync = false
diff --git a/docs/reference/glib/meson.build b/docs/reference/glib/meson.build
index fbe3422d0..f14824bff 100644
--- a/docs/reference/glib/meson.build
+++ b/docs/reference/glib/meson.build
@@ -140,7 +140,6 @@ if get_option('gtk_doc')
],
fixxref_args: [
'--html-dir=' + docpath,
- # TODO: gobject/gio extra dirs
],
install: true)
endif
diff --git a/docs/reference/gobject/glib-mkenums.xml b/docs/reference/gobject/glib-mkenums.xml
index a59cacf43..2573bb3e9 100644
--- a/docs/reference/gobject/glib-mkenums.xml
+++ b/docs/reference/gobject/glib-mkenums.xml
@@ -253,7 +253,7 @@ will be appended to the template's file-tail section.
TEXT
-Emits TEXT everytime an enum is encountered
+Emits TEXT every time an enum is encountered
in the input files.
@@ -333,7 +333,7 @@ where section may be file-header,
PREFIX
-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 "Gtk" in
"GtkDirectionType"). Normally this will be figured
out automatically, but you may need to override the default if your
diff --git a/docs/reference/gobject/meson.build b/docs/reference/gobject/meson.build
index ac2da57d9..014fe5405 100644
--- a/docs/reference/gobject/meson.build
+++ b/docs/reference/gobject/meson.build
@@ -103,7 +103,7 @@ if get_option('gtk_doc')
],
fixxref_args: [
'--html-dir=' + docpath,
- '--extra-dir=' + join_paths(meson.current_build_dir(), '../glib/html'),
+ '--extra-dir=' + join_paths('gobject', '..', 'glib', 'html'),
],
install: true
)
diff --git a/gio-2.0.pc.in b/gio-2.0.pc.in
index afd3a40a6..d67e80839 100644
--- a/gio-2.0.pc.in
+++ b/gio-2.0.pc.in
@@ -15,7 +15,7 @@ Name: GIO
Description: glib I/O library
Version: @VERSION@
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.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:
diff --git a/gio/Makefile.am b/gio/Makefile.am
index e14cad229..fc0b91855 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -990,6 +990,7 @@ gio_SOURCES = \
$(NULL)
gio_LDADD = libgio-2.0.la \
$(top_builddir)/gobject/libgobject-2.0.la \
+ $(top_builddir)/gmodule/libgmodule-2.0.la \
$(top_builddir)/glib/libglib-2.0.la \
$(NULL)
diff --git a/gio/completion/gio b/gio/completion/gio
old mode 100755
new mode 100644
diff --git a/gio/gdbus-2.0/codegen/codegen_main.py b/gio/gdbus-2.0/codegen/codegen_main.py
old mode 100755
new mode 100644
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 543ca0b2d..7270365b6 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -3088,7 +3088,7 @@ static volatile guint _global_filter_id = 1;
* dispatched anywhere else - not even the standard dispatch machinery
* (that API such as g_dbus_connection_signal_subscribe() and
* 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.
*
* If @user_data_free_func is non-%NULL, it will be called (in the
diff --git a/gio/gfileinfo-priv.h b/gio/gfileinfo-priv.h
index 201b8c946..e2bdaa33d 100644
--- a/gio/gfileinfo-priv.h
+++ b/gio/gfileinfo-priv.h
@@ -85,6 +85,8 @@
#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_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_REAL (9437184 + 2)
#define G_FILE_ATTRIBUTE_ID_OWNER_GROUP (9437184 + 3)
diff --git a/gio/gfileinfo.c b/gio/gfileinfo.c
index a595c6f4a..fa53a9c49 100644
--- a/gio/gfileinfo.c
+++ b/gio/gfileinfo.c
@@ -245,6 +245,8 @@ ensure_attribute_hash (void)
REGISTER_ATTRIBUTE (UNIX_IS_MOUNTPOINT);
REGISTER_ATTRIBUTE (DOS_IS_ARCHIVE);
REGISTER_ATTRIBUTE (DOS_IS_SYSTEM);
+ REGISTER_ATTRIBUTE (DOS_IS_MOUNTPOINT);
+ REGISTER_ATTRIBUTE (DOS_REPARSE_POINT_TAG);
REGISTER_ATTRIBUTE (OWNER_USER);
REGISTER_ATTRIBUTE (OWNER_USER_REAL);
REGISTER_ATTRIBUTE (OWNER_GROUP);
diff --git a/gio/gfileinfo.h b/gio/gfileinfo.h
index 8416b4fad..2ca623c3a 100644
--- a/gio/gfileinfo.h
+++ b/gio/gfileinfo.h
@@ -672,6 +672,33 @@ typedef struct _GFileInfoClass GFileInfoClass;
**/
#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 */
/**
diff --git a/gio/gio-tool.c b/gio/gio-tool.c
index 18200014c..847a2188b 100644
--- a/gio/gio-tool.c
+++ b/gio/gio-tool.c
@@ -115,7 +115,7 @@ attribute_type_to_string (GFileAttributeType type)
case G_FILE_ATTRIBUTE_TYPE_OBJECT:
return "object";
default:
- return "uknown type";
+ return "unknown type";
}
}
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 58802fd43..ed7e99400 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -1867,6 +1867,12 @@ _g_local_file_info_get (const char *basename,
if (statbuf.attributes & FILE_ATTRIBUTE_SYSTEM)
_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
symlink_target = NULL;
diff --git a/gio/gunionvolumemonitor.c b/gio/gunionvolumemonitor.c
index 8e58d18ed..eeb4c5ffc 100644
--- a/gio/gunionvolumemonitor.c
+++ b/gio/gunionvolumemonitor.c
@@ -621,7 +621,7 @@ _g_mount_get_for_mount_path (const gchar *mount_path,
* also listen for the "removed" signal on the returned object
* 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
* its g_volume_get_mount() implemented. Also, the implementor must
* listen for the "unmounted" signal on @mount and give up its
diff --git a/gio/meson.build b/gio/meson.build
index b83d8f5f3..7f2c08e30 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -351,6 +351,12 @@ local_sources = files(
platform_deps = []
internal_deps = []
+# TODO: internal_objects is a workaround for
+# and
+# . When we can depend
+# on a meson version where those are fixed, revert the commit that
+# introduced this workaround.
+internal_objects = []
appinfo_sources = []
contenttype_sources = []
portal_sources = []
@@ -424,6 +430,7 @@ if host_system != 'windows'
subdir('xdgmime')
internal_deps += [xdgmime_lib]
+ internal_objects += [xdgmime_lib.extract_all_objects()]
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
subdir('inotify')
internal_deps += [ inotify_lib ]
+ internal_objects += [inotify_lib.extract_all_objects()]
endif
# kevent
if have_func_kqueue and have_func_kevent
subdir('kqueue')
internal_deps += [ kqueue_lib ]
+ internal_objects += [kqueue_lib.extract_all_objects()]
endif
if host_system == 'windows'
subdir('win32')
internal_deps += [ giowin32_lib ]
+ internal_objects += [giowin32_lib.extract_all_objects()]
endif
if have_bash
@@ -784,11 +794,11 @@ endif
libgio = library('gio-2.0',
gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources,
gio_dtrace_hdr, gio_dtrace_obj,
+ objects : internal_objects,
version : library_version,
soversion : soversion,
install : true,
include_directories : [configinc, gioinc],
- link_with : internal_deps,
# '$(gio_win32_res_ldflag)',
dependencies : [libz_dep, libdl_dep, libmount_dep, libglib_dep,
libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,
@@ -979,7 +989,4 @@ if enable_systemtap
endif
subdir('fam')
-
-if host_system != 'windows'
- subdir('tests')
-endif
+subdir('tests')
diff --git a/gio/tests/desktop-files/usr/applications/org.gnome.clocks.desktop b/gio/tests/desktop-files/usr/applications/org.gnome.clocks.desktop
old mode 100755
new mode 100644
diff --git a/gio/tests/g-file-info.c b/gio/tests/g-file-info.c
index 5b3def91c..28a2426a8 100644
--- a/gio/tests/g-file-info.c
+++ b/gio/tests/g-file-info.c
@@ -29,8 +29,9 @@
#ifdef G_OS_WIN32
#include
#include
-#include
-#include
+#include
+#include
+#include /* for _get_osfhandle */
#endif
#define TEST_NAME "Prilis zlutoucky kun"
@@ -180,16 +181,24 @@ test_internal_enhanced_stdio (void)
gchar *programdata;
gchar *users_dir;
gchar *allusers;
- GFile *gf_programdata, *gf_allusers;
- GFileInfo *fi_programdata, *fi_allusers, *fi_allusers_target;
+ gchar *commondata;
+ 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_target;
GFileType ft_programdata;
+ GFileType ft_commondata;
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_target;
+ const gchar *id_commondata_target;
const gchar *id_programdata;
const gchar *allusers_target;
+ const gchar *commondata_target;
/* C:/ProgramData */
programdata = g_utf16_to_utf8 (programdata_dir_w, -1, NULL, NULL, NULL);
@@ -201,7 +210,11 @@ test_internal_enhanced_stdio (void)
* for "C:/ProgramData".
*/
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,
* 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_allusers = g_file_new_for_path (allusers);
+ gf_commondata = g_file_new_for_path (commondata);
fi_programdata = g_file_query_info (gf_programdata,
G_FILE_ATTRIBUTE_ID_FILE ","
@@ -229,52 +243,99 @@ test_internal_enhanced_stdio (void)
fi_allusers = g_file_query_info (gf_allusers,
G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET ","
G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK ","
+ 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_programdata, G_FILE_ATTRIBUTE_ID_FILE));
- g_assert (g_file_info_has_attribute (fi_programdata, G_FILE_ATTRIBUTE_STANDARD_TYPE));
+ fi_commondata = g_file_query_info (gf_commondata,
+ 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));
- g_assert (g_file_info_has_attribute (fi_allusers_target, G_FILE_ATTRIBUTE_STANDARD_TYPE));
+ fi_commondata_target = g_file_query_info (gf_commondata,
+ 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 (g_file_info_has_attribute (fi_allusers, 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_programdata, G_FILE_ATTRIBUTE_ID_FILE));
+ g_assert_true (g_file_info_has_attribute (fi_programdata, G_FILE_ATTRIBUTE_STANDARD_TYPE));
+
+ 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_target = g_file_info_get_file_type (fi_allusers_target);
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 (ft_allusers_target == G_FILE_TYPE_DIRECTORY);
- g_assert (ft_programdata == G_FILE_TYPE_DIRECTORY);
+ g_assert_cmpint (ft_allusers, ==, G_FILE_TYPE_SYMBOLIC_LINK);
+ g_assert_cmpint (ft_allusers_target, ==, 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_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_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_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);
g_assert_cmpstr (id_allusers_target, ==, id_programdata);
+ g_assert_cmpstr (id_commondata_target, ==, id_programdata);
g_assert_cmpstr (id_allusers, !=, id_programdata);
allusers_target = g_file_info_get_symlink_target (fi_allusers);
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_target);
+ g_object_unref (fi_commondata);
+ g_object_unref (fi_commondata_target);
g_object_unref (fi_programdata);
g_object_unref (gf_allusers);
+ g_object_unref (gf_commondata);
g_object_unref (gf_programdata);
g_free (allusers);
+ g_free (commondata);
g_free (users_dir);
g_free (programdata);
}
@@ -325,7 +386,7 @@ test_internal_enhanced_stdio (void)
g_assert_nonnull (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;
g_assert_true (DeviceIoControl (h,
@@ -364,8 +425,8 @@ test_internal_enhanced_stdio (void)
g_remove (ps);
- g_assert (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_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);
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);
h = (HANDLE) _get_osfhandle (fileno (f));
- g_assert (h != INVALID_HANDLE_VALUE);
+ g_assert_cmpuint ((guintptr) h, !=, (guintptr) INVALID_HANDLE_VALUE);
fprintf (f, "1");
fflush (f);
@@ -443,15 +504,15 @@ test_internal_enhanced_stdio (void)
G_FILE_QUERY_INFO_NONE,
NULL, NULL);
- g_assert (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 (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_STANDARD_SIZE));
+ g_assert_true (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_ID_FILE));
+ 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 (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 (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_STANDARD_SIZE));
+ g_assert_true (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_ID_FILE));
+ 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);
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.
* 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);
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),
* 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_p1);
diff --git a/gio/tests/gdbus-object-manager-example/meson.build b/gio/tests/gdbus-object-manager-example/meson.build
index 90dcc1f93..6b27576e8 100644
--- a/gio/tests/gdbus-object-manager-example/meson.build
+++ b/gio/tests/gdbus-object-manager-example/meson.build
@@ -14,11 +14,12 @@ gdbus_example_objectmanager_generated = custom_target('gdbus-example-objectmanag
'--generate-docbook', 'gdbus-example-objectmanager-generated',
'@INPUT@'])
-libgdbus_example_objectmanager = library('libgdbus-example-objectmanager',
+libgdbus_example_objectmanager = library('gdbus-example-objectmanager',
gdbus_example_objectmanager_generated,
c_args : gio_c_args,
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,
link_with : libgdbus_example_objectmanager)
diff --git a/gio/tests/gdbus-serialization.c b/gio/tests/gdbus-serialization.c
index d2f0a6ce7..2ab856c48 100644
--- a/gio/tests/gdbus-serialization.c
+++ b/gio/tests/gdbus-serialization.c
@@ -22,7 +22,9 @@
#include
#include
+#ifndef _MSC_VER
#include
+#endif
#include
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/tests/gdbus-tests.c b/gio/tests/gdbus-tests.c
index 0655f1be4..35e379bd2 100644
--- a/gio/tests/gdbus-tests.c
+++ b/gio/tests/gdbus-tests.c
@@ -19,7 +19,9 @@
*/
#include
+#ifndef _MSC_VER
#include
+#endif
#include "gdbus-tests.h"
diff --git a/gio/tests/meson.build b/gio/tests/meson.build
index 4e5ad25df..801d52c2c 100644
--- a/gio/tests/meson.build
+++ b/gio/tests/meson.build
@@ -5,6 +5,10 @@ common_gio_tests_deps = [
libgio_dep,
]
+if host_machine.system() == 'windows'
+ common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')]
+endif
+
subdir('gdbus-object-manager-example')
gengiotypefuncs_prog = find_program('gengiotypefuncs.py')
@@ -75,6 +79,7 @@ gio_tests = [{
test_extra_programs = [{
'gdbus-connection-flush-helper' : {},
'gdbus-testserver' : {},
+ 'gsubprocess-testprog' : {},
}]
test_env = environment()
@@ -139,9 +144,11 @@ if host_machine.system() != 'windows'
gio_tests += [{
'appinfo' : {
'install' : false,
+ 'is_parallel' : false,
},
'desktop-app-info' : {
'install' : false,
+ 'is_parallel' : false,
},
}]
endif
@@ -221,7 +228,10 @@ if host_machine.system() != 'windows'
'extra_sources' : extra_sources,
'suite' : ['slow'],
},
- 'gmenumodel' : {'extra_sources' : extra_sources},
+ 'gmenumodel' : {
+ 'extra_sources' : extra_sources,
+ 'suite' : ['slow'],
+ },
'gnotification' : {
'extra_sources' : [extra_sources, 'gnotification-server.c'],
},
@@ -246,9 +256,10 @@ if host_machine.system() != 'windows'
# This test is currently unreliable
executable('gdbus-overflow', 'gdbus-overflow.c',
- install : false,
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 += [{
'gdbus-connection-flush' : {
@@ -310,7 +321,6 @@ test_extra_programs += [{
'gdbus-example-subtree' : {'install' : false},
'gdbus-example-watch-name' : {'install' : false},
'gdbus-example-watch-proxy' : {'install' : false},
- 'gsubprocess-testprog' : {'install' : false},
'httpd' : {'install' : false},
'proxy' : {'install' : false},
'resolver' : {'install' : false},
@@ -320,22 +330,27 @@ test_extra_programs += [{
'extra_sources' : ['gtlsconsoleinteraction.c'],
'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'
test_extra_programs += [{
'gdbus-example-unix-fd-client' : {
@@ -344,6 +359,25 @@ if host_machine.system() != 'windows'
}]
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()
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',
'@INPUT@'])
- if host_system == 'windows'
- resource_plugin_platform_link_args = ['-no-undefined']
- else
- resource_plugin_platform_link_args = []
- endif
- shared_module ('resourceplugin', 'resourceplugin.c', plugin_resources_c,
- link_args : export_dynamic_ldflags + resource_plugin_platform_link_args,
- dependencies : common_gio_tests_deps)
+ shared_module('resourceplugin', 'resourceplugin.c', plugin_resources_c,
+ link_args : export_dynamic_ldflags,
+ dependencies : common_gio_tests_deps,
+ install_dir : installed_tests_execdir,
+ install : installed_tests_enabled
+ )
test_gresource = custom_target('test.gresource',
input : 'test.gresource.xml',
@@ -372,7 +404,9 @@ if not meson.is_cross_build() or meson.has_exe_wrapper()
'--target=@OUTPUT@',
'--sourcedir=' + meson.current_source_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',
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('program', test_name)
configure_file(
- input: installed_tests_template,
+ input: installed_tests_template_tap,
output: test_name + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf
@@ -447,7 +481,13 @@ foreach test_dict : gio_tests
suite = ['gio'] + extra_args.get('suite', [])
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
diff --git a/gio/tests/modules/meson.build b/gio/tests/modules/meson.build
index 5ae131ae7..fa981c4fa 100644
--- a/gio/tests/modules/meson.build
+++ b/gio/tests/modules/meson.build
@@ -1,11 +1,13 @@
-libtestmodulea = library('testmodulea', 'test-module-a.c',
- install : false,
+libtestmodulea = shared_module('testmodulea', 'test-module-a.c',
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',
- install : false,
+libtestmoduleb = shared_module('testmoduleb', 'test-module-b.c',
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'),
)
diff --git a/gio/tests/modules/test-module-a.c b/gio/tests/modules/test-module-a.c
index 6ac065d8a..0a64ea60a 100644
--- a/gio/tests/modules/test-module-a.c
+++ b/gio/tests/modules/test-module-a.c
@@ -20,6 +20,8 @@
* if advised of the possibility of such damage.
*/
+#include "config.h" /* for _GLIB_EXTERN */
+
#include
#include "symbol-visibility.h"
diff --git a/gio/tests/modules/test-module-b.c b/gio/tests/modules/test-module-b.c
index 21932287f..8d3527e43 100644
--- a/gio/tests/modules/test-module-b.c
+++ b/gio/tests/modules/test-module-b.c
@@ -20,6 +20,8 @@
* if advised of the possibility of such damage.
*/
+#include "config.h" /* for _GLIB_EXTERN */
+
#include
#include "symbol-visibility.h"
diff --git a/gio/tests/readwrite.c b/gio/tests/readwrite.c
index 9f674c39d..2aa925b30 100644
--- a/gio/tests/readwrite.c
+++ b/gio/tests/readwrite.c
@@ -6,6 +6,9 @@
#ifdef G_OS_UNIX
#include
#endif
+#ifdef G_OS_WIN32
+#include /* for close() */
+#endif
static const char *original_data = "This is some test data that we can put in a file...";
static const char *new_data = "new data..";
diff --git a/glib.mk b/glib.mk
index 09aae0e87..f9d09ff6f 100644
--- a/glib.mk
+++ b/glib.mk
@@ -3,7 +3,6 @@
#GTESTER = gtester # for non-GLIB packages
#GTESTER_REPORT = gtester-report # for non-GLIB packages
GTESTER = $(top_builddir)/glib/gtester # for the GLIB package
-GTESTER_REPORT = $(top_builddir)/glib/gtester-report # for the GLIB package
NULL =
# initialize variables for unconditional += appending
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 8f6536c6d..90d33d082 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -454,24 +454,17 @@ bin_PROGRAMS += gtester
gtester_SOURCES = gtester.c
gtester_LDADD = libglib-2.0.la
-auto_config_binscripts = gtester-report
-bin_SCRIPTS = ${auto_config_binscripts}
-EXTRA_DIST += ${auto_config_binscripts}
+bin_SCRIPTS = gtester-report
+EXTRA_DIST += gtester-report.in
-CONFIGVARS = \
- "bindir" : "${bindir}", \
- "glib-version" : "${GLIB_VERSION}"
-
-install-exec-hook:
- 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}|' \
+gtester-report: gtester-report.in Makefile
+ $(AM_V_GEN) set -e ; \
+ sed < $< > $@.tmp \
+ -e '1,1s|#!.*|#!${PYTHON}|' \
+ -e 's|[@]GLIB_VERSION[@]|${GLIB_VERSION}|' \
|| exit $$? ; \
- chmod a+x $(DESTDIR)$(bindir)/$$sf ; \
- rm -f "$(DESTDIR)$(bindir)/$$sf".tmp ; \
- done
+ chmod +x $@.tmp ; \
+ mv $@.tmp $@
endif
diff --git a/glib/gbookmarkfile.c b/glib/gbookmarkfile.c
index 31706ba12..ffd7ea0b1 100644
--- a/glib/gbookmarkfile.c
+++ b/glib/gbookmarkfile.c
@@ -3360,8 +3360,8 @@ expand_exec_line (const gchar *exec_fmt,
* @stamp: (out) (optional): return location for the last registration time, or %NULL
* @error: return location for a #GError, or %NULL
*
- * Gets the registration informations of @app_name for the bookmark for
- * @uri. See g_bookmark_file_set_app_info() for more informations about
+ * Gets the registration information of @app_name for the bookmark for
+ * @uri. See g_bookmark_file_set_app_info() for more information about
* the returned data.
*
* The string returned in @app_exec must be freed.
diff --git a/glib/gnulib/vasnprintf.c b/glib/gnulib/vasnprintf.c
index 38eab62f5..05d6c2b91 100644
--- a/glib/gnulib/vasnprintf.c
+++ b/glib/gnulib/vasnprintf.c
@@ -55,7 +55,9 @@
#ifndef VASNPRINTF
# include
#endif
+/* galloca.h also defines alloca and HAVE_ALLOCA makes the code below use it */
#include "glib/galloca.h"
+#define HAVE_ALLOCA 1
#include "g-gnulib.h"
diff --git a/glib/gscanner.c b/glib/gscanner.c
index 389376c59..9acf3dfa2 100644
--- a/glib/gscanner.c
+++ b/glib/gscanner.c
@@ -1697,12 +1697,7 @@ g_scanner_get_token_i (GScanner *scanner,
*token_p = G_TOKEN_FLOAT;
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;
-#endif
}
else
value_p->v_float = value_p->v_int;
diff --git a/glib/gspawn.c b/glib/gspawn.c
index 5d0c29d70..23ade06ae 100644
--- a/glib/gspawn.c
+++ b/glib/gspawn.c
@@ -30,7 +30,10 @@
#include
#include /* for fdwalk */
#include
+
+#ifdef HAVE_SPAWN_H
#include
+#endif /* HAVE_SPAWN_H */
#ifdef HAVE_CRT_EXTERNS_H
#include /* for _NSGetEnviron */
diff --git a/glib/gstdio-private.c b/glib/gstdio-private.c
new file mode 100644
index 000000000..5eaaf09c5
--- /dev/null
+++ b/glib/gstdio-private.c
@@ -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 .
+ */
+
+/* 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;
+}
diff --git a/glib/gstdio.c b/glib/gstdio.c
index ffbd37180..1a56b1932 100644
--- a/glib/gstdio.c
+++ b/glib/gstdio.c
@@ -121,6 +121,8 @@ w32_error_to_errno (DWORD error_code)
}
}
+#include "gstdio-private.c"
+
static int
_g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename,
int fd,
@@ -259,15 +261,11 @@ _g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename,
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,
- * 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 = g_malloc (filename_target_len * sizeof (wchar_t));
+ filename_target_len = new_len + 3;
+ filename_target = g_malloc ((filename_target_len + 1) * sizeof (wchar_t));
new_len = GetFinalPathNameByHandleW (file_handle,
filename_target,
@@ -284,17 +282,32 @@ _g_win32_stat_utf16_no_trailing_slashes (const gunichar2 *filename,
error_code = ERROR_BUFFER_OVERFLOW;
g_clear_pointer (&filename_target, g_free);
}
- /* GetFinalPathNameByHandle() is documented to return extended paths,
- * strip the extended prefix.
- */
- else if (new_len > extended_prefix_len &&
- memcmp (filename_target, extended_prefix, extended_prefix_len_bytes) == 0)
+ else if (new_len == 0)
{
- new_len -= extended_prefix_len;
- memmove (filename_target,
- filename_target + extended_prefix_len,
- (new_len + 1) * sizeof (wchar_t));
+ g_clear_pointer (&filename_target, g_free);
}
+ /* 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)
@@ -453,8 +466,9 @@ _g_win32_readlink_utf16_raw (const gunichar2 *filename,
* point and use DeviceIoControl() on it.
*/
h = CreateFileW (filename,
- FILE_READ_ATTRIBUTES | SYNCHRONIZE | GENERIC_READ,
- FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_READ_EA,
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL
| FILE_FLAG_OPEN_REPARSE_POINT
| (attributes & FILE_ATTRIBUTE_DIRECTORY ? FILE_FLAG_BACKUP_SEMANTICS : 0),
@@ -513,10 +527,8 @@ _g_win32_readlink_utf16 (const gunichar2 *filename,
gunichar2 *buf,
gsize buf_size)
{
- const wchar_t *ntobjm_prefix = L"\\??\\";
- const gsize ntobjm_prefix_len_unichar2 = wcslen (ntobjm_prefix);
- const gsize ntobjm_prefix_len_bytes = sizeof (gunichar2) * ntobjm_prefix_len_unichar2;
- int result = _g_win32_readlink_utf16_raw (filename, buf, buf_size);
+ int result = _g_win32_readlink_utf16_raw (filename, buf, buf_size);
+ gsize string_size;
if (result <= 0)
return result;
@@ -532,16 +544,16 @@ _g_win32_readlink_utf16 (const gunichar2 *filename,
/* DeviceIoControl () tends to return filenames as NT Object Manager
* names , i.e. "\\??\\C:\\foo\\bar".
* 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 &&
- memcmp (buf, ntobjm_prefix, ntobjm_prefix_len_bytes) == 0)
- {
- result -= ntobjm_prefix_len_bytes;
- memmove (buf, buf + ntobjm_prefix_len_unichar2, result);
- }
+ string_size = result / sizeof (gunichar2);
+ _g_win32_strip_extended_ntobjm_prefix (buf, &string_size);
- return result;
+ return string_size * sizeof (gunichar2);
}
static gchar *
diff --git a/glib/gtester-report b/glib/gtester-report.in
old mode 100755
new mode 100644
similarity index 98%
rename from glib/gtester-report
rename to glib/gtester-report.in
index c4790adbb..01f6033f7
--- a/glib/gtester-report
+++ b/glib/gtester-report.in
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env @PYTHON@
# GLib Testing Framework Utility -*- Mode: python; -*-
# Copyright (C) 2007 Imendio AB
# Authors: Tim Janik
@@ -28,10 +28,6 @@ except ImportError:
subunit = None
-pkginstall_configvars = {
- #@PKGINSTALL_CONFIGVARS_IN24LINES@ # configvars are substituted upon script installation
-}
-
# xml utilities
def find_child (node, child_name):
for child in node.childNodes:
@@ -454,7 +450,7 @@ def parse_opts():
:return: An options object and the program arguments.
"""
parser = optparse.OptionParser()
- parser.version = pkginstall_configvars.get ('glib-version', '0.0-uninstalled')
+ parser.version = '@GLIB_VERSION@'
parser.usage = "%prog [OPTIONS] "
parser.description = "Generate HTML reports from the XML log files generated by gtester."
parser.epilog = "gtester-report (GLib utils) version %s."% (parser.version,)
diff --git a/glib/gtester.c b/glib/gtester.c
index 41bf877ff..c54221a4d 100644
--- a/glib/gtester.c
+++ b/glib/gtester.c
@@ -500,7 +500,7 @@ usage (gboolean just_version)
g_print ("Help Options:\n");
g_print (" -h, --help Show this help message\n\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 (" -k, --keep-going Continue running after tests failed\n");
g_print (" -l List paths of available test cases\n");
diff --git a/glib/meson.build b/glib/meson.build
index c05c69406..6fc56da7c 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -7,10 +7,18 @@ subdir('libcharset')
if not use_system_pcre
subdir('pcre')
endif
+
+# TODO: gnulib_objects, pcre_objects and pcre_deps are a workaround for
+# and
+# . 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
gnulib_lib = []
+ gnulib_objects = []
else
subdir('gnulib')
+ gnulib_objects = [gnulib_lib.extract_all_objects()]
endif
glib_headers = files(
@@ -234,17 +242,25 @@ if use_pcre_static_flag
pcre_static_args = ['-DPCRE_STATIC']
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',
glib_dtrace_obj, glib_dtrace_hdr,
sources : [deprecated_sources, glib_sources],
+ objects : [charset_lib.extract_all_objects()] + gnulib_objects + pcre_objects,
version : library_version,
soversion : soversion,
install : true,
# intl.lib is not compatible with SAFESEH
link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
include_directories : configinc,
- link_with : [charset_lib, gnulib_lib],
- dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
+ dependencies : pcre_deps + [thread_dep, libintl, librt] + libiconv + platform_deps,
c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args
)
@@ -303,7 +319,16 @@ else
dependencies : [libglib_dep])
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'))
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
index 4772540c3..c2a553bd5 100644
--- a/glib/tests/fileutils.c
+++ b/glib/tests/fileutils.c
@@ -1009,6 +1009,139 @@ test_fopen_modes (void)
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
main (int argc,
char *argv[])
@@ -1018,6 +1151,9 @@ main (int argc,
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-pathv", test_build_pathv);
g_test_add_func ("/fileutils/build-filename", test_build_filename);
diff --git a/glib/tests/meson.build b/glib/tests/meson.build
index 0af71b072..ad0139df6 100644
--- a/glib/tests/meson.build
+++ b/glib/tests/meson.build
@@ -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
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('program', test_name)
configure_file(
- input: installed_tests_template,
+ input: installed_tests_template_tap,
output: test_name + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf
@@ -171,7 +186,8 @@ foreach test_name, extra_args : glib_tests
suite = ['glib'] + extra_args.get('suite', [])
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
endforeach
diff --git a/gobject/gobject-query.c b/gobject/gobject-query.c
index 2992567dd..fd45fba82 100644
--- a/gobject/gobject-query.c
+++ b/gobject/gobject-query.c
@@ -99,7 +99,7 @@ static gint
help (gchar *arg)
{
g_fprintf (stderr, "usage: gobject-query [-r ] [-{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, " -h guess what ;)\n");
g_fprintf (stderr, " -b specify indent string\n");
diff --git a/gobject/tests/meson.build b/gobject/tests/meson.build
index cc83c5f46..74521abeb 100644
--- a/gobject/tests/meson.build
+++ b/gobject/tests/meson.build
@@ -73,7 +73,7 @@ foreach test_name, extra_args : gobject_tests
test_conf.set('installed_tests_dir', installed_tests_execdir)
test_conf.set('program', test_name)
configure_file(
- input: installed_tests_template,
+ input: installed_tests_template_tap,
output: test_name + '.test',
install_dir: installed_tests_metadir,
configuration: test_conf
@@ -89,7 +89,8 @@ foreach test_name, extra_args : gobject_tests
suite = ['gobject'] + extra_args.get('suite', [])
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
test(
diff --git a/gthread/meson.build b/gthread/meson.build
index 6b0748f15..515479ba1 100644
--- a/gthread/meson.build
+++ b/gthread/meson.build
@@ -30,3 +30,5 @@ pkg.generate(libraries : [libgthread, thread_dep],
name : 'GThread',
description : 'Thread support for GLib',
)
+
+libgthread_dep = declare_dependency(link_with : libgthread)
diff --git a/m4macros/glib-2.0.m4 b/m4macros/glib-2.0.m4
index 4b1901947..7491f1be4 100644
--- a/m4macros/glib-2.0.m4
+++ b/m4macros/glib-2.0.m4
@@ -2,7 +2,7 @@
# Owen Taylor 1997-2001
# 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 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 Get the cflags and libraries from pkg-config
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],
, 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
do
case "$module" in
@@ -46,7 +52,15 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
PKG_CONFIG=no
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)
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
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 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
@@ -204,11 +211,5 @@ main (void)
GLIB_COMPILE_RESOURCES=""
ifelse([$3], , :, [$3])
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
])
diff --git a/m4macros/gsettings.m4 b/m4macros/gsettings.m4
index 03c16fb80..882e6a83e 100644
--- a/m4macros/gsettings.m4
+++ b/m4macros/gsettings.m4
@@ -1,5 +1,5 @@
# Increment this whenever this file is changed.
-#serial 1
+#serial 2
dnl GLIB_GSETTINGS
dnl Defines GSETTINGS_SCHEMAS_INSTALL which controls whether
@@ -8,6 +8,10 @@ dnl
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])
AC_ARG_ENABLE(schemas-compile,
AS_HELP_STRING([--disable-schemas-compile],
@@ -20,11 +24,9 @@ AC_DEFUN([GLIB_GSETTINGS],
AC_SUBST([GSETTINGS_DISABLE_SCHEMAS_COMPILE])
PKG_PROG_PKG_CONFIG([0.16])
AC_SUBST(gsettingsschemadir, [${datadir}/glib-2.0/schemas])
- if test x$cross_compiling != xyes; then
- GLIB_COMPILE_SCHEMAS=`$PKG_CONFIG --variable glib_compile_schemas gio-2.0`
- else
- AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas)
- fi
+ AS_IF([test x$cross_compiling != xyes],
+ [PKG_CHECK_VAR([GLIB_COMPILE_SCHEMAS], [gio-2.0], [glib_compile_schemas])],
+ [AC_PATH_PROG([GLIB_COMPILE_SCHEMAS], [glib-compile-schemas])])
AC_SUBST(GLIB_COMPILE_SCHEMAS)
if test "x$GLIB_COMPILE_SCHEMAS" = "x"; then
ifelse([$2],,[AC_MSG_ERROR([glib-compile-schemas not found.])],[$2])
diff --git a/meson.build b/meson.build
index 0a0de3cec..2ba3cb052 100644
--- a/meson.build
+++ b/meson.build
@@ -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_enabled = get_option('installed_tests')
installed_tests_template = files('template.test.in')
+installed_tests_template_tap = files('template-tap.test.in')
add_project_arguments('-D_GNU_SOURCE', language: 'c')
@@ -226,6 +227,7 @@ headers = [
'poll.h',
'pwd.h',
'sched.h',
+ 'spawn.h',
'stdint.h',
'stdlib.h',
'string.h',
@@ -352,7 +354,6 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
'-Wno-bad-function-cast',
'-Werror=declaration-after-statement',
'-Werror=format=2',
- '-Werror=format-security',
'-Werror=implicit-function-declaration',
'-Werror=init-self',
'-Werror=missing-include-dirs',
@@ -386,7 +387,6 @@ if host_system == 'windows'
endif
functions = [
- 'alloca',
'endmntent',
'endservent',
'fallocate',
@@ -739,12 +739,14 @@ if cc.compiles('''#include
endif
# 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.
-# 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_snprintf = false
+have_good_printf = false
if host_system == 'windows' and cc.get_id() == 'msvc'
# 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.
glib_conf.set('HAVE_C99_SNPRINTF', false)
glib_conf.set('HAVE_C99_VSNPRINTF', false)
+ glib_conf.set('HAVE_UNIX98_PRINTF', false)
else
vsnprintf_c99_test_code = '''
#include
@@ -851,6 +854,31 @@ main(void)
have_good_snprintf = meson.get_cross_property('have_c99_snprintf', false)
glib_conf.set('HAVE_C99_SNPRINTF', have_good_snprintf)
endif
+
+ printf_unix98_test_code = '''
+#include
+
+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
if host_system == 'windows'
@@ -859,20 +887,22 @@ else
glib_conf.set('EXEEXT', '')
endif
-if have_good_vsnprintf and have_good_snprintf
- # Our printf is 'good' only if vsnpintf()/snprintf() supports C99 well enough
- glib_conf.set('HAVE_GOOD_PRINTF', 1) # FIXME: Check for HAVE_UNIX98_PRINTF?
+if have_good_vsnprintf and have_good_snprintf and have_good_printf
+ # Our printf is 'good' only if vsnpintf()/snprintf()/printf() supports C99 well enough
+ glib_conf.set('HAVE_GOOD_PRINTF', 1)
else
glib_conf.set('HAVE_VASPRINTF', 1)
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
# AC_FUNC_PRINTF_UNIX98
# Nothing uses HAVE_UNIX98_PRINTF
# Check for nl_langinfo and CODESET
-# FIXME: Check for HAVE_BIND_TEXTDOMAIN_CODESET
if cc.links('''#include
int main (int argc, char ** argv) {
char *codeset = nl_langinfo (CODESET);
@@ -1494,8 +1524,6 @@ foreach d : inet_defines
glibconfig_conf.set(d[1], val)
endforeach
-glibconfig_conf.set('GLIB_USING_SYSTEM_PRINTF', true) # FIXME!
-
# We need a more robust approach here...
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')
@@ -1634,7 +1662,7 @@ else
growing_stack = meson.get_cross_property('growing_stack', false)
endif
-glibconfig_conf.set('G_HAVE_GROWING_STACK', growing_stack)
+glibconfig_conf.set10('G_HAVE_GROWING_STACK', growing_stack)
# Tests for iconv
#
@@ -1746,13 +1774,20 @@ endif
# implementations. This could be extended if issues are found in some platforms.
if cc.has_function('ngettext')
libintl = []
+ have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
else
libintl = cc.find_library('intl', required : false)
if not libintl.found()
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
+glib_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
+
# We require gettext to always be present
glib_conf.set('HAVE_DCGETTEXT', 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
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
-# 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
if host_system == 'sunos'
glib_conf.set('_XOPEN_SOURCE_EXTENDED', 1)
@@ -1963,11 +1991,9 @@ if have_sh
configuration : gettextize_conf)
endif
-if have_m4
- # Install m4 macros that other projects use
- install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4',
- install_dir : join_paths(get_option('datadir'), 'aclocal'))
-endif
+# Install m4 macros that other projects use
+install_data('m4macros/glib-2.0.m4', 'm4macros/glib-gettext.m4', 'm4macros/gsettings.m4',
+ install_dir : join_paths(get_option('datadir'), 'aclocal'))
if host_system != 'windows'
# Install Valgrind suppression file (except on Windows,
diff --git a/template-tap.test.in b/template-tap.test.in
new file mode 100644
index 000000000..6adf73f03
--- /dev/null
+++ b/template-tap.test.in
@@ -0,0 +1,4 @@
+[Test]
+Type=session
+Exec=@installed_tests_dir@/@program@ --tap
+Output=TAP
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fba18655d..9682352d0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -123,7 +123,7 @@ dist-hook: $(BUILT_EXTRA_DIST)
if HAVE_CXX
installed_test_programs += cxx-test
-cxx_test_SOURCES = cxx-test.C
+cxx_test_SOURCES = cxx-test.cpp
endif
if ENABLE_TIMELOOP
diff --git a/tests/cxx-test.C b/tests/cxx-test.cpp
similarity index 100%
rename from tests/cxx-test.C
rename to tests/cxx-test.cpp
diff --git a/tests/gio-test.c b/tests/gio-test.c
index 22ae77cff..d9bd7e357 100644
--- a/tests/gio-test.c
+++ b/tests/gio-test.c
@@ -214,11 +214,11 @@ recv_windows_message (GIOChannel *channel,
{
GIOError error;
MSG msg;
- guint nb;
+ gsize nb;
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)
{
@@ -232,20 +232,25 @@ recv_windows_message (GIOChannel *channel,
break;
}
- g_print ("gio-test: ...Windows message for %#x: %d,%d,%d\n",
- msg.hwnd, msg.message, msg.wParam, msg.lParam);
+ g_print ("gio-test: ...Windows message for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT "\n",
+ msg.hwnd, msg.message, msg.wParam, (gintptr)msg.lParam);
return TRUE;
}
+LRESULT CALLBACK window_procedure (HWND hwnd,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam);
+
LRESULT CALLBACK
window_procedure (HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam)
{
- g_print ("gio-test: window_procedure for %#x: %d,%d,%d\n",
- hwnd, message, wparam, lparam);
+ g_print ("gio-test: window_procedure for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT "\n",
+ hwnd, message, wparam, (gintptr)lparam);
return DefWindowProc (hwnd, message, wparam, lparam);
}
@@ -331,7 +336,7 @@ main (int argc,
nrunning++;
#ifdef G_OS_WIN32
- cmdline = g_strdup_printf ("%d:%d:%d",
+ cmdline = g_strdup_printf ("%d:%d:0x%p",
pipe_to_sub[0],
pipe_from_sub[1],
hwnd);
@@ -388,7 +393,7 @@ main (int argc,
sscanf (argv[2], "%d:%d%n", &readfd, &writefd, &n);
#ifdef G_OS_WIN32
- sscanf (argv[2] + n, ":%d", &hwnd);
+ sscanf (argv[2] + n, ":0x%p", &hwnd);
#endif
srand (tv.tv_sec ^ (tv.tv_usec / 1000) ^ readfd ^ (writefd << 4));
@@ -413,8 +418,8 @@ main (int argc,
int msg = WM_USER + (rand() % 100);
WPARAM wparam = rand ();
LPARAM lparam = rand ();
- g_print ("gio-test: child posting message %d,%d,%d to %#x\n",
- msg, wparam, lparam, hwnd);
+ g_print ("gio-test: child posting message %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT " to 0x%p\n",
+ msg, wparam, (gintptr)lparam, hwnd);
PostMessage (hwnd, msg, wparam, lparam);
}
#endif
diff --git a/tests/gobject/Makefile.am b/tests/gobject/Makefile.am
index 0e609870b..1bcefbe5c 100644
--- a/tests/gobject/Makefile.am
+++ b/tests/gobject/Makefile.am
@@ -51,24 +51,20 @@ if ENABLE_TIMELOOP
installed_test_programs += timeloop-closure
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
testmarshal.h: stamp-testmarshal.h
@true
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) \
&& rm -f xgen-gmh xgen-gmh~ \
&& echo timestamp > $@
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 \
&& rm -f xgen-gmc xgen-gmc~
BUILT_SOURCES += testmarshal.h testmarshal.c
CLEANFILES += stamp-testmarshal.h testmarshal.h testmarshal.c
EXTRA_DIST += testcommon.h testmarshal.list
-endif # !CROSS_COMPILING
\ No newline at end of file
diff --git a/tests/gobject/meson.build b/tests/gobject/meson.build
index 494459921..2a58766df 100644
--- a/tests/gobject/meson.build
+++ b/tests/gobject/meson.build
@@ -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
testmarshal_h = custom_target('testmarshal_h',
output : 'testmarshal.h',
@@ -39,41 +26,80 @@ testmarshal_c = custom_target('testmarshal_c',
],
)
-gobject_tests += [
- ['accumulator', ['accumulator.c', testmarshal_c, testmarshal_h]],
-]
+# FIXME: We are using list of dictionnaries until we can depend on Meson 0.48.0
+# 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
- test_name = t.get(0)
- test_src = t.get(1, test_name + '.c')
- test_extra_cargs = t.get(2, [])
- test_timeout = t.get(3, 30)
- test_suite = test_timeout == 30 ? ['gobject'] : ['gobject', 'slow']
+if host_system != 'windows'
+ gobject_tests += [{
+ 'timeloop-closure' : {},
+ }]
+endif
- # FIXME? $(GLIB_DEBUG_FLAGS)
- exe = executable(test_name + '-gobject', test_src,
- c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
- dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
- install : false,
- )
- # FIXME? TESTS_ENVIRONMENT = LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
- test(test_name, exe, env : test_env, timeout : test_timeout, suite : test_suite)
+common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
+common_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
+
+foreach test_dict : gobject_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', []),
+ 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
# Don't install these ones, and keep them out of 'make check' because they take too long...
executable('performance', 'performance.c',
- c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
- dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
+ c_args : common_c_args,
+ dependencies : common_deps,
install : false)
executable('performance-threaded', 'performance-threaded.c',
- c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
- dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
+ c_args : common_c_args,
+ dependencies : common_deps,
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
diff --git a/tests/mapping-test.c b/tests/mapping-test.c
index 3eb90fa48..ad776fad1 100644
--- a/tests/mapping-test.c
+++ b/tests/mapping-test.c
@@ -25,6 +25,9 @@
#ifdef G_OS_UNIX
#include
#endif
+#ifdef G_OS_WIN32
+#include
+#endif
static gchar *dir, *filename, *displayname, *childname;
@@ -188,7 +191,9 @@ test_child_private (gchar *argv0)
gsize len;
gchar *child_argv[4];
GPid child_pid;
+#ifndef G_OS_WIN32
GMainLoop *loop;
+#endif
gchar pid[100];
#ifdef G_OS_WIN32
diff --git a/tests/meson.build b/tests/meson.build
index 3beb4c68a..778d20ce3 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,12 +1,147 @@
# 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.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_DEBUG', 'gc-friendly')
test_env.set('MALLOC_CHECK_', '2')
+test_env.set('MALLOC_PERTURB_', '@0@'.format(random_number % 256))
test_cargs = ['-DG_LOG_DOMAIN="GLib"']
subdir('gobject')
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
diff --git a/tests/refcount/meson.build b/tests/refcount/meson.build
index 9046bf7c7..3a2072d08 100644
--- a/tests/refcount/meson.build
+++ b/tests/refcount/meson.build
@@ -1,30 +1,59 @@
-refcount_tests = [
- ['closures', 'closures.c', []],
- ['objects', 'objects.c', []],
- ['objects2', 'objects2.c', [], 90],
- ['properties', 'properties.c', []],
- ['properties2', 'properties2.c', [], 90],
- ['properties3', 'properties3.c', [], 90], # extra long timeout
- ['properties4', 'properties4.c', []],
- ['signal1', 'signals.c', ['-DTESTNUM=1']],
- ['signal2', 'signals.c', ['-DTESTNUM=2']],
- ['signal3', 'signals.c', ['-DTESTNUM=3']],
- ['signal4', 'signals.c', ['-DTESTNUM=4']],
-]
+refcount_tests = {
+ 'closures' : {'suite' : ['slow']},
+ 'objects' : {},
+ 'objects2' : {'suite' : ['slow']},
+ 'properties' : {},
+ 'properties2' : {'suite' : ['slow']},
+ 'properties3' : {'suite' : ['slow']},
+ 'properties4' : {},
+ 'signal1' : {
+ 'source' : 'signals.c',
+ 'c_args' : ['-DTESTNUM=1'],
+ },
+ '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
- test_name = t.get(0)
- test_src = t.get(1)
- test_extra_cargs = t.get(2)
- test_timeout = t.get(3, 30)
- test_suite = test_timeout == 30 ? ['refcount'] : ['refcount', 'slow']
+common_c_args = test_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS']
+common_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
+
+foreach test_name, extra_args : refcount_tests
+ source = extra_args.get('source', test_name + '.c')
+ extra_sources = extra_args.get('extra_sources', [])
+ install = installed_tests_enabled and extra_args.get('install', true)
+
+ if install
+ test_conf = configuration_data()
+ test_conf.set('installed_tests_dir', installed_tests_execdir)
+ test_conf.set('program', test_name)
+ configure_file(
+ input: installed_tests_template,
+ output: test_name + '.test',
+ install_dir: installed_tests_metadir,
+ configuration: test_conf
+ )
+ endif
# FIXME? $(GLIB_DEBUG_FLAGS)
- exe = executable(test_name + '-test', test_src,
- c_args : test_cargs + test_extra_cargs + ['-DGLIB_DISABLE_DEPRECATION_WARNINGS'],
- dependencies : [libm, thread_dep, libglib_dep, libgobject_dep],
- install : false,
+ 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 = ['refcount'] + 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 : test_timeout, suite : test_suite)
+ test(test_name, exe, env : test_env, timeout : timeout, suite : suite)
endforeach
diff --git a/tests/type-test.c b/tests/type-test.c
index ed7cc44cf..43da39472 100644
--- a/tests/type-test.c
+++ b/tests/type-test.c
@@ -120,8 +120,13 @@ main (int argc,
gu64t1 = G_GINT64_CONSTANT (0xFAFAFAFAFAFAFAFA);
#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);
- sscanf (string, FORMAT64, &gi64t2, &gu64t2);
+ sscanf (string, SCAN_FORMAT64, &gi64t2, &gu64t2);
g_free (string);
g_assert (gi64t1 == gi64t2);
g_assert (gu64t1 == gu64t2);
@@ -130,8 +135,13 @@ main (int argc,
gst1 = 0xFAFAFAFA;
#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);
- sscanf (string, FORMATSIZE, &gsst2, &gst2);
+ sscanf (string, SCAN_FORMATSIZE, &gsst2, &gst2);
g_free (string);
g_assert (gsst1 == gsst2);
g_assert (gst1 == gst2);
diff --git a/tests/unicode-encoding.c b/tests/unicode-encoding.c
index 8ac4f9522..c729b284d 100644
--- a/tests/unicode-encoding.c
+++ b/tests/unicode-encoding.c
@@ -9,6 +9,7 @@
static gint exit_status = 0;
+G_GNUC_PRINTF (1, 2)
static void
croak (char *format, ...)
{
@@ -21,6 +22,7 @@ croak (char *format, ...)
exit (1);
}
+G_GNUC_PRINTF (1, 2)
static void
fail (char *format, ...)
{