aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-05-10 05:35:12 +0800
committerXan Lopez <xan@igalia.com>2012-05-10 05:35:12 +0800
commit6c611eade581a8668e48270b39dc757830ce23ad (patch)
tree85c9114827eea052dbc023ef4d31165a775b07e5 /lib
parentd30b9aed33f491a430a79b36409655d2d45afa8d (diff)
downloadgsoc2013-epiphany-6c611eade581a8668e48270b39dc757830ce23ad.tar
gsoc2013-epiphany-6c611eade581a8668e48270b39dc757830ce23ad.tar.gz
gsoc2013-epiphany-6c611eade581a8668e48270b39dc757830ce23ad.tar.bz2
gsoc2013-epiphany-6c611eade581a8668e48270b39dc757830ce23ad.tar.lz
gsoc2013-epiphany-6c611eade581a8668e48270b39dc757830ce23ad.tar.xz
gsoc2013-epiphany-6c611eade581a8668e48270b39dc757830ce23ad.tar.zst
gsoc2013-epiphany-6c611eade581a8668e48270b39dc757830ce23ad.zip
tests: test that trying to run an invalid migration step fails
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am13
-rw-r--r--lib/ephy-profile-utils.c28
-rw-r--r--lib/ephy-profile-utils.h2
3 files changed, 33 insertions, 10 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a8a2f0eca..5632810a0 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -82,12 +82,13 @@ nodist_libephymisc_la_SOURCES = \
$(BUILT_SOURCES)
libephymisc_la_CPPFLAGS = \
- -I$(top_builddir)/lib \
- -I$(top_builddir)/lib/egg \
- -I$(top_srcdir)/lib/egg \
- -DDATADIR="\"$(datadir)\"" \
- -DSHARE_DIR=\"$(pkgdatadir)\" \
- -DTOP_SRC_DATADIR=\"$(top_srcdir)/data\" \
+ -I$(top_builddir)/lib \
+ -I$(top_builddir)/lib/egg \
+ -I$(top_srcdir)/lib/egg \
+ -DDATADIR="\"$(datadir)\"" \
+ -DSHARE_DIR=\"$(pkgdatadir)\" \
+ -DTOP_SRC_DATADIR=\"$(top_srcdir)/data\" \
+ -DTOP_BUILD_DIR=\"$(top_builddir)\" \
-DEXTENSIONS_DIR=\""$(libdir)/epiphany/$(EPIPHANY_API_VERSION)/extensions"\" \
$(AM_CPPFLAGS)
diff --git a/lib/ephy-profile-utils.c b/lib/ephy-profile-utils.c
index 05367be8e..3fd3c525c 100644
--- a/lib/ephy-profile-utils.c
+++ b/lib/ephy-profile-utils.c
@@ -188,21 +188,43 @@ _ephy_profile_utils_query_form_auth_data (const char *uri,
}
gboolean
-ephy_profile_utils_do_migration ()
+ephy_profile_utils_do_migration (int test_to_run, gboolean debug)
{
gboolean ret;
GError *error = NULL;
- char *argv[1] = { "ephy-profile-migrator" };
+ char *index = NULL, *path = NULL;
+ int status;
+ char *argv[3] = { "ephy_profile_migrator" };
char *envp[1] = { "EPHY_LOG_MODULES=ephy-profile" };
+ if (test_to_run != -1) {
+ index = g_strdup_printf ("%d", test_to_run);
+
+ argv[1] = "-d";
+ argv[2] = index;
+ argv[3] = NULL;
+ } else {
+ argv[1] = NULL;
+ }
+
+ if (debug) {
+ path = g_strdup_printf ("%s/lib/ephy-profile-migrator", TOP_BUILD_DIR);
+ argv[0] = path;
+ }
+
ret = g_spawn_sync (NULL, argv, envp, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL,
- NULL, &error);
+ &status, &error);
+ g_free (path);
+ g_free (index);
if (error) {
LOG ("Failed to run migrator: %s", error->message);
g_error_free (error);
}
+ if (status != 0)
+ ret = FALSE;
+
return ret;
}
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index 6a01549c7..9ae095735 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -32,7 +32,7 @@ int ephy_profile_utils_get_migration_version (void);
gboolean ephy_profile_utils_set_migration_version (int version);
-gboolean ephy_profile_utils_do_migration (void);
+gboolean ephy_profile_utils_do_migration (int test_to_run, gboolean debug);
void _ephy_profile_utils_store_form_auth_data (const char *uri,
const char *form_username,