[glib] Make symlink test work installed



commit d25b655bf579ccc7e2e56a9b2185177fde04e058
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 1 23:28:23 2014 -0500

    Make symlink test work installed
    
    We can't assume that the location used for G_TEST_DIST paths
    is writable, so just create the symlink in the current directory
    instead.

 glib/tests/fileutils.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c
index a59d148..eada604 100644
--- a/glib/tests/fileutils.c
+++ b/glib/tests/fileutils.c
@@ -795,14 +795,17 @@ test_read_link (void)
 #ifdef G_OS_UNIX
   int ret;
   const gchar *oldpath;
-  const gchar *newpath;
-  const gchar *badpath;
+  gchar *cwd;
+  gchar *newpath;
+  gchar *badpath;
   gchar *path;
   GError *error = NULL;
 
+  cwd = g_get_current_dir ();
+
   oldpath = g_test_get_filename (G_TEST_DIST, "4096-random-bytes", NULL);
-  newpath = g_test_get_filename (G_TEST_DIST, "page-of-junk", NULL);
-  badpath = g_test_get_filename (G_TEST_DIST, "4097-random-bytes", NULL);
+  newpath = g_build_filename (cwd, "page-of-junk", NULL);
+  badpath = g_build_filename (cwd, "4097-random-bytes", NULL);
   remove (newpath);
   ret = symlink (oldpath, newpath);
   g_assert (ret == 0);
@@ -823,6 +826,10 @@ test_read_link (void)
   g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL);
   g_assert_null (path);
 
+  g_free (cwd);
+  g_free (newpath);
+  g_free (badpath);
+
 #endif
 #else
   g_test_skip ("Symbolic links not supported");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]