Hi,

Just curious the source tarball didn't have a Changelog file inside?

And we'd better to have a summary of what's new in a new version in Changes 
file.

Peter

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Alberto
> Mardegan
> Sent: Tuesday, October 26, 2010 2:33 PM
> To: [email protected]
> Subject: [meego-commits] 8833: Changes to Trunk:Testing/libaccounts-glib
>
> Hi,
> I have made the following changes to libaccounts-glib in project 
> Trunk:Testing.
> Please review and accept ASAP.
>
> Thank You,
> Alberto Mardegan
>
> [This message was auto-generated]
>
> ---
>
> Request #8833:
>
>   submit:   devel:AccountsSSO/libaccounts-glib(r3) ->
> Trunk:Testing/libaccounts-glib
>
>
> Message:
>     Remove old tarball
>
> State:   new          2010-10-25T23:33:26 mardy
> Comment: None
>
>
>
> changes files:
> --------------
> --- libaccounts-glib.changes
> +++ libaccounts-glib.changes
> @@ -0,0 +1,3 @@
> +* Mon Oct 25 2010 Alberto Mardegan <[email protected]> - 0.58
> +- Update to 0.58
> +
>
> old:
> ----
>   libaccounts-glib-0.52.tar.gz
>
> new:
> ----
>   libaccounts-glib-0.58.tar.gz
>
> spec files:
> -----------
> --- libaccounts-glib.spec
> +++ libaccounts-glib.spec
> @@ -1,5 +1,5 @@
>  Name:           libaccounts-glib
> -Version:        0.52
> +Version:        0.58
>  Release:        1
>  License:        LGPLv2.1
>  Summary:        Nokia Maemo Accounts base library
>
> other changes:
> --------------
>
> ++++++ libaccounts-glib-0.52.tar.gz -> libaccounts-glib-0.58.tar.gz
> --- configure.ac
> +++ configure.ac
> @@ -1,6 +1,6 @@
>  dnl Process this file with autoconf to produce a configure script.
>
> -AC_INIT(libaccounts-glib, 0.52)
> +AC_INIT(libaccounts-glib, 0.58)
>
>  AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
>  AM_CONFIG_HEADER(config.h)
> --- libaccounts-glib/Makefile.am
> +++ libaccounts-glib/Makefile.am
> @@ -3,7 +3,9 @@
>
>  libaccounts_glib_la_CFLAGS = $(LIBACCOUNTS_CFLAGS) -Wall -Werror
>  libaccounts_glib_la_LIBADD = $(LIBACCOUNTS_LIBS) -lrt
> -libaccounts_glib_la_LDFLAGS = -version-info 1:3:1
> +libaccounts_glib_la_LDFLAGS = \
> +     -version-info 1:3:1 \
> +     -export-symbols-regex '^ag_'
>
>  BUILT_SOURCES = \
>       ag-marshal.c \
> --- libaccounts-glib/ag-account.c
> +++ libaccounts-glib/ag-account.c
> @@ -52,6 +52,7 @@
>      PROP_ID,
>      PROP_MANAGER,
>      PROP_PROVIDER,
> +    PROP_FOREIGN,
>  };
>
>  enum
> @@ -101,6 +102,11 @@
>       * AgAccountWatch-es. */
>      GHashTable *watches;
>
> +    /* The "foreign" flag means that the account has been created by
> another
> +     * instance and we got informed about it from D-Bus. In this case, all 
> the
> +     * informations that we get via D-Bus will be cached in the
> +     * AgServiceSetting structures. */
> +    guint foreign : 1;
>      guint enabled : 1;
>      guint deleted : 1;
>  };
> @@ -468,11 +474,25 @@
>          GValue *value;
>          GHashTable *watches = NULL;
>
> -        /* if the changed service doesn't have a AgServiceSettings entry it
> -         * means that the service was never selected on this account, so we
> -         * don't need to update its settings. */
> -        if (!priv->services) continue;
> -        ss = g_hash_table_lookup (priv->services, service_name);
> +        if (priv->foreign)
> +        {
> +            /* If the account has been created from another instance
> +             * (which might be in another process), the "changes"
> structure
> +             * contains all the account settings for all services.
> +             *
> +             * Instead of discarding this precious information, we store all
> +             * the settings in memory, to minimize future disk accesses.
> +             */
> +            ss = get_service_settings (priv, sc->service, TRUE);
> +        }
> +        else
> +        {
> +            /* if the changed service doesn't have a AgServiceSettings
> entry it
> +             * means that the service was never selected on this account,
> so we
> +             * don't need to update its settings. */
> +            if (!priv->services) continue;
> +            ss = g_hash_table_lookup (priv->services, service_name);
> +        }
>          if (!ss) continue;
>
>          /* get the watches associated to this service */
> @@ -509,7 +529,7 @@
>              g_hash_table_iter_steal (&si);
>
>              if (value)
> -                g_hash_table_replace (ss->settings, key, value);
> +                g_hash_table_replace (ss->settings, g_strdup (key),
> value);
>              else
>                  g_hash_table_remove (ss->settings, key);
>
> @@ -525,6 +545,7 @@
>                  g_signal_emit (account, signals[ENABLED], 0,
>                                 service_name, enabled);
>              }
> +         g_free(key);
>          }
>      }
>
> @@ -721,7 +742,8 @@
>          }
>      }
>
> -    ag_account_select_service (account, NULL);
> +    if (!account->priv->foreign)
> +        ag_account_select_service (account, NULL);
>
>      return object;
>  }
> @@ -753,6 +775,9 @@
>              changes->created = TRUE;
>          }
>          break;
> +    case PROP_FOREIGN:
> +        priv->foreign = g_value_get_boolean (value);
> +        break;
>      default:
>          G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id,
> pspec);
>          break;
> @@ -832,6 +857,13 @@
>                                G_PARAM_WRITABLE |
> G_PARAM_CONSTRUCT_ONLY |
>                                G_PARAM_STATIC_STRINGS));
>
> +    g_object_class_install_property
> +        (object_class, PROP_FOREIGN,
> +         g_param_spec_boolean ("foreign", "foreign", "foreign",
> +                               FALSE,
> +                               G_PARAM_WRITABLE |
> G_PARAM_CONSTRUCT_ONLY |
> +                               G_PARAM_STATIC_STRINGS));
> +
>      /**
>       * AgAccount::enabled:
>       * @account: the #AgAccount.
> @@ -883,7 +915,7 @@
>  }
>
>  AgAccountChanges *
> -_ag_account_changes_from_dbus (DBusMessageIter *iter,
> +_ag_account_changes_from_dbus (AgManager *manager, DBusMessageIter
> *iter,
>                                 gboolean created, gboolean deleted)
>  {
>      AgAccountChanges *changes;
> @@ -926,7 +958,11 @@
>          dbus_message_iter_next (&i_struct);
>
>          sc = g_slice_new0 (AgServiceChanges);
> -        sc->service = NULL;
> +        if (service_name != NULL && strcmp (service_name,
> SERVICE_GLOBAL) == 0)
> +            sc->service = NULL;
> +        else
> +            sc->service = _ag_manager_get_service_lazy (manager,
> service_name,
> +
> service_type);
>          sc->service_type = g_strdup (service_type);
>
>          sc->settings = g_hash_table_new_full
> @@ -1309,8 +1345,9 @@
>      {
>          AgService *service = list->data;
>
> -        if (service->provider &&
> -            strcmp (service->provider, priv->provider_name) == 0)
> +        const gchar *provider = ag_service_get_provider (service);
> +        if (provider &&
> +            strcmp (provider, priv->provider_name) == 0)
>          {
>              services = g_list_prepend (services, service);
>          }
> @@ -1350,9 +1387,9 @@
>      for (list = all_services; list != NULL; list = list->next)
>      {
>          AgService *service = list->data;
> -
> -        if (service->provider &&
> -            strcmp (service->provider, priv->provider_name) == 0)
> +        const gchar *provider = ag_service_get_provider (service);
> +        if (provider &&
> +            strcmp (provider, priv->provider_name) == 0)
>          {
>              services = g_list_prepend (services, service);
>          }
> @@ -1374,6 +1411,32 @@
>      return TRUE;
>  }
>
> +static inline GList *
> +list_enabled_services_from_memory (AgAccountPrivate *priv,
> +                                   const gchar *service_type)
> +{
> +    GHashTableIter iter;
> +    AgServiceSettings *ss;
> +    GList *list = NULL;
> +
> +    g_hash_table_iter_init (&iter, priv->services);
> +    while (g_hash_table_iter_next (&iter, NULL, (gpointer)&ss))
> +    {
> +        GValue *value;
> +
> +        if (ss->service == NULL) continue;
> +
> +        if (service_type != NULL &&
> +            g_strcmp0 (ag_service_get_service_type (ss->service),
> service_type) != 0)
> +                continue;
> +
> +        value = g_hash_table_lookup (ss->settings, "enabled");
> +        if (value != NULL && g_value_get_boolean (value))
> +            list = g_list_prepend (list, ag_service_ref(ss->service));
> +    }
> +    return list;
> +}
> +
>  /**
>   * ag_account_list_enabled_services:
>   * @account: the #AgAccount.
> @@ -1388,13 +1451,17 @@
>      GList *list = NULL;
>      GList *iter;
>      GList *services = NULL;
> +    const gchar *service_type;
>      char sql[512];
>
>      g_return_val_if_fail (AG_IS_ACCOUNT (account), NULL);
>      priv = account->priv;
>
> -    g_return_val_if_fail (AG_IS_ACCOUNT (account), NULL);
> -    const char *service_type =
> ag_manager_get_service_type(priv->manager);
> +    service_type = ag_manager_get_service_type (priv->manager);
> +
> +    /* avoid accessing the DB, if possible */
> +    if (priv->foreign)
> +        return list_enabled_services_from_memory (priv, service_type);
>
>      if (service_type != NULL)
>          sqlite3_snprintf (sizeof (sql), sql,
> @@ -1517,7 +1584,7 @@
>
>      priv->service = service;
>
> -    if ((service == NULL || service->id != 0) && account->id != 0 &&
> +    if (account->id != 0 &&
>          !get_service_settings (priv, service, FALSE))
>      {
>          /* the settings for this service are not yet loaded: do it now */
> @@ -1531,7 +1598,7 @@
>          guint service_id;
>          gchar sql[128];
>
> -        service_id = (service != NULL) ? service->id : 0;
> +        service_id = _ag_manager_get_service_id (priv->manager, service);
>          g_snprintf (sql, sizeof (sql),
>                      "SELECT key, type, value FROM Settings "
>                      "WHERE account = %u AND service = %u",
> --- libaccounts-glib/ag-internals.h
> +++ libaccounts-glib/ag-internals.h
> @@ -70,7 +70,8 @@
>                                         AgAccountChanges
> *changes,
>                                         const struct timespec *ts);
>  G_GNUC_INTERNAL
> -AgAccountChanges *_ag_account_changes_from_dbus (DBusMessageIter
> *iter,
> +AgAccountChanges *_ag_account_changes_from_dbus (AgManager
> *manager,
> +
> DBusMessageIter *iter,
>                                                   gboolean
> created,
>                                                   gboolean
> deleted);
>
> @@ -97,6 +98,13 @@
>  G_GNUC_INTERNAL
>  const GError *_ag_manager_get_last_error (AgManager *manager);
>
> +G_GNUC_INTERNAL
> +AgService *_ag_manager_get_service_lazy (AgManager *manager,
> +                                         const gchar
> *service_name,
> +                                         const gchar
> *service_type);
> +G_GNUC_INTERNAL
> +guint _ag_manager_get_service_id (AgManager *manager, AgService
> *service);
> +
>  struct _AgService {
>      /*< private >*/
>      gint ref_count;
> @@ -117,6 +125,9 @@
>
>  G_GNUC_INTERNAL
>  AgService *_ag_service_new_from_file (const gchar *service_name);
> +G_GNUC_INTERNAL
> +AgService *_ag_service_new_with_type (const gchar *service_name,
> +                                      const gchar *service_type);
>
>  G_GNUC_INTERNAL
>  GHashTable *_ag_service_load_default_settings (AgService *service);
> @@ -125,7 +136,7 @@
>  const GValue *_ag_service_get_default_setting (AgService *service,
>                                                 const gchar *key);
>
> -inline
> +G_GNUC_INTERNAL
>  AgService *_ag_service_new (void);
>
>  struct _AgProvider {
> --- libaccounts-glib/ag-manager.c
> +++ libaccounts-glib/ag-manager.c
> @@ -393,7 +393,7 @@
>          esd->must_process = TRUE;
>      }
>
> -    changes = _ag_account_changes_from_dbus (&iter, created, deleted);
> +    changes = _ag_account_changes_from_dbus (manager, &iter, created,
> deleted);
>
>      /* check if the account is loaded */
>      account = g_hash_table_lookup (priv->accounts,
> @@ -415,6 +415,7 @@
>                                  "manager", manager,
>                                  "provider", provider_name,
>                                  "id", account_id,
> +                                "foreign", created,
>                                  NULL);
>          g_return_val_if_fail (AG_IS_ACCOUNT (account),
>
> DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
> @@ -1367,7 +1368,7 @@
>      priv = manager->priv;
>
>      if (priv->last_error)
> -        g_free (priv->last_error);
> +        g_error_free (priv->last_error);
>      priv->last_error = error;
>  }
>
> @@ -1588,6 +1589,29 @@
>      return account;
>  }
>
> +/* This is called when creating AgService objects from inside the DBus
> + * handler: we don't want to access the Db from there */
> +AgService *
> +_ag_manager_get_service_lazy (AgManager *manager, const gchar
> *service_name,
> +                              const gchar *service_type)
> +{
> +    AgManagerPrivate *priv;
> +    AgService *service;
> +
> +    g_return_val_if_fail (AG_IS_MANAGER (manager), NULL);
> +    g_return_val_if_fail (service_name != NULL, NULL);
> +    priv = manager->priv;
> +
> +    service = g_hash_table_lookup (priv->services, service_name);
> +    if (service)
> +        return ag_service_ref (service);
> +
> +    service = _ag_service_new_with_type (service_name, service_type);
> +
> +    g_hash_table_insert (priv->services, service->name, service);
> +    return ag_service_ref (service);
> +}
> +
>  /**
>   * ag_manager_get_service:
>   * @manager: the #AgManager.
> @@ -1646,6 +1670,35 @@
>      return ag_service_ref (service);
>  }
>
> +guint
> +_ag_manager_get_service_id (AgManager *manager, AgService *service)
> +{
> +    g_return_val_if_fail (AG_IS_MANAGER (manager), 0);
> +
> +    if (service == NULL) return 0; /* global service */
> +
> +    if (service->id == 0)
> +    {
> +        gchar *sql;
> +        gint rows;
> +
> +        /* We got this service name from another process; load the id from
> the
> +         * DB - it must already exist */
> +        sql = sqlite3_mprintf ("SELECT id FROM Services WHERE name
> = %Q",
> +                               service->name);
> +        rows = _ag_manager_exec_query (manager,
> (AgQueryCallback)got_service_id,
> +                                       service, sql);
> +        sqlite3_free (sql);
> +        if (G_UNLIKELY (rows != 1))
> +        {
> +            g_warning ("%s: got %d rows when asking for service %s",
> +                       G_STRFUNC, rows, service->name);
> +        }
> +    }
> +
> +    return service->id;
> +}
> +
>  /**
>   * ag_manager_list_services:
>   * @manager: the #AgManager.
> @@ -1698,8 +1751,8 @@
>      for (list = all_services; list != NULL; list = list->next)
>      {
>          AgService *service = list->data;
> -
> -        if (service->type && strcmp (service->type, service_type) == 0)
> +        const gchar *serviceType = ag_service_get_service_type (service);
> +        if (serviceType && strcmp (serviceType, service_type) == 0)
>          {
>              services = g_list_prepend (services, service);
>          }
> --- libaccounts-glib/ag-provider.c
> +++ libaccounts-glib/ag-provider.c
> @@ -253,7 +253,7 @@
>      return filepath;
>  }
>
> -AgProvider *
> +static AgProvider *
>  _ag_provider_new (void)
>  {
>      AgProvider *provider;
> --- libaccounts-glib/ag-service.c
> +++ libaccounts-glib/ag-service.c
> @@ -382,6 +382,18 @@
>      return service;
>  }
>
> +AgService *
> +_ag_service_new_with_type (const gchar *service_name, const gchar
> *service_type)
> +{
> +    AgService *service;
> +
> +    service = _ag_service_new ();
> +    service->name = g_strdup (service_name);
> +    service->type = g_strdup (service_type);
> +
> +    return service;
> +}
> +
>  GHashTable *
>  _ag_service_load_default_settings (AgService *service)
>  {
> @@ -440,6 +452,8 @@
>  ag_service_get_display_name (AgService *service)
>  {
>      g_return_val_if_fail (service != NULL, NULL);
> +    if (service->display_name == NULL && !service->file_data)
> +        _ag_service_load_from_file (service);
>      return service->display_name;
>  }
>
> @@ -453,6 +467,8 @@
>  ag_service_get_service_type (AgService *service)
>  {
>      g_return_val_if_fail (service != NULL, NULL);
> +    if (service->type == NULL && !service->file_data)
> +        _ag_service_load_from_file (service);
>      return service->type;
>  }
>
> @@ -466,6 +482,8 @@
>  ag_service_get_provider (AgService *service)
>  {
>      g_return_val_if_fail (service != NULL, NULL);
> +    if (service->provider == NULL && !service->file_data)
> +        _ag_service_load_from_file (service);
>      return service->provider;
>  }
>
> --- tests/accounts-glib-test.sh.in
> +++ tests/accounts-glib-test.sh.in
> @@ -9,4 +9,4 @@
>  export ag_provide...@testdatadir@/
>  export ACCOUNTS=/tmp/
>
> -accounts-glib-testsuite
> +accounts-glib-testsuite "$@"
> --- tests/check_ag.c
> +++ tests/check_ag.c
> @@ -2085,56 +2085,182 @@
>  }
>  END_TEST
>
> +static void
> +on_account_created_with_db_locked (AgManager *manager, AgAccountId
> account_id)
> +{
> +    AgAccount *account;
> +    AgService *service;
> +    const gchar *name;
> +    GList *list;
> +
> +    g_debug ("%s called (%u)", G_STRFUNC, account_id);
> +
> +    account = ag_manager_get_account (manager, account_id);
> +    fail_unless (account != NULL);
> +
> +    g_debug ("account loaded");
> +    list = ag_account_list_enabled_services (account);
> +    fail_unless (list != NULL);
> +    fail_unless (g_list_length (list) == 1);
> +
> +    service = list->data;
> +    fail_unless (service != NULL);
> +
> +    name = ag_service_get_name (service);
> +    fail_unless (strcmp (name, "MyService") == 0);
> +
> +    ag_service_list_free (list);
> +    g_main_loop_quit (main_loop);
> +}
> +
> +START_TEST(test_db_access)
> +{
> +    const gchar *lock_filename;
> +    gchar command[512];
> +    gint timeout_ms;
> +    gint fd;
> +
> +    /* This test is for making sure that no DB accesses occur while certain
> +     * events occur.
> +     *
> +     * Checked scenarios:
> +     *
> +     * - when another process creates an account and we get the
> +     *   account-created signal and call
> +     *   ag_account_list_enabled_services(), we shouldn't be blocked.
> +     */
> +    g_type_init ();
> +
> +    /* first, create a lock file to synchronize the test */
> +    lock_filename = "/tmp/check_ag.lock";
> +    fd = open (lock_filename, O_CREAT | O_RDWR, 0666);
> +
> +    timeout_ms = 2000; /* two seconds */
> +
> +    manager = ag_manager_new ();
> +    ag_manager_set_db_timeout (manager, 0);
> +    ag_manager_set_abort_on_db_timeout (manager, TRUE);
> +    g_signal_connect (manager, "account-created",
> +                      G_CALLBACK
> (on_account_created_with_db_locked), NULL);
> +
> +    /* create an account with the e-mail service type enabled */
> +    system ("test-process create3 myprovider MyAccountName");
> +
> +    /* lock the DB for the specified timeout */
> +    sprintf (command, "test-process lock_db %d %s &",
> +             timeout_ms, lock_filename);
> +    system (command);
> +
> +    /* wait till the file is locked */
> +    while (lockf (fd, F_TEST, 0) == 0)
> +        sched_yield ();
> +
> +    /* now the DB is locked; we iterate the main loop to get the signals
> +     * about the account creation and do some operations with the account.
> +     * We expect to never get any error because of the locked DB, as the
> +     * methods we are calling should not access it */
> +
> +    main_loop = g_main_loop_new (NULL, FALSE);
> +    source_id = g_timeout_add_seconds (timeout_ms / 1000,
> +                                       concurrency_test_failed,
> NULL);
> +    g_debug ("Running loop");
> +    g_main_loop_run (main_loop);
> +
> +    fail_unless (source_id != 0, "Timeout happened");
> +    g_source_remove (source_id);
> +
> +    end_test ();
> +}
> +END_TEST
> +
>  Suite *
> -ag_suite(void)
> +ag_suite(const char *test_case)
>  {
>      Suite *s = suite_create ("accounts-glib");
>
> -    /* Core test case */
> -    TCase * tc_core = tcase_create("Core");
> -    tcase_add_test (tc_core, test_init);
> -
> -    suite_add_tcase (s, tc_core);
> -
> -    TCase * tc_create = tcase_create("Create");
> -    tcase_add_test (tc_create, test_object);
> -    tcase_add_test (tc_create, test_provider);
> -    tcase_add_test (tc_create, test_store);
> -    tcase_add_test (tc_create, test_store_locked);
> -    tcase_add_test (tc_create, test_store_locked_unref);
> -    tcase_add_test (tc_create, test_service);
> -    tcase_add_test (tc_create, test_account_services);
> -    tcase_add_test (tc_create, test_signals);
> -    tcase_add_test (tc_create, test_list);
> -    tcase_add_test (tc_create, test_settings_iter);
> -    tcase_add_test (tc_create, test_list_services);
> -    tcase_add_test (tc_create, test_delete);
> -    tcase_add_test (tc_create, test_watches);
> -    tcase_add_test (tc_create, test_concurrency);
> -    tcase_add_test (tc_create, test_service_regression);
> -    tcase_add_test (tc_create, test_blocking);
> -    tcase_add_test (tc_create, test_sign_verify_key);
> -    tcase_add_test (tc_create, test_cache_regression);
> -    tcase_add_test (tc_create, test_serviceid_regression);
> -    tcase_add_test (tc_create, test_enabled_regression);
> -    tcase_add_test (tc_create, test_manager_new_for_service_type);
> -    tcase_add_test (tc_create, test_manager_enabled_event);
> -    tcase_add_test (tc_create, test_account_list_enabled_services);
> -    tcase_add_test (tc_create, test_open_locked);
> -    tcase_add_test (tc_create, test_read_locked);
> -    tcase_add_test (tc_create, test_service_type);
> +#define IF_TEST_CASE_ENABLED(test_name) \
> +    if (test_case == NULL || strcmp (test_name, test_case) == 0)
>
> -    tcase_set_timeout (tc_create, 10);
> +    TCase *tc;
>
> -    suite_add_tcase (s, tc_create);
> +    tc = tcase_create("Core");
> +    tcase_add_test (tc, test_init);
> +    IF_TEST_CASE_ENABLED("Core")
> +        suite_add_tcase (s, tc);
> +
> +    tc = tcase_create("Create");
> +    tcase_add_test (tc, test_object);
> +    tcase_add_test (tc, test_provider);
> +    IF_TEST_CASE_ENABLED("Create")
> +        suite_add_tcase (s, tc);
> +
> +    tc = tcase_create("Store");
> +    tcase_add_test (tc, test_store);
> +    tcase_add_test (tc, test_store_locked);
> +    tcase_add_test (tc, test_store_locked_unref);
> +    IF_TEST_CASE_ENABLED("Store")
> +        suite_add_tcase (s, tc);
> +
> +    tc = tcase_create("Service");
> +    tcase_add_test (tc, test_service);
> +    tcase_add_test (tc, test_account_services);
> +    tcase_add_test (tc, test_settings_iter);
> +    tcase_add_test (tc, test_service_type);
> +    IF_TEST_CASE_ENABLED("Service")
> +        suite_add_tcase (s, tc);
> +
> +    tc = tcase_create("List");
> +    tcase_add_test (tc, test_list);
> +    tcase_add_test (tc, test_list_services);
> +    tcase_add_test (tc, test_account_list_enabled_services);
> +    IF_TEST_CASE_ENABLED("List")
> +        suite_add_tcase (s, tc);
> +
> +    tc = tcase_create("Signalling");
> +    tcase_add_test (tc, test_signals);
> +    tcase_add_test (tc, test_delete);
> +    tcase_add_test (tc, test_watches);
> +    IF_TEST_CASE_ENABLED("Signalling")
> +        suite_add_tcase (s, tc);
> +
> +    tc = tcase_create("Concurrency");
> +    tcase_add_test (tc, test_concurrency);
> +    tcase_add_test (tc, test_blocking);
> +    tcase_add_test (tc, test_sign_verify_key);
> +    tcase_add_test (tc, test_manager_new_for_service_type);
> +    tcase_add_test (tc, test_manager_enabled_event);
> +    tcase_add_test (tc, test_open_locked);
> +    tcase_add_test (tc, test_read_locked);
> +    tcase_set_timeout (tc, 10);
> +    IF_TEST_CASE_ENABLED("Concurrency")
> +        suite_add_tcase (s, tc);
> +
> +    tc = tcase_create("Regression");
> +    tcase_add_test (tc, test_service_regression);
> +    tcase_add_test (tc, test_cache_regression);
> +    tcase_add_test (tc, test_serviceid_regression);
> +    tcase_add_test (tc, test_enabled_regression);
> +    IF_TEST_CASE_ENABLED("Regression")
> +        suite_add_tcase (s, tc);
> +
> +    tc = tcase_create("Caching");
> +    tcase_add_test (tc, test_db_access);
> +    tcase_set_timeout (tc, 10);
> +    IF_TEST_CASE_ENABLED("Caching")
> +        suite_add_tcase (s, tc);
>
>      return s;
>  }
>
> -int main(void)
> +int main(int argc, char **argv)
>  {
>      int number_failed;
> -    Suite * s = ag_suite();
> +    const char *test_case = NULL;
> +
> +    if (argc > 1)
> +        test_case = argv[1];
> +
> +    Suite * s = ag_suite(test_case);
>      SRunner * sr = srunner_create(s);
>
>      db_filename = g_build_filename (g_getenv ("ACCOUNTS"),
> "accounts.db",
> --- tests/test-process.c
> +++ tests/test-process.c
> @@ -203,6 +203,57 @@
>      return FALSE;
>  }
>
> +gboolean test_create3 (TestArgs *args)
> +{
> +    GValue value = { 0 };
> +
> +    manager = ag_manager_new ();
> +
> +    account = ag_manager_create_account (manager, args->argv[0]);
> +
> +    if (args->argc > 1)
> +    {
> +        ag_account_set_display_name (account, args->argv[1]);
> +    }
> +
> +    g_value_init (&value, G_TYPE_INT);
> +    g_value_set_int (&value, -12345);
> +    ag_account_set_value (account, "integer", &value);
> +    g_value_unset (&value);
> +
> +    g_value_init (&value, G_TYPE_STRING);
> +    g_value_set_static_string (&value, "a string");
> +    ag_account_set_value (account, "string", &value);
> +    g_value_unset (&value);
> +
> +    ag_account_set_enabled (account, TRUE);
> +
> +    /* also set some keys in one service */
> +    service = ag_manager_get_service (manager, "MyService");
> +    ag_account_select_service (account, service);
> +
> +    g_value_init (&value, G_TYPE_UINT);
> +    g_value_set_uint (&value, 54321);
> +    ag_account_set_value (account, "unsigned", &value);
> +    g_value_unset (&value);
> +
> +    g_value_init (&value, G_TYPE_CHAR);
> +    g_value_set_char (&value, 'z');
> +    ag_account_set_value (account, "character", &value);
> +    g_value_unset (&value);
> +
> +    g_value_init (&value, G_TYPE_BOOLEAN);
> +    g_value_set_boolean (&value, TRUE);
> +    ag_account_set_value (account, "boolean", &value);
> +    g_value_unset (&value);
> +
> +    ag_account_set_enabled (account, TRUE);
> +
> +    ag_account_store (account, account_store_cb, NULL);
> +
> +    return FALSE;
> +}
> +
>  gboolean test_change (TestArgs *args)
>  {
>      GValue value = { 0 };
> @@ -323,6 +374,10 @@
>          {
>              g_idle_add ((GSourceFunc)test_create2, &args);
>          }
> +        else if (strcmp (test_name, "create3") == 0)
> +        {
> +            g_idle_add ((GSourceFunc)test_create3, &args);
> +        }
>          else if (strcmp (test_name, "change") == 0)
>          {
>              g_idle_add ((GSourceFunc)test_change, &args);
>
> _______________________________________________
> Meego-commits mailing list
> [email protected]
> http://lists.meego.com/listinfo/meego-commits
_______________________________________________
MeeGo-packaging mailing list
[email protected]
http://lists.meego.com/listinfo/meego-packaging

Reply via email to