svn commit: r1934193 - in spamassassin/trunk: . t t/data/nice

[email protected] Thu, 14 May 2026 16:26:10 -0000
Newsgroups gmane.mail.spam.spamassassin.cvs
Message-ID <177877597095.2774994.9255253501798327177@svn03-he-fi>
Author: gbechis
Date: Thu May 14 16:26:10 2026
New Revision: 1934193

Log:
add welcomelist_spf tests

Added:
   spamassassin/trunk/t/data/nice/welcomelist_spf1   (contents, props changed)
   spamassassin/trunk/t/data/nice/welcomelist_spf2   (contents, props changed)
   spamassassin/trunk/t/welcomelist_spf.t
Modified:
   spamassassin/trunk/MANIFEST

Modified: spamassassin/trunk/MANIFEST
==============================================================================
--- spamassassin/trunk/MANIFEST	Thu May 14 15:54:46 2026	(r1934192)
+++ spamassassin/trunk/MANIFEST	Thu May 14 16:26:10 2026	(r1934193)
@@ -431,6 +431,8 @@ t/data/nice/spf5-received-spf-crlf
 t/data/nice/spf6-received-spf-crlf2
 t/data/nice/unicode1
 t/data/nice/unicode2
+t/data/nice/welcomelist_spf1
+t/data/nice/welcomelist_spf2
 t/data/nice.mbox
 t/data/phishing/openphish-feed.txt
 t/data/phishing/phishtank-feed.csv
@@ -742,6 +744,7 @@ t/util_wrap.t
 t/welcomelist_addrs.t
 t/welcomelist_from.t
 t/welcomelist_subject.t
+t/welcomelist_spf.t
 t/welcomelist_to.t
 t/wlbl_uri.t
 t/whitelist_addrs.t

Added: spamassassin/trunk/t/data/nice/welcomelist_spf1
==============================================================================
Binary file. No diff available.

Added: spamassassin/trunk/t/data/nice/welcomelist_spf2
==============================================================================
Binary file. No diff available.

Added: spamassassin/trunk/t/welcomelist_spf.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ spamassassin/trunk/t/welcomelist_spf.t	Thu May 14 16:26:10 2026	(r1934193)
@@ -0,0 +1,90 @@
+#!/usr/bin/perl -T
+
+use lib '.'; use lib 't';
+use SATest; sa_t_init("welcomelist_spf");
+
+use Test::More;
+plan skip_all => 'Long running tests disabled' unless conf_bool('run_long_tests');
+plan tests => 15;
+
+tstlocalrules(q{
+  header USER_IN_SPF_WELCOMELIST  eval:check_for_spf_welcomelist_from()
+  tflags USER_IN_SPF_WELCOMELIST  userconf nice noautolearn net
+  score  USER_IN_SPF_WELCOMELIST  -100
+
+  header USER_IN_DEF_SPF_WL       eval:check_for_def_spf_welcomelist_from()
+  tflags USER_IN_DEF_SPF_WL       userconf nice noautolearn net
+  score  USER_IN_DEF_SPF_WL       -10
+
+  meta   USER_IN_SPF_WHITELIST    (USER_IN_SPF_WELCOMELIST)
+  tflags USER_IN_SPF_WHITELIST    userconf nice noautolearn net
+  score  USER_IN_SPF_WHITELIST    -100
+
+  def_welcomelist_from_spf        *@example.com
+});
+
+my $net_cfg = q{
+  clear_trusted_networks
+  clear_internal_networks
+  trusted_networks 65.214.43.158 64.142.3.173
+  internal_networks 65.214.43.158 64.142.3.173
+  always_trust_envelope_sender 1
+};
+
+tstprefs($net_cfg);
+%patterns = (
+  q{ -10 USER_IN_DEF_SPF_WL }, '',
+);
+%anti_patterns = (
+  q{ USER_IN_SPF_WELCOMELIST }, '',
+  q{ USER_IN_SPF_WHITELIST }, '',
+);
+sarun("-t < data/nice/welcomelist_spf1", \&patterns_run_cb);
+ok_all_patterns();
+
+tstprefs($net_cfg . q{
+  welcomelist_from_spf *@example.com
+});
+%patterns = (
+  q{ -100 USER_IN_SPF_WELCOMELIST }, '',
+  q{ -10 USER_IN_DEF_SPF_WL }, '',
+  q{ -100 USER_IN_SPF_WHITELIST }, '',
+);
+%anti_patterns = ();
+sarun("-t < data/nice/welcomelist_spf1", \&patterns_run_cb);
+ok_all_patterns();
+
+tstprefs($net_cfg);
+%patterns = ();
+%anti_patterns = (
+  q{ USER_IN_DEF_SPF_WL }, '',
+  q{ USER_IN_SPF_WELCOMELIST }, '',
+  q{ USER_IN_SPF_WHITELIST }, '',
+);
+sarun("-t < data/nice/welcomelist_spf2", \&patterns_run_cb);
+ok_all_patterns();
+
+disable_compat("welcomelist_blocklist");
+
+tstprefs($net_cfg);
+%patterns = (
+  q{ -10 USER_IN_DEF_SPF_WL }, '',
+);
+%anti_patterns = (
+  q{ USER_IN_SPF_WELCOMELIST }, '',
+  q{ USER_IN_SPF_WHITELIST }, '',
+);
+sarun("-t < data/nice/welcomelist_spf1", \&patterns_run_cb);
+ok_all_patterns();
+
+tstprefs($net_cfg . q{
+  welcomelist_from_spf *@example.com
+});
+%patterns = (
+  q{ USER_IN_SPF_WELCOMELIST }, '',
+  q{ -10 USER_IN_DEF_SPF_WL }, '',
+  q{ -100 USER_IN_SPF_WHITELIST }, '',
+);
+%anti_patterns = ();
+sarun("-t < data/nice/welcomelist_spf1", \&patterns_run_cb);
+ok_all_patterns();