forked from Mirrors/flatpak-builder
test-doc-portal: skip all tests if no FUSE
Signed-off-by: Simon McVittie <smcv@debian.org>tingping/wmclass
parent
74c652a176
commit
aaae0d0b6d
|
@ -21,6 +21,7 @@ GTestDBus *dbus;
|
||||||
GDBusConnection *session_bus;
|
GDBusConnection *session_bus;
|
||||||
XdpDbusDocuments *documents;
|
XdpDbusDocuments *documents;
|
||||||
char *mountpoint;
|
char *mountpoint;
|
||||||
|
static gboolean have_fuse;
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
make_doc_dir (const char *id, const char *app)
|
make_doc_dir (const char *id, const char *app)
|
||||||
|
@ -157,6 +158,12 @@ test_create_doc (void)
|
||||||
const char *basename = "a-file";
|
const char *basename = "a-file";
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (!have_fuse)
|
||||||
|
{
|
||||||
|
g_test_skip ("this test requires FUSE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
id = export_new_file (basename, "content", FALSE);
|
id = export_new_file (basename, "content", FALSE);
|
||||||
|
|
||||||
assert_doc_has_contents (id, basename, NULL, "content");
|
assert_doc_has_contents (id, basename, NULL, "content");
|
||||||
|
@ -191,6 +198,12 @@ test_recursive_doc (void)
|
||||||
g_autofree char *path = NULL;
|
g_autofree char *path = NULL;
|
||||||
g_autofree char *app_path = NULL;
|
g_autofree char *app_path = NULL;
|
||||||
|
|
||||||
|
if (!have_fuse)
|
||||||
|
{
|
||||||
|
g_test_skip ("this test requires FUSE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
id = export_new_file (basename, "recursive-content", FALSE);
|
id = export_new_file (basename, "recursive-content", FALSE);
|
||||||
|
|
||||||
assert_doc_has_contents (id, basename, NULL, "recursive-content");
|
assert_doc_has_contents (id, basename, NULL, "recursive-content");
|
||||||
|
@ -215,9 +228,19 @@ static void
|
||||||
global_setup (void)
|
global_setup (void)
|
||||||
{
|
{
|
||||||
gboolean inited;
|
gboolean inited;
|
||||||
|
g_autofree gchar *fusermount = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gint exit_status;
|
gint exit_status;
|
||||||
|
|
||||||
|
fusermount = g_find_program_in_path ("fusermount");
|
||||||
|
/* cache result so subsequent tests can be marked as skipped */
|
||||||
|
have_fuse = (access ("/dev/fuse", W_OK) == 0 &&
|
||||||
|
fusermount != NULL &&
|
||||||
|
g_file_test (fusermount, G_FILE_TEST_IS_EXECUTABLE));
|
||||||
|
|
||||||
|
if (!have_fuse)
|
||||||
|
return;
|
||||||
|
|
||||||
g_mkdtemp (outdir);
|
g_mkdtemp (outdir);
|
||||||
g_print ("outdir: %s\n", outdir);
|
g_print ("outdir: %s\n", outdir);
|
||||||
|
|
||||||
|
@ -257,6 +280,9 @@ global_teardown (void)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (!have_fuse)
|
||||||
|
return;
|
||||||
|
|
||||||
g_free (mountpoint);
|
g_free (mountpoint);
|
||||||
|
|
||||||
g_object_unref (documents);
|
g_object_unref (documents);
|
||||||
|
|
Loading…
Reference in New Issue