forked from Mirrors/flatpak-builder
Merge pull request #108 from smcv/no-fuse
Fix `make check` when FUSE is unavailabletingping/wmclass
commit
a0a1bc4d0b
|
@ -52,3 +52,11 @@ lib/xdg-app-enum-types.c
|
||||||
lib/xdg-app-enum-types.h
|
lib/xdg-app-enum-types.h
|
||||||
test-libxdg-app
|
test-libxdg-app
|
||||||
XdgApp-1.0.*
|
XdgApp-1.0.*
|
||||||
|
/doc/reference/gtkdoc-check.log
|
||||||
|
/doc/reference/gtkdoc-check.test
|
||||||
|
/doc/reference/gtkdoc-check.trs
|
||||||
|
/test-doc-portal
|
||||||
|
/test-doc-portal.log
|
||||||
|
/test-doc-portal.trs
|
||||||
|
/testdb.log
|
||||||
|
/testdb.trs
|
||||||
|
|
|
@ -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");
|
||||||
|
@ -211,14 +224,23 @@ test_recursive_doc (void)
|
||||||
g_assert_cmpstr (id, ==, id3);
|
g_assert_cmpstr (id, ==, id3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static void
|
||||||
main (int argc, char **argv)
|
global_setup (void)
|
||||||
{
|
{
|
||||||
int res;
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -251,13 +273,15 @@ main (int argc, char **argv)
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
g_assert (inited);
|
g_assert (inited);
|
||||||
g_assert (mountpoint != NULL);
|
g_assert (mountpoint != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
static void
|
||||||
|
global_teardown (void)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
g_test_add_func ("/db/create_doc", test_create_doc);
|
if (!have_fuse)
|
||||||
g_test_add_func ("/db/recursive_doc", test_recursive_doc);
|
return;
|
||||||
|
|
||||||
res = g_test_run ();
|
|
||||||
|
|
||||||
g_free (mountpoint);
|
g_free (mountpoint);
|
||||||
|
|
||||||
|
@ -277,6 +301,23 @@ main (int argc, char **argv)
|
||||||
sleep (1);
|
sleep (1);
|
||||||
|
|
||||||
glnx_shutil_rm_rf_at (-1, outdir, NULL, NULL);
|
glnx_shutil_rm_rf_at (-1, outdir, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
|
||||||
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
|
g_test_add_func ("/db/create_doc", test_create_doc);
|
||||||
|
g_test_add_func ("/db/recursive_doc", test_recursive_doc);
|
||||||
|
|
||||||
|
global_setup ();
|
||||||
|
|
||||||
|
res = g_test_run ();
|
||||||
|
|
||||||
|
global_teardown ();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue