summaryrefslogtreecommitdiff
path: root/tests/repo-finder-mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/repo-finder-mount.c')
-rw-r--r--tests/repo-finder-mount.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/tests/repo-finder-mount.c b/tests/repo-finder-mount.c
index 66c4ecd7..68a0e3de 100644
--- a/tests/repo-finder-mount.c
+++ b/tests/repo-finder-mount.c
@@ -24,22 +24,20 @@
#include "config.h"
#include <gio/gio.h>
-#include <glib.h>
#include <glib-object.h>
+#include <glib.h>
#include <libglnx.h>
#include <locale.h>
#include "ostree-autocleanups.h"
#include "ostree-remote-private.h"
-#include "ostree-repo-finder.h"
#include "ostree-repo-finder-mount.h"
+#include "ostree-repo-finder.h"
#include "ostree-types.h"
#include "test-mock-gio.h"
static void
-result_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
+result_cb (GObject *source_object, GAsyncResult *result, gpointer user_data)
{
GAsyncResult **result_out = user_data;
*result_out = g_object_ref (result);
@@ -54,33 +52,35 @@ collection_ref_free0 (OstreeCollectionRef *ref)
int
main (int argc, char **argv)
{
- g_autoptr(GError) error = NULL;
+ g_autoptr (GError) error = NULL;
setlocale (LC_ALL, "");
if (argc < 5 || (argc % 2) != 1)
{
- g_printerr ("Usage: %s REPO MOUNT-ROOT COLLECTION-ID REF-NAME [COLLECTION-ID REF-NAME …]\n", argv[0]);
+ g_printerr ("Usage: %s REPO MOUNT-ROOT COLLECTION-ID REF-NAME [COLLECTION-ID REF-NAME …]\n",
+ argv[0]);
return 1;
}
- g_autoptr(GMainContext) context = g_main_context_new ();
+ g_autoptr (GMainContext) context = g_main_context_new ();
g_main_context_push_thread_default (context);
- g_autoptr(OstreeRepo) parent_repo = ostree_repo_open_at (AT_FDCWD, argv[1], NULL, &error);
+ g_autoptr (OstreeRepo) parent_repo = ostree_repo_open_at (AT_FDCWD, argv[1], NULL, &error);
g_assert_no_error (error);
/* Set up a mock volume. */
- g_autoptr(GFile) mount_root = g_file_new_for_commandline_arg (argv[2]);
- g_autoptr(GMount) mount = G_MOUNT (ostree_mock_mount_new ("mount", mount_root));
+ g_autoptr (GFile) mount_root = g_file_new_for_commandline_arg (argv[2]);
+ g_autoptr (GMount) mount = G_MOUNT (ostree_mock_mount_new ("mount", mount_root));
- g_autoptr(GList) mounts = g_list_prepend (NULL, mount);
+ g_autoptr (GList) mounts = g_list_prepend (NULL, mount);
- g_autoptr(GVolumeMonitor) monitor = ostree_mock_volume_monitor_new (mounts, NULL);
- g_autoptr(OstreeRepoFinderMount) finder = ostree_repo_finder_mount_new (monitor);
+ g_autoptr (GVolumeMonitor) monitor = ostree_mock_volume_monitor_new (mounts, NULL);
+ g_autoptr (OstreeRepoFinderMount) finder = ostree_repo_finder_mount_new (monitor);
/* Resolve the refs. */
- g_autoptr(GPtrArray) refs = g_ptr_array_new_with_free_func ((GDestroyNotify) collection_ref_free0);
+ g_autoptr (GPtrArray) refs
+ = g_ptr_array_new_with_free_func ((GDestroyNotify)collection_ref_free0);
for (gsize i = 3; i < argc; i += 2)
{
@@ -90,18 +90,18 @@ main (int argc, char **argv)
g_ptr_array_add (refs, ostree_collection_ref_new (collection_id, ref_name));
}
- g_ptr_array_add (refs, NULL); /* NULL terminator */
+ g_ptr_array_add (refs, NULL); /* NULL terminator */
- g_autoptr(GAsyncResult) async_result = NULL;
+ g_autoptr (GAsyncResult) async_result = NULL;
ostree_repo_finder_resolve_async (OSTREE_REPO_FINDER (finder),
- (const OstreeCollectionRef * const *) refs->pdata,
- parent_repo, NULL, result_cb, &async_result);
+ (const OstreeCollectionRef *const *)refs->pdata, parent_repo,
+ NULL, result_cb, &async_result);
while (async_result == NULL)
g_main_context_iteration (context, TRUE);
- g_autoptr(GPtrArray) results = ostree_repo_finder_resolve_finish (OSTREE_REPO_FINDER (finder),
- async_result, &error);
+ g_autoptr (GPtrArray) results
+ = ostree_repo_finder_resolve_finish (OSTREE_REPO_FINDER (finder), async_result, &error);
g_assert_no_error (error);
/* Check that the results are correct: the invalid refs should have been
@@ -115,11 +115,9 @@ main (int argc, char **argv)
g_hash_table_iter_init (&iter, result->ref_to_checksum);
- while (g_hash_table_iter_next (&iter, (gpointer *) &ref, (gpointer *) &checksum))
- g_print ("%" G_GSIZE_FORMAT " %s %s %s %s\n",
- i, ostree_remote_get_name (result->remote),
- ref->collection_id, ref->ref_name,
- checksum);
+ while (g_hash_table_iter_next (&iter, (gpointer *)&ref, (gpointer *)&checksum))
+ g_print ("%" G_GSIZE_FORMAT " %s %s %s %s\n", i, ostree_remote_get_name (result->remote),
+ ref->collection_id, ref->ref_name, checksum);
}
g_main_context_pop_thread_default (context);