[evolution-data-server] data-test-utils.c: Make sure Camel's provider dir exists during tests



commit c4b8d61c7a38541bc4156c14b24f87358e09834d
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jun 23 18:43:25 2014 +0200

    data-test-utils.c: Make sure Camel's provider dir exists during tests
    
    The 'make distcheck' fails due to nonexistence of the Camel's provider
    directory when running certain tests. Creating it, even left empty,
    fixes the tests failure and makes it pass properly.

 tests/libedata-book/Makefile.am       |    1 +
 tests/libedata-book/data-test-utils.c |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/tests/libedata-book/Makefile.am b/tests/libedata-book/Makefile.am
index edce8d7..470396d 100644
--- a/tests/libedata-book/Makefile.am
+++ b/tests/libedata-book/Makefile.am
@@ -24,6 +24,7 @@ libdata_test_utils_la_CPPFLAGS = \
        -DDATADIR=\"$(datadir)\" \
        -DSRCDIR=\""$(abs_srcdir)"\" \
        -DBUILDDIR=\""$(abs_topbuilddir)"\" \
+       -DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \
        -DINSTALLED_TEST_DIR=\""$(pkglibexecdir)/installed-tests"\" \
        $(EVOLUTION_ADDRESSBOOK_CFLAGS) \
        $(EVOLUTION_CALENDAR_CFLAGS) \
diff --git a/tests/libedata-book/data-test-utils.c b/tests/libedata-book/data-test-utils.c
index c175d36..29bba5e 100644
--- a/tests/libedata-book/data-test-utils.c
+++ b/tests/libedata-book/data-test-utils.c
@@ -28,6 +28,7 @@
 #include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 
 #include "data-test-utils.h"
 
@@ -202,6 +203,11 @@ e_sqlite_fixture_setup (EbSqlFixture *fixture,
        gchar  *filename, *directory;
        GError *error = NULL;
 
+       if (!g_file_test (CAMEL_PROVIDERDIR, G_FILE_TEST_IS_DIR | G_FILE_TEST_EXISTS)) {
+               if (g_mkdir_with_parents (CAMEL_PROVIDERDIR, 0700) == -1)
+                       g_warning ("%s: Failed to create folder '%s': %s\n", G_STRFUNC, CAMEL_PROVIDERDIR, 
g_strerror (errno));
+       }
+
        fixture->contacts =
                g_hash_table_new_full (
                        g_str_hash,


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