mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
Merge branch 'w32-testsuite-fixes-general' into 'master'
General fixes to W32 test suite Closes #875 See merge request GNOME/glib!665
This commit is contained in:
commit
c5c9b29b9d
@ -151,7 +151,7 @@ G_DEFINE_BOXED_TYPE (GResource, g_resource, g_resource_ref, g_resource_unref)
|
||||
* When debugging a program or testing a change to an installed version, it is often useful to be able to
|
||||
* replace resources in the program or library, without recompiling, for debugging or quick hacking and testing
|
||||
* purposes. Since GLib 2.50, it is possible to use the `G_RESOURCE_OVERLAYS` environment variable to selectively overlay
|
||||
* resources with replacements from the filesystem. It is a colon-separated list of substitutions to perform
|
||||
* resources with replacements from the filesystem. It is a %G_SEARCHPATH_SEPARATOR-separated list of substitutions to perform
|
||||
* during resource lookups.
|
||||
*
|
||||
* A substitution has the form
|
||||
@ -332,7 +332,7 @@ g_resource_find_overlay (const gchar *path,
|
||||
gchar **parts;
|
||||
gint i, j;
|
||||
|
||||
parts = g_strsplit (envvar, ":", 0);
|
||||
parts = g_strsplit (envvar, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||
|
||||
/* Sanity check the parts, dropping those that are invalid.
|
||||
* 'i' may grow faster than 'j'.
|
||||
@ -378,9 +378,9 @@ g_resource_find_overlay (const gchar *path,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eq[1] != '/')
|
||||
if (!g_path_is_absolute (eq + 1))
|
||||
{
|
||||
g_critical ("G_RESOURCE_OVERLAYS segment '%s' lacks leading '/' after '='. Ignoring", part);
|
||||
g_critical ("G_RESOURCE_OVERLAYS segment '%s' does not have an absolute path after '='. Ignoring", part);
|
||||
g_free (part);
|
||||
continue;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ test_autoptr (void)
|
||||
g_autofree gchar *path = g_file_get_path (p);
|
||||
g_autofree gchar *istr = g_inet_address_to_string (a);
|
||||
|
||||
g_assert_cmpstr (path, ==, "/blah");
|
||||
g_assert_cmpstr (path, ==, G_DIR_SEPARATOR_S "blah");
|
||||
g_assert_cmpstr (istr, ==, "127.0.0.1");
|
||||
}
|
||||
|
||||
|
@ -271,6 +271,7 @@ find_ifname_and_index (void)
|
||||
static void
|
||||
test_scope_id (GSocketConnectable *addr)
|
||||
{
|
||||
#ifndef G_OS_WIN32
|
||||
GSocketAddressEnumerator *addr_enum;
|
||||
GSocketAddress *saddr;
|
||||
GInetSocketAddress *isaddr;
|
||||
@ -300,6 +301,9 @@ test_scope_id (GSocketConnectable *addr)
|
||||
g_assert (saddr == NULL);
|
||||
|
||||
g_object_unref (addr_enum);
|
||||
#else
|
||||
g_test_skip ("winsock2 getaddrinfo() can’t understand scope IDs");
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -173,7 +173,7 @@ g_winhttp_vfs_get_file_for_uri (GVfs *vfs,
|
||||
return _g_winhttp_file_new (winhttp_vfs, uri);
|
||||
|
||||
/* For other URIs fallback to the wrapped GVfs */
|
||||
return g_vfs_parse_name (winhttp_vfs->wrapped_vfs, uri);
|
||||
return g_vfs_get_file_for_uri (winhttp_vfs->wrapped_vfs, uri);
|
||||
}
|
||||
|
||||
static const gchar * const *
|
||||
|
@ -17,6 +17,11 @@
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#ifdef G_OS_WIN32
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
test_pass (void)
|
||||
@ -47,6 +52,14 @@ main (int argc,
|
||||
{
|
||||
char *argv1;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* Windows opens std streams in text mode, with \r\n EOLs.
|
||||
* Sometimes it's easier to force a switch to binary mode than
|
||||
* to account for extra \r in testcases.
|
||||
*/
|
||||
setmode (fileno (stdout), O_BINARY);
|
||||
#endif
|
||||
|
||||
g_return_val_if_fail (argc > 1, 1);
|
||||
argv1 = argv[1];
|
||||
|
||||
|
@ -133,10 +133,13 @@ int main(int argc, char** argv)
|
||||
g_date_set_julian(d, 1);
|
||||
TEST("GDate's \"Julian\" epoch's first day is valid", g_date_valid(d));
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
g_date_strftime(buf,100,"Our \"Julian\" epoch begins on a %A, in the month of %B, %x\n",
|
||||
d);
|
||||
g_print("%s", buf);
|
||||
|
||||
#else
|
||||
g_print ("But Windows FILETIME does not support dates before Jan 1 1601, so we can't strftime() the beginning of the \"Julian\" epoch.\n");
|
||||
#endif
|
||||
g_date_set_dmy(d, 10, 1, 2000);
|
||||
|
||||
g_date_strftime(buf,100,"%x", d);
|
||||
|
@ -843,6 +843,7 @@ test_paths (void)
|
||||
gchar *relative_path;
|
||||
gchar *canonical_path;
|
||||
} canonicalize_filename_checks[] = {
|
||||
#ifndef G_OS_WIN32
|
||||
{ "/etc", "../usr/share", "/usr/share" },
|
||||
{ "/", "/foo/bar", "/foo/bar" },
|
||||
{ "/usr/bin", "../../foo/bar", "/foo/bar" },
|
||||
@ -857,7 +858,22 @@ test_paths (void)
|
||||
{ "///triple/slash", ".", "/triple/slash" },
|
||||
{ "//double/slash", ".", "//double/slash" },
|
||||
{ "/cwd/../with/./complexities/", "./hello", "/with/complexities/hello" },
|
||||
#ifdef G_OS_WIN32
|
||||
#else
|
||||
{ "/etc", "../usr/share", "\\usr\\share" },
|
||||
{ "/", "/foo/bar", "\\foo\\bar" },
|
||||
{ "/usr/bin", "../../foo/bar", "\\foo\\bar" },
|
||||
{ "/", "../../foo/bar", "\\foo\\bar" },
|
||||
{ "/double//dash", "../../foo/bar", "\\foo\\bar" },
|
||||
{ "/usr/share/foo", ".././././bar", "\\usr\\share\\bar" },
|
||||
{ "/foo/bar", "../bar/./.././bar", "\\foo\\bar" },
|
||||
{ "/test///dir", "../../././foo/bar", "\\foo\\bar" },
|
||||
{ "/test///dir", "../../././/foo///bar", "\\foo\\bar" },
|
||||
{ "/etc", "///triple/slash", "\\triple\\slash" },
|
||||
{ "/etc", "//double/slash", "//double/slash" },
|
||||
{ "///triple/slash", ".", "\\triple\\slash" },
|
||||
{ "//double/slash", ".", "//double/slash\\" },
|
||||
{ "/cwd/../with/./complexities/", "./hello", "\\with\\complexities\\hello" },
|
||||
|
||||
{ "\\etc", "..\\usr\\share", "\\usr\\share" },
|
||||
{ "\\", "\\foo\\bar", "\\foo\\bar" },
|
||||
{ "\\usr\\bin", "..\\..\\foo\\bar", "\\foo\\bar" },
|
||||
@ -870,8 +886,8 @@ test_paths (void)
|
||||
{ "\\etc", "\\\\\\triple\\slash", "\\triple\\slash" },
|
||||
{ "\\etc", "\\\\double\\slash", "\\\\double\\slash" },
|
||||
{ "\\\\\\triple\\slash", ".", "\\triple\\slash" },
|
||||
{ "\\\\double\\slash", ".", "\\\\double\\slash" },
|
||||
{ "\\cwd\\..\\with\\.\\complexities\\", ".\\hello", "\\cwd\\with\\complexities\\hello" },
|
||||
{ "\\\\double\\slash", ".", "\\\\double\\slash\\" },
|
||||
{ "\\cwd\\..\\with\\.\\complexities\\", ".\\hello", "\\with\\complexities\\hello" },
|
||||
#endif
|
||||
};
|
||||
const guint n_canonicalize_filename_checks = G_N_ELEMENTS (canonicalize_filename_checks);
|
||||
|
Loading…
Reference in New Issue
Block a user