Author: felicity
Date: Mon Feb 16 21:11:48 2004
New Revision: 6703
Modified:
incubator/spamassassin/trunk/t/SATest.pm
incubator/spamassassin/trunk/t/strip2.t
Log:
bug 3053: the strip2.t test was severely broken. the output redirection would fail, so it would end up comparing a blank file to a blank file, which of course always works ...
Modified: incubator/spamassassin/trunk/t/SATest.pm
==============================================================================
--- incubator/spamassassin/trunk/t/SATest.pm (original)
+++ incubator/spamassassin/trunk/t/SATest.pm Mon Feb 16 21:11:48 2004
@@ -167,7 +167,7 @@
system ("$scrargs > log/$testname.${Test::ntest}");
$sa_exitcode = ($?>>8);
if ($sa_exitcode != 0) { return undef; }
- &checkfile ("$testname.${Test::ntest}", $read_sub);
+ &checkfile ("$testname.${Test::ntest}", $read_sub) if (defined $read_sub);
1;
}
@@ -201,7 +201,7 @@
system ("$salearnargs > log/$testname.${Test::ntest}");
$salearn_exitcode = ($?>>8);
if ($salearn_exitcode != 0) { return undef; }
- &checkfile ("$testname.${Test::ntest}", $read_sub);
+ &checkfile ("$testname.${Test::ntest}", $read_sub) if (defined $read_sub);
1;
}
@@ -237,7 +237,7 @@
%found = ();
%found_anti = ();
- &checkfile ("$testname.out", $read_sub);
+ &checkfile ("$testname.out", $read_sub) if (defined $read_sub);
}
sub spamcrun_background {
Modified: incubator/spamassassin/trunk/t/strip2.t
==============================================================================
--- incubator/spamassassin/trunk/t/strip2.t (original)
+++ incubator/spamassassin/trunk/t/strip2.t Mon Feb 16 21:11:48 2004
@@ -11,23 +11,34 @@
sub diff {
my ($f1, $f2) = @_;
system ("diff $f1 $f2 > /dev/null");
- return ($? >> 8);
+ return !$?;
}
my $INPUT = 'data/spam/002';
my $MUNGED = 'log/strip2.munged';
-my $OUTPUT = 'log/strip2.output';
# create the -t output
-sarun ("-L -t < $INPUT > $MUNGED", \&patterns_run_cb);
-sarun ("-d < $MUNGED > $OUTPUT", \&patterns_run_cb);
-ok(diff($INPUT,$OUTPUT));
+sarun ("-L -t < $INPUT");
+if (move("log/$testname.${Test::ntest}", $MUNGED)) {
+ sarun ("-d < $MUNGED");
+ ok(diff($INPUT,"log/$testname.${Test::ntest}"));
+}
+else {
+ warn "move failed: $!\n";
+ ok(0);
+}
-# create the -P output
-sarun ("-L < $INPUT > $MUNGED", \&patterns_run_cb);
-sarun ("-d < $MUNGED > $OUTPUT", \&patterns_run_cb);
-ok(diff($INPUT,$OUTPUT));
+# create the normal output
+sarun ("-L < $INPUT");
+if (move("log/$testname.${Test::ntest}", $MUNGED)) {
+ sarun ("-d < $MUNGED");
+ ok(diff($INPUT,"log/$testname.${Test::ntest}"));
+}
+else {
+ warn "move failed: $!\n";
+ ok(0);
+}
# Work directly on regular message, as though it was not spam
-sarun ("-d < $INPUT > $OUTPUT", \&patterns_run_cb);
-ok(diff($INPUT,$OUTPUT));
+sarun ("-d < $INPUT");
+ok(diff($INPUT,"log/$testname.${Test::ntest}"));
Date: Mon Feb 16 21:11:48 2004
New Revision: 6703
Modified:
incubator/spamassassin/trunk/t/SATest.pm
incubator/spamassassin/trunk/t/strip2.t
Log:
bug 3053: the strip2.t test was severely broken. the output redirection would fail, so it would end up comparing a blank file to a blank file, which of course always works ...
Modified: incubator/spamassassin/trunk/t/SATest.pm
==============================================================================
--- incubator/spamassassin/trunk/t/SATest.pm (original)
+++ incubator/spamassassin/trunk/t/SATest.pm Mon Feb 16 21:11:48 2004
@@ -167,7 +167,7 @@
system ("$scrargs > log/$testname.${Test::ntest}");
$sa_exitcode = ($?>>8);
if ($sa_exitcode != 0) { return undef; }
- &checkfile ("$testname.${Test::ntest}", $read_sub);
+ &checkfile ("$testname.${Test::ntest}", $read_sub) if (defined $read_sub);
1;
}
@@ -201,7 +201,7 @@
system ("$salearnargs > log/$testname.${Test::ntest}");
$salearn_exitcode = ($?>>8);
if ($salearn_exitcode != 0) { return undef; }
- &checkfile ("$testname.${Test::ntest}", $read_sub);
+ &checkfile ("$testname.${Test::ntest}", $read_sub) if (defined $read_sub);
1;
}
@@ -237,7 +237,7 @@
%found = ();
%found_anti = ();
- &checkfile ("$testname.out", $read_sub);
+ &checkfile ("$testname.out", $read_sub) if (defined $read_sub);
}
sub spamcrun_background {
Modified: incubator/spamassassin/trunk/t/strip2.t
==============================================================================
--- incubator/spamassassin/trunk/t/strip2.t (original)
+++ incubator/spamassassin/trunk/t/strip2.t Mon Feb 16 21:11:48 2004
@@ -11,23 +11,34 @@
sub diff {
my ($f1, $f2) = @_;
system ("diff $f1 $f2 > /dev/null");
- return ($? >> 8);
+ return !$?;
}
my $INPUT = 'data/spam/002';
my $MUNGED = 'log/strip2.munged';
-my $OUTPUT = 'log/strip2.output';
# create the -t output
-sarun ("-L -t < $INPUT > $MUNGED", \&patterns_run_cb);
-sarun ("-d < $MUNGED > $OUTPUT", \&patterns_run_cb);
-ok(diff($INPUT,$OUTPUT));
+sarun ("-L -t < $INPUT");
+if (move("log/$testname.${Test::ntest}", $MUNGED)) {
+ sarun ("-d < $MUNGED");
+ ok(diff($INPUT,"log/$testname.${Test::ntest}"));
+}
+else {
+ warn "move failed: $!\n";
+ ok(0);
+}
-# create the -P output
-sarun ("-L < $INPUT > $MUNGED", \&patterns_run_cb);
-sarun ("-d < $MUNGED > $OUTPUT", \&patterns_run_cb);
-ok(diff($INPUT,$OUTPUT));
+# create the normal output
+sarun ("-L < $INPUT");
+if (move("log/$testname.${Test::ntest}", $MUNGED)) {
+ sarun ("-d < $MUNGED");
+ ok(diff($INPUT,"log/$testname.${Test::ntest}"));
+}
+else {
+ warn "move failed: $!\n";
+ ok(0);
+}
# Work directly on regular message, as though it was not spam
-sarun ("-d < $INPUT > $OUTPUT", \&patterns_run_cb);
-ok(diff($INPUT,$OUTPUT));
+sarun ("-d < $INPUT");
+ok(diff($INPUT,"log/$testname.${Test::ntest}"));