From: Andrew Bartlett Date: Wed, 29 Jul 2020 09:26:55 +0000 (+1200) Subject: param: Allow tests to silence deprecation warnings X-Git-Tag: talloc-2.3.2~846 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d14cc45c98a77fb8a6ac96181eec33f368b8dbd8;p=thirdparty%2Fsamba.git param: Allow tests to silence deprecation warnings This helps make output sensitive tests more reliable. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14460 Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher --- diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 7e9767590f9..3d4033eb2a4 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -1864,8 +1864,15 @@ bool lpcfg_do_global_parameter(struct loadparm_context *lp_ctx, } if (parm_table[parmnum].flags & FLAG_DEPRECATED) { - DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n", - pszParmName)); + char *suppress_env = getenv("SAMBA_DEPRECATED_SUPPRESS"); + bool print_warning = (suppress_env == NULL + || suppress_env[0] == '\0'); + if (print_warning) { + DBG_WARNING("WARNING: The \"%s\" option " + "is deprecated\n", + pszParmName); + + } } parm_ptr = lpcfg_parm_ptr(lp_ctx, NULL, &parm_table[parmnum]); @@ -1897,8 +1904,15 @@ bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx, } if (parm_table[parmnum].flags & FLAG_DEPRECATED) { - DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n", - pszParmName)); + char *suppress_env = getenv("SAMBA_DEPRECATED_SUPPRESS"); + bool print_warning = (suppress_env == NULL + || suppress_env[0] == '\0'); + if (print_warning) { + DBG_WARNING("WARNING: The \"%s\" option " + "is deprecated\n", + pszParmName); + + } } if (parm_table[parmnum].p_class == P_GLOBAL) { diff --git a/selftest/knownfail.d/testparm b/selftest/knownfail.d/testparm deleted file mode 100644 index c3adb529940..00000000000 --- a/selftest/knownfail.d/testparm +++ /dev/null @@ -1 +0,0 @@ -^samba3.blackbox.testparm.test_deprecated_warning_suppressed \ No newline at end of file