From b25303cc3b54e84eac6f051bb43a952bbb91a7fa Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 27 Sep 2013 15:23:49 +0200 Subject: [PATCH 4/4] move tp_tests_copy_dir() to logger-test-helper This function is logger specific so best to have it in this file. Makes syncing with tp-glib easier. --- tests/dbus/test-log-manager.c | 1 + tests/lib/logger-test-helper.c | 22 ++++++++++++++++++++++ tests/lib/logger-test-helper.h | 2 ++ tests/lib/util.c | 20 -------------------- tests/lib/util.h | 2 -- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/tests/dbus/test-log-manager.c b/tests/dbus/test-log-manager.c index e82a91c..3a2bf3f 100644 --- a/tests/dbus/test-log-manager.c +++ b/tests/dbus/test-log-manager.c @@ -5,6 +5,7 @@ #include "lib/util.h" #include "lib/simple-account.h" #include "lib/simple-account-manager.h" +#include "lib/logger-test-helper.h" #include "telepathy-logger/debug-internal.h" #include "telepathy-logger/log-manager-internal.h" diff --git a/tests/lib/logger-test-helper.c b/tests/lib/logger-test-helper.c index ecba2ef..6c5a59b 100644 --- a/tests/lib/logger-test-helper.c +++ b/tests/lib/logger-test-helper.c @@ -22,6 +22,8 @@ #include "logger-test-helper.h" +#include + #include "util.h" void @@ -62,3 +64,23 @@ tpl_test_release_account (TpDBusDaemon *dbus, g_object_unref (account_service); g_object_unref (account); } + +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); +} diff --git a/tests/lib/logger-test-helper.h b/tests/lib/logger-test-helper.h index 8464e13..91f27b4 100644 --- a/tests/lib/logger-test-helper.h +++ b/tests/lib/logger-test-helper.h @@ -35,4 +35,6 @@ void tpl_test_release_account (TpDBusDaemon *dbus, TpAccount *account, TpTestsSimpleAccount *account_service); +void tp_tests_copy_dir (const gchar *from_dir, const gchar *to_dir); + #endif diff --git a/tests/lib/util.c b/tests/lib/util.c index 8d5a7ea..6fd7b1b 100644 --- a/tests/lib/util.c +++ b/tests/lib/util.c @@ -498,23 +498,3 @@ tp_tests_connection_run_until_contact_by_id (TpConnection *connection, return contact; } - -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); -} diff --git a/tests/lib/util.h b/tests/lib/util.h index 1c40f42..7c75765 100644 --- a/tests/lib/util.h +++ b/tests/lib/util.h @@ -81,6 +81,4 @@ TpContact *tp_tests_connection_run_until_contact_by_id ( guint n_features, const TpContactFeature *features); -void tp_tests_copy_dir (const gchar *from_dir, const gchar *to_dir); - #endif /* #ifndef __TP_TESTS_LIB_UTIL_H__ */ -- 1.8.3.1