[evolution-data-server/gnome-3-32] I#91 - Verify database presence in test-migration test



commit 1c58bf3030dad73e8b43aecfcbc5189be1803bab
Author: Milan Crha <mcrha redhat com>
Date:   Tue Mar 12 16:17:37 2019 +0100

    I#91 - Verify database presence in test-migration test
    
    Closes https://gitlab.gnome.org/GNOME/evolution-data-server/issues/91

 tests/book-migration/test-migration.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/tests/book-migration/test-migration.c b/tests/book-migration/test-migration.c
index 81eb7eeeb..172efa618 100644
--- a/tests/book-migration/test-migration.c
+++ b/tests/book-migration/test-migration.c
@@ -337,10 +337,15 @@ list_migration_sandboxes (void)
                        EDS_TEST_SQLITE_BOOKS, error->message);
 
        while ((filename = g_dir_read_name (dir)) != NULL) {
-
                gchar *fullpath = g_build_filename (EDS_TEST_SQLITE_BOOKS, filename, NULL);
+               gchar *old_bdb, *new_contactsdb;
+
+               old_bdb = g_build_filename (fullpath, "addressbook.dump", NULL);
+               new_contactsdb = g_build_filename (fullpath, "contacts.db", NULL);
 
-               if (g_file_test (fullpath, G_FILE_TEST_IS_DIR)) {
+               if (g_file_test (fullpath, G_FILE_TEST_IS_DIR) && (
+                   g_file_test (old_bdb, G_FILE_TEST_IS_REGULAR) ||
+                   g_file_test (new_contactsdb, G_FILE_TEST_IS_REGULAR))) {
 
 #if defined (TEST_VERSIONS_WITH_BDB)
                        sandboxes = g_list_prepend (sandboxes, g_strdup (filename));
@@ -349,15 +354,13 @@ list_migration_sandboxes (void)
                         * is the case then we skip the migration tests from versions of EDS where we
                         * used Berkeley DB
                         */
-                       gchar *old_bdb = g_build_filename (EDS_TEST_SQLITE_BOOKS, filename, 
"addressbook.dump", NULL);
-
                        if (!g_file_test (old_bdb, G_FILE_TEST_EXISTS))
                                sandboxes = g_list_prepend (sandboxes, g_strdup (filename));
-
-                       g_free (old_bdb);
 #endif
                }
 
+               g_free (old_bdb);
+               g_free (new_contactsdb);
                g_free (fullpath);
        }
 


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