From 04aece20a39a353849b32ea3e4ae01a6c2fbba55 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 4 Apr 2019 15:35:02 +0200 Subject: [PATCH] tests: Add system-norevokefs alternative to check fallback paths Closes: #2657 Approved by: alexlarsson --- system-helper/flatpak-system-helper.c | 10 ++++++++++ tests/Makefile-test-matrix.am.inc | 4 ++++ tests/Makefile.am.inc | 6 +++--- tests/test-wrapper.sh | 4 ++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/system-helper/flatpak-system-helper.c b/system-helper/flatpak-system-helper.c index 516645df..97615744 100644 --- a/system-helper/flatpak-system-helper.c +++ b/system-helper/flatpak-system-helper.c @@ -47,6 +47,7 @@ G_LOCK_DEFINE (cache_dirs_in_use); static GHashTable *cache_dirs_in_use = NULL; static gboolean on_session_bus = FALSE; +static gboolean disable_revokefs = FALSE; static gboolean no_idle_exit = FALSE; #define IDLE_TIMEOUT_SECS 10 * 60 @@ -1647,6 +1648,12 @@ handle_get_revokefs_fd (FlatpakSystemHelper *object, g_debug ("GetRevokefsFd %u %s", arg_flags, arg_installation); + if (disable_revokefs) + { + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "RevokeFS disabled"); + return TRUE; + } + system = dir_get_system (arg_installation, get_sender_pid (invocation), &error); if (system == NULL) { @@ -2198,6 +2205,9 @@ main (int argc, g_setenv ("GIO_USE_VFS", "local", TRUE); + if (g_getenv ("FLATPAK_DISABLE_REVOKEFS")) + disable_revokefs = TRUE; + g_set_prgname (argv[0]); g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, message_handler, NULL); diff --git a/tests/Makefile-test-matrix.am.inc b/tests/Makefile-test-matrix.am.inc index e77deaee..5900c444 100644 --- a/tests/Makefile-test-matrix.am.inc +++ b/tests/Makefile-test-matrix.am.inc @@ -4,14 +4,18 @@ TEST_MATRIX= \ tests/test-run@user,deltas.wrap \ tests/test-run@system,nodeltas.wrap \ tests/test-run@system,deltas.wrap \ + tests/test-run@system-norevokefs,nodeltas.wrap \ + tests/test-run@system-norevokefs,deltas.wrap \ tests/test-info@user.wrap \ tests/test-info@system.wrap \ tests/test-repo@user.wrap \ tests/test-repo@system.wrap \ + tests/test-repo@system-norevokefs.wrap \ tests/test-repo@collections.wrap \ tests/test-repo@collections-server-only.wrap \ tests/test-bundle@user.wrap \ tests/test-bundle@system.wrap \ + tests/test-bundle@system-norevokefs.wrap \ tests/test-oci-registry@user.wrap \ tests/test-oci-registry@system.wrap \ $(NULL) diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc index 2da05366..c28fc44e 100644 --- a/tests/Makefile.am.inc +++ b/tests/Makefile.am.inc @@ -124,11 +124,11 @@ TEST_MATRIX_SOURCE = \ tests/test-config.sh \ tests/test-build-update-repo.sh \ tests/test-http-utils.sh \ - tests/test-run.sh{{user+system},{nodeltas+deltas}} \ + tests/test-run.sh{{user+system+system-norevokefs},{nodeltas+deltas}} \ tests/test-info.sh{user+system} \ - tests/test-repo.sh{user+system+collections+collections-server-only} \ + tests/test-repo.sh{user+system+system-norevokefs+collections+collections-server-only} \ tests/test-extensions.sh \ - tests/test-bundle.sh{user+system} \ + tests/test-bundle.sh{user+system+system-norevokefs} \ tests/test-oci.sh \ tests/test-oci-registry.sh{user+system} \ tests/test-unsigned-summaries.sh \ diff --git a/tests/test-wrapper.sh b/tests/test-wrapper.sh index dd191042..3dd79f45 100755 --- a/tests/test-wrapper.sh +++ b/tests/test-wrapper.sh @@ -5,6 +5,10 @@ for feature in $(echo $1 | sed "s/^.*@\(.*\).wrap/\1/" | tr "," "\n"); do system) export USE_SYSTEMDIR=yes ;; + system-norevokefs) + export USE_SYSTEMDIR=yes + export FLATPAK_DISABLE_REVOKEFS=yes + ;; user) export USE_SYSTEMDIR=no ;;