Mailing List Archive

svn commit: r1888843 - in /spamassassin/trunk/t: basic_lint.t dcc.t duplicates.t extracttext.t gtube.t mimeheader.t pyzor.t razor2.t spamd_client.t spamd_sql_prefs.t
Author: hege
Date: Sat Apr 17 06:42:38 2021
New Revision: 1888843

URL: http://svn.apache.org/viewvc?rev=1888843&view=rev
Log:
Reduce locale dependency for tests

Modified:
spamassassin/trunk/t/basic_lint.t
spamassassin/trunk/t/dcc.t
spamassassin/trunk/t/duplicates.t
spamassassin/trunk/t/extracttext.t
spamassassin/trunk/t/gtube.t
spamassassin/trunk/t/mimeheader.t
spamassassin/trunk/t/pyzor.t
spamassassin/trunk/t/razor2.t
spamassassin/trunk/t/spamd_client.t
spamassassin/trunk/t/spamd_sql_prefs.t

Modified: spamassassin/trunk/t/basic_lint.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/basic_lint.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/basic_lint.t (original)
+++ spamassassin/trunk/t/basic_lint.t Sat Apr 17 06:42:38 2021
@@ -2,7 +2,16 @@

use lib '.'; use lib 't';
use SATest; sa_t_init("basic_lint");
-use Test::More tests => 1;
+
+@test_locales = qw(C);
+# Test with few random additional locales if available
+my $locales = untaint_cmd("locale -a");
+while ($locales =~ /^((?:C|en_US|fr_FR|zh_CN)\.(?:utf|iso|gb).*)$/gmi) {
+ push @test_locales, $1;
+}
+
+use Test::More;
+plan tests => scalar(@test_locales);

# ---------------------------------------------------------------------------

@@ -10,9 +19,12 @@ use Test::More tests => 1;
q{ }, 'anything',
);

-# override locale for this test!
-$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C';
-
-sarun ("-L --lint", \&patterns_run_cb);
-ok_all_patterns();
+foreach my $locale (@test_locales) {
+ my $language = $locale;
+ $language =~ s/[._].*//;
+ $ENV{'LANGUAGE'} = $language;
+ $ENV{'LC_ALL'} = $locale;
+ sarun ("-L --lint", \&patterns_run_cb);
+ ok_all_patterns();
+}


Modified: spamassassin/trunk/t/dcc.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/dcc.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/dcc.t (original)
+++ spamassassin/trunk/t/dcc.t Sat Apr 17 06:42:38 2021
@@ -25,6 +25,7 @@ diag('Note: Failure may not be an SpamAs
tstprefs ("
dns_available no
use_dcc 1
+ score DCC_CHECK 3.3
");

ok sarun ("-t -D info -r < data/spam/gtubedcc.eml 2>&1", \&patterns_run_cb);
@@ -34,7 +35,7 @@ ok_all_patterns();

%patterns = (

- q{ Detected as bulk mail by DCC }, 'dcc',
+ q{ 3.3 DCC_CHECK }, 'dcc',

);


Modified: spamassassin/trunk/t/duplicates.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/duplicates.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/duplicates.t (original)
+++ spamassassin/trunk/t/duplicates.t Sat Apr 17 06:42:38 2021
@@ -4,7 +4,7 @@ use lib '.'; use lib 't';
use SATest; sa_t_init("duplicates");
use Test::More tests => 21;

-$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we need the patterns to work
+#$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we need the patterns to work

# ---------------------------------------------------------------------------


Modified: spamassassin/trunk/t/extracttext.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/extracttext.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/extracttext.t (original)
+++ spamassassin/trunk/t/extracttext.t Sat Apr 17 06:42:38 2021
@@ -19,7 +19,7 @@ plan skip_all => "no needed binaries fou
plan tests => $tests;

%patterns_gtube = (
- q{ BODY: Generic Test for Unsolicited Bulk Email }, 'gtube',
+ q{ 1000 GTUBE }, 'gtube',
);

if (HAS_PDFTOHTML) {

Modified: spamassassin/trunk/t/gtube.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/gtube.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/gtube.t (original)
+++ spamassassin/trunk/t/gtube.t Sat Apr 17 06:42:38 2021
@@ -8,11 +8,9 @@ use Test::More tests => 4;
# ---------------------------------------------------------------------------

%patterns = (
- q{ BODY: Generic Test for Unsolicited Bulk Email }, 'gtube',
+ q{ 1000 GTUBE }, 'gtube',
);

-$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we match the description
-
ok (sarun ("-L -t < data/spam/gtube.eml", \&patterns_run_cb));
ok_all_patterns();


Modified: spamassassin/trunk/t/mimeheader.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/mimeheader.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/mimeheader.t (original)
+++ spamassassin/trunk/t/mimeheader.t Sat Apr 17 06:42:38 2021
@@ -4,8 +4,6 @@ use lib '.'; use lib 't';
use SATest; sa_t_init("mimeheader");
use Test::More tests => 6;

-$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we need the patterns to work
-
# ---------------------------------------------------------------------------

%patterns = (

Modified: spamassassin/trunk/t/pyzor.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/pyzor.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/pyzor.t (original)
+++ spamassassin/trunk/t/pyzor.t Sat Apr 17 06:42:38 2021
@@ -17,13 +17,14 @@ diag('Note: Failures may not be an SpamA
tstprefs ("
dns_available no
use_pyzor 1
+ score PYZOR_CHECK 3.3
");

#PYZOR file was from real-world spam in October 2018

#TESTING FOR SPAM
%patterns = (
- q{ Listed in Pyzor }, 'spam',
+ q{ 3.3 PYZOR_CHECK }, 'spam',
);

sarun ("-t < data/spam/pyzor", \&patterns_run_cb);
@@ -38,7 +39,7 @@ ok_all_patterns();
'pyzor: result: COUNT=0' => 'zerocount',
);
%anti_patterns = (
- q{ Listed in Pyzor }, 'nonspam',
+ q{ 3.3 PYZOR_CHECK }, 'nonspam',
);

sarun ("-D pyzor -t < data/nice/001 2>&1", \&patterns_run_cb);

Modified: spamassassin/trunk/t/razor2.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/razor2.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/razor2.t (original)
+++ spamassassin/trunk/t/razor2.t Sat Apr 17 06:42:38 2021
@@ -27,13 +27,14 @@ diag('Note: Failures may not be an SpamA
tstprefs ("
dns_available no
use_razor2 1
+ score RAZOR2_CHECK 3.3
");

#RAZOR2 file was from real-world spam in June 2019

#TESTING FOR SPAM
%patterns = (
- q{ Listed in Razor2 }, 'spam',
+ q{ 3.3 RAZOR2_CHECK }, 'spam',
);

sarun ("-t < data/spam/razor2", \&patterns_run_cb);
@@ -48,7 +49,7 @@ ok_all_patterns();
'razor2: part=0 engine=8 contested=0 confidence=0', 'result',
);
%anti_patterns = (
- q{ Listed in Razor2 }, 'nonspam',
+ q{ 3.3 RAZOR2_CHECK }, 'nonspam',
);

sarun ("-D razor2 -t < data/nice/001 2>&1", \&patterns_run_cb);

Modified: spamassassin/trunk/t/spamd_client.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_client.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_client.t (original)
+++ spamassassin/trunk/t/spamd_client.t Sat Apr 17 06:42:38 2021
@@ -32,7 +32,7 @@ ok($testmsg);

%patterns = (
q{ X-Spam-Flag: YES}, 'flag',
- q{ BODY: Generic Test for Unsolicited Bulk Email }, 'gtube',
+ q{ 1000 GTUBE }, 'gtube',
q{ XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X }, 'gtube string',
);

@@ -91,7 +91,7 @@ if (!$RUNNING_ON_WINDOWS) {

%patterns = (
q{ X-Spam-Flag: YES}, 'flag',
- q{ BODY: Generic Test for Unsolicited Bulk Email }, 'gtube',
+ q{ 1000 GTUBE }, 'gtube',
q{ XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X }, 'gtube string',
);


Modified: spamassassin/trunk/t/spamd_sql_prefs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_sql_prefs.t?rev=1888843&r1=1888842&r2=1888843&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_sql_prefs.t (original)
+++ spamassassin/trunk/t/spamd_sql_prefs.t Sat Apr 17 06:42:38 2021
@@ -35,7 +35,7 @@ ok(start_spamd("-L --sql-config -u $spam
%patterns = (
q{ X-Spam-tTEST1: FOO1 }, 'Added Header tTEST1',
q{ X-Spam-Flag: YES}, 'Spam Flag',
- q{ BODY: Generic Test for Unsolicited Bulk Email }, 'GTUBE Test',
+ q{ 1000 GTUBE }, 'GTUBE Test',
q{ XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X }, 'GTUBE String',
);
%anti_patterns = (
@@ -51,7 +51,7 @@ clear_pattern_counters();
q{ XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X }, 'GTUBE String',
);
%anti_patterns = (
- q{ BODY: Generic Test for Unsolicited Bulk Email }, 'GTUBE Test',
+ q{ 1000 GTUBE }, 'GTUBE Test',
q{ X-Spam-Flag: YES}, 'Spam Flag',
);
ok (spamcrun("-u testuser < data/spam/018", \&patterns_run_cb));
@@ -68,7 +68,7 @@ ok($dbh->do("INSERT INTO userpref VALUES
);
%anti_patterns = (
q{ X-Spam-Flag: YES}, 'Spam Flag YES',
- q{ BODY: Generic Test for Unsolicited Bulk Email }, 'GTUBE Test',
+ q{ 1000 GTUBE }, 'GTUBE Test',
);
ok (spamcrun("-u testuser < data/spam/018", \&patterns_run_cb));
ok_all_patterns();