summaryrefslogtreecommitdiff
path: root/tests/lib/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/util.c')
-rw-r--r--tests/lib/util.c21
1 files changed, 21 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,