test-libarchive-import: Skip if extended attributes are unsupported

This is the case at build-time on some (all?) Debian autobuilders.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1120
Approved by: cgwalters
This commit is contained in:
Simon McVittie 2017-08-29 16:46:19 +01:00 committed by Atomic Bot
parent 5f8e339e45
commit 760ff2f66e
1 changed files with 56 additions and 1 deletions

View File

@ -35,6 +35,7 @@ typedef struct {
int fd;
int fd_empty;
char *tmpd;
GError *skip_all;
} TestData;
static void
@ -136,7 +137,13 @@ test_data_init (TestData *td)
g_assert_cmpint (0, ==, mkdir ("repo", 0755));
ostree_repo_create (td->repo, OSTREE_REPO_MODE_BARE_USER, NULL, &error);
g_assert_no_error (error);
/* G_IO_ERROR_NOT_SUPPORTED probably means no extended attribute support */
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
g_propagate_prefixed_error (&td->skip_all, g_steal_pointer (&error),
"Unable to set up repository: ");
else
g_assert_no_error (error);
}
}
@ -169,6 +176,12 @@ test_libarchive_noautocreate_empty (gconstpointer data)
OstreeRepoImportArchiveOptions opts = { 0, };
glnx_unref_object OstreeMutableTree *mtree = ostree_mutable_tree_new ();
if (td->skip_all != NULL)
{
g_test_skip (td->skip_all->message);
return;
}
test_archive_setup (td->fd_empty, a);
(void)ostree_repo_import_archive_to_mtree (td->repo, &opts, a, mtree, NULL, NULL, &error);
@ -185,6 +198,12 @@ test_libarchive_autocreate_empty (gconstpointer data)
OstreeRepoImportArchiveOptions opts = { 0, };
glnx_unref_object OstreeMutableTree *mtree = ostree_mutable_tree_new ();
if (td->skip_all != NULL)
{
g_test_skip (td->skip_all->message);
return;
}
opts.autocreate_parents = 1;
test_archive_setup (td->fd_empty, a);
@ -203,6 +222,12 @@ test_libarchive_error_device_file (gconstpointer data)
OstreeRepoImportArchiveOptions opts = { 0, };
glnx_unref_object OstreeMutableTree *mtree = ostree_mutable_tree_new ();
if (td->skip_all != NULL)
{
g_test_skip (td->skip_all->message);
return;
}
test_archive_setup (td->fd, a);
(void)ostree_repo_import_archive_to_mtree (td->repo, &opts, a, mtree, NULL, NULL, &error);
@ -276,6 +301,12 @@ test_libarchive_ignore_device_file (gconstpointer data)
if (skip_if_no_xattr (td))
goto out;
if (td->skip_all != NULL)
{
g_test_skip (td->skip_all->message);
goto out;
}
test_archive_setup (td->fd, a);
opts.ignore_unsupported_content = TRUE;
@ -338,6 +369,12 @@ test_libarchive_ostree_convention (gconstpointer data)
if (skip_if_no_xattr (td))
goto out;
if (td->skip_all != NULL)
{
g_test_skip (td->skip_all->message);
goto out;
}
test_archive_setup (td->fd, a);
opts.autocreate_parents = TRUE;
@ -382,6 +419,12 @@ test_libarchive_xattr_callback (gconstpointer data)
if (skip_if_no_xattr (td))
goto out;
if (td->skip_all != NULL)
{
g_test_skip (td->skip_all->message);
goto out;
}
modifier = ostree_repo_commit_modifier_new (0, NULL, NULL, NULL);
ostree_repo_commit_modifier_set_xattr_callback (modifier, xattr_cb,
NULL, NULL);
@ -437,6 +480,12 @@ entry_pathname_test_helper (gconstpointer data, gboolean on)
if (skip_if_no_xattr (td))
goto out;
if (td->skip_all != NULL)
{
g_test_skip (td->skip_all->message);
goto out;
}
modifier = ostree_repo_commit_modifier_new (0, NULL, NULL, NULL);
ostree_repo_commit_modifier_set_xattr_callback (modifier, path_cb,
NULL, &met_etc_file);
@ -500,6 +549,12 @@ test_libarchive_selinux (gconstpointer data)
if (skip_if_no_xattr (td))
goto out;
if (td->skip_all != NULL)
{
g_test_skip (td->skip_all->message);
goto out;
}
{
glnx_unref_object GFile *root = g_file_new_for_path ("/");