mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 18:40:58 +01:00
Merge branch '889-stdiowrappers-symlink-failure' into 'master'
tests: Fix running fileutils test in cwd which is a symlink Closes #889 See merge request GNOME/glib!170
This commit is contained in:
commit
b7f7f75bf1
@ -887,6 +887,7 @@ test_stdio_wrappers (void)
|
|||||||
gint ret;
|
gint ret;
|
||||||
struct utimbuf ut;
|
struct utimbuf ut;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
GStatBuf path_statbuf, cwd_statbuf;
|
||||||
|
|
||||||
/* The permissions tests here don’t work when running as root. */
|
/* The permissions tests here don’t work when running as root. */
|
||||||
#ifdef G_OS_UNIX
|
#ifdef G_OS_UNIX
|
||||||
@ -920,7 +921,13 @@ test_stdio_wrappers (void)
|
|||||||
ret = g_chdir (path);
|
ret = g_chdir (path);
|
||||||
g_assert_cmpint (ret, ==, 0);
|
g_assert_cmpint (ret, ==, 0);
|
||||||
cwd = g_get_current_dir ();
|
cwd = g_get_current_dir ();
|
||||||
g_assert_true (g_str_equal (cwd, path));
|
/* We essentially want to check that cwd == path, but we can’t compare the
|
||||||
|
* paths directly since the tests might be running under a symlink (for
|
||||||
|
* example, /tmp is sometimes a symlink). Compare the inode numbers instead. */
|
||||||
|
g_assert_cmpint (g_stat (cwd, &cwd_statbuf), ==, 0);
|
||||||
|
g_assert_cmpint (g_stat (path, &path_statbuf), ==, 0);
|
||||||
|
g_assert_true (cwd_statbuf.st_dev == path_statbuf.st_dev &&
|
||||||
|
cwd_statbuf.st_ino == path_statbuf.st_ino);
|
||||||
g_free (cwd);
|
g_free (cwd);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user