diff options
author | Dan Vrátil <dvratil@redhat.com> | 2013-04-08 19:36:23 +0200 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2013-04-08 13:42:45 -0400 |
commit | 253cbbba71629c6144c2440c0ab5f4bde975acc4 (patch) | |
tree | 62c139e6e576c02a344f7aa963af0419a710c293 /tests/lib | |
parent | c0a2104a590e9e68226f836d22ff6e645f3e33d3 (diff) | |
download | telepathy-logger-253cbbba71629c6144c2440c0ab5f4bde975acc4.tar.gz |
Make log-manager tests writable
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/util.c | 21 | ||||
-rw-r--r-- | tests/lib/util.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/lib/util.c b/tests/lib/util.c index 690365c..b58227e 100644 --- a/tests/lib/util.c +++ b/tests/lib/util.c @@ -12,6 +12,7 @@ #include "util.h" +#include <stdlib.h> #ifdef G_OS_UNIX # include <unistd.h> /* for alarm() */ #endif @@ -210,6 +211,26 @@ _tp_tests_assert_strv_equals (const char *file, } void +tp_tests_copy_dir (const gchar *from_dir, const gchar *to_dir) +{ + gchar *command; + + // If destination directory exist erase it + command = g_strdup_printf ("rm -rf %s", to_dir); + g_assert (system (command) == 0); + g_free (command); + + command = g_strdup_printf ("cp -r %s %s", from_dir, to_dir); + g_assert (system (command) == 0); + g_free (command); + + // In distcheck mode the files and directory are read-only, fix that + command = g_strdup_printf ("chmod -R +w %s", to_dir); + g_assert (system (command) == 0); + g_free (command); +} + +void tp_tests_create_and_connect_conn (GType conn_type, const gchar *account, TpBaseConnection **service_conn, diff --git a/tests/lib/util.h b/tests/lib/util.h index 7eab77d..ba96c7b 100644 --- a/tests/lib/util.h +++ b/tests/lib/util.h @@ -54,4 +54,6 @@ void tp_tests_result_ready_cb (GObject *object, void tp_tests_abort_after (guint sec); +void tp_tests_copy_dir (const gchar *from_dir, const gchar *to_dir); + #endif /* #ifndef __TP_TESTS_LIB_UTIL_H__ */ |