selftest: Add test for suppression of deprecation warnings
authorAndrew Bartlett <abartlet@samba.org>
Mon, 10 Aug 2020 00:18:07 +0000 (12:18 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 18 Aug 2020 00:10:39 +0000 (00:10 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14460

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
selftest/knownfail.d/testparm [new file with mode: 0644]
source3/script/tests/test_testparm_s3.sh

diff --git a/selftest/knownfail.d/testparm b/selftest/knownfail.d/testparm
new file mode 100644 (file)
index 0000000..c3adb52
--- /dev/null
@@ -0,0 +1 @@
+^samba3.blackbox.testparm.test_deprecated_warning_suppressed
\ No newline at end of file
index 6dcdeff07d79980a84ab1e1105bf9b501735d84d..9ef3f7e009773485ee5a933cc94c79cfcd73ea69 100755 (executable)
@@ -58,6 +58,36 @@ EOF
        ${TESTPARM} ${TEMP_CONFFILE}
 }
 
+test_testparm_deprecated()
+{
+    name=$1
+    old_SAMBA_DEPRECATED_SUPPRESS=$SAMBA_DEPRECATED_SUPPRESS
+    SAMBA_DEPRECATED_SUPPRESS=
+    export SAMBA_DEPRECATED_SUPPRESS
+    testit_grep $name 'WARNING: The "lsaovernetlogon" option is deprecated' $VALGRIND ${TESTPARM} ${TEMP_CONFFILE} --option='lsaovernetlogon=true'
+    SAMBA_DEPRECATED_SUPPRESS=$old_SAMBA_DEPRECATED_SUPPRESS
+    export SAMBA_DEPRECATED_SUPPRESS
+}
+
+test_testparm_deprecated_suppress()
+{
+    name=$1
+    subunit_start_test "$name"
+    output=$(SAMBA_DEPRECATED_SUPPRESS=1 $VALGRIND ${TESTPARM} ${TEMP_CONFFILE} --option='lsa over netlogon = true' 2>&1)
+    status=$?
+    if [ "$status" = "0" ]; then
+       echo "$output" | grep --quiet 'WARNING: The "lsa over netlogon " option is deprecated'
+       status=$?
+       if [ "$status" = "1" ]; then
+           subunit_pass_test "$name"
+       else
+           echo $output | subunit_fail_test "$name"
+       fi
+    else
+       echo $output | subunit_fail_test "$name"
+    fi
+}
+
 testit "name resolve order = lmhosts wins host bcast"\
        test_one_global_option "name resolve order = lmhosts wins host bcast" || \
        failed=`expr ${failed} + 1`
@@ -112,6 +142,9 @@ testit "copy" \
        test_copy || \
        failed=`expr ${failed} + 1`
 
+test_testparm_deprecated "test_deprecated_warning_printed"
+test_testparm_deprecated_suppress "test_deprecated_warning_suppressed"
+
 rm -f ${TEMP_CONFFILE}
 
 testok $0 ${failed}