[PATCH spice-common 1/2] log: remove deprecated SPICE_ABORT_LEVEL support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This feature was marked obsolete by efd1d3cb4d8eee more than
three years ago.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 common/log.c         | 30 +-----------------------------
 tests/test-logging.c | 39 +--------------------------------------
 2 files changed, 2 insertions(+), 67 deletions(-)

diff --git a/common/log.c b/common/log.c
index a7806c5..5819974 100644
--- a/common/log.c
+++ b/common/log.c
@@ -33,11 +33,7 @@
 #include "backtrace.h"
 
 static int glib_debug_level = INT_MAX;
-static int abort_mask = 0;
-
-#ifndef SPICE_ABORT_MASK_DEFAULT
-#define SPICE_ABORT_MASK_DEFAULT (G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_ERROR)
-#endif
+static const int abort_mask = G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_ERROR;
 
 #define G_LOG_DOMAIN "Spice"
 
@@ -101,29 +97,6 @@ static void spice_log_set_debug_level(void)
     }
 }
 
-static void spice_log_set_abort_level(void)
-{
-    if (abort_mask == 0) {
-        const char *abort_str = g_getenv("SPICE_ABORT_LEVEL");
-        if (abort_str != NULL) {
-            GLogLevelFlags glib_abort_level;
-
-            /* FIXME: To be removed after enough deprecation time */
-            g_warning("Setting SPICE_ABORT_LEVEL is deprecated, use G_DEBUG instead");
-            glib_abort_level = spice_log_level_to_glib(atoi(abort_str));
-            unsigned int fatal_mask = G_LOG_FATAL_MASK;
-            while (glib_abort_level >= G_LOG_LEVEL_ERROR) {
-                fatal_mask |= glib_abort_level;
-                glib_abort_level >>= 1;
-            }
-            abort_mask = fatal_mask;
-            g_log_set_fatal_mask(G_LOG_DOMAIN, fatal_mask);
-        } else {
-            abort_mask = SPICE_ABORT_MASK_DEFAULT;
-        }
-    }
-}
-
 static void spice_logger(const gchar *log_domain,
                          GLogLevelFlags log_level,
                          const gchar *message,
@@ -139,7 +112,6 @@ SPICE_CONSTRUCTOR_FUNC(spice_log_init)
 {
 
     spice_log_set_debug_level();
-    spice_log_set_abort_level();
     if (glib_debug_level != INT_MAX) {
         /* If SPICE_DEBUG_LEVEL is set, we need a custom handler, which is
          * going to break use of g_log_set_default_handler() by apps
diff --git a/tests/test-logging.c b/tests/test-logging.c
index 559d656..3b17f44 100644
--- a/tests/test-logging.c
+++ b/tests/test-logging.c
@@ -44,37 +44,6 @@ LOG_OTHER_HELPER(warning, WARNING)
 LOG_OTHER_HELPER(critical, CRITICAL)
 
 #if GLIB_CHECK_VERSION(2,38,0)
-/* Checks that spice_warning() aborts after changing SPICE_ABORT_LEVEL */
-static void test_spice_abort_level(void)
-{
-    if (g_test_subprocess()) {
-        spice_warning("spice_warning");
-        return;
-    }
-    /* 2 = SPICE_LOG_LEVEL_WARNING  */
-    g_setenv("SPICE_ABORT_LEVEL", "2", TRUE);
-    g_test_trap_subprocess(NULL, 0, 0);
-    g_unsetenv("SPICE_ABORT_LEVEL");
-    g_test_trap_assert_failed();
-    g_test_trap_assert_stderr("*SPICE_ABORT_LEVEL*deprecated*");
-    g_test_trap_assert_stderr("*spice_warning*");
-}
-
-/* Checks that g_warning() aborts after changing SPICE_ABORT_LEVEL */
-static void test_spice_abort_level_g_warning(void)
-{
-    if (g_test_subprocess()) {
-        g_warning("g_warning");
-        return;
-    }
-    g_setenv("SPICE_ABORT_LEVEL", "2", TRUE);
-    g_test_trap_subprocess(NULL, 0, 0);
-    g_unsetenv("SPICE_ABORT_LEVEL");
-    g_test_trap_assert_failed();
-    g_test_trap_assert_stderr("*SPICE_ABORT_LEVEL*deprecated*");
-    g_test_trap_assert_stderr("*g_warning*");
-}
-
 /* Checks that spice_warning() aborts after setting G_DEBUG=fatal-warnings */
 static void test_spice_fatal_warning(void)
 {
@@ -283,7 +252,6 @@ static void test_spice_debug_level_warning(void)
         spice_info("spice_info");
         spice_debug("spice_debug");
         spice_warning("spice_warning");
-        spice_critical("spice_critical");
         g_debug("g_debug");
         g_info("g_info");
         g_message("g_message");
@@ -298,15 +266,12 @@ static void test_spice_debug_level_warning(void)
         return;
     }
 
-    g_setenv("SPICE_ABORT_LEVEL", "0", TRUE);
     g_setenv("SPICE_DEBUG_LEVEL", "1", TRUE);
     g_test_trap_subprocess(NULL, 0, 0);
-    g_unsetenv("SPICE_ABORT_LEVEL");
     g_unsetenv("SPICE_DEBUG_LEVEL");
     g_test_trap_assert_passed();
     g_test_trap_assert_stderr("*SPICE_DEBUG_LEVEL*deprecated*");
-    g_test_trap_assert_stderr("*SPICE_ABORT_LEVEL*deprecated*");
-    g_test_trap_assert_stderr("*spice_critical\n*g_critical\n*other_message\n*other_warning\n*other_critical\n");
+    g_test_trap_assert_stderr("*g_critical\n*other_message\n*other_warning\n*other_critical\n");
     g_test_trap_assert_stdout_unmatched("*spice_info*");
     g_test_trap_assert_stdout_unmatched("*spice_debug*");
     g_test_trap_assert_stderr_unmatched("*spice_warning*");
@@ -393,8 +358,6 @@ int main(int argc, char **argv)
     g_log_set_always_fatal(fatal_mask & G_LOG_LEVEL_MASK);
 
 #if GLIB_CHECK_VERSION(2,38,0)
-    g_test_add_func("/spice-common/spice-abort-level", test_spice_abort_level);
-    g_test_add_func("/spice-common/spice-abort-level-gwarning", test_spice_abort_level_g_warning);
     g_test_add_func("/spice-common/spice-debug-level", test_spice_debug_level);
     g_test_add_func("/spice-common/spice-debug-level-warning", test_spice_debug_level_warning);
     g_test_add_func("/spice-common/spice-g-messages-debug", test_spice_g_messages_debug);
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]