You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by qu...@apache.org on 2005/05/01 09:13:35 UTC
svn commit: r165468 - in /spamassassin/trunk/t: SATest.pm
spamd_prefork_stress.t spamd_prefork_stress_2.t
Author: quinlan
Date: Sun May 1 00:13:34 2005
New Revision: 165468
URL: http://svn.apache.org/viewcvs?rev=165468&view=rev
Log:
bu 4163: this should fix any issues with finding pkill and pgrep, please test
Modified:
spamassassin/trunk/t/SATest.pm
spamassassin/trunk/t/spamd_prefork_stress.t
spamassassin/trunk/t/spamd_prefork_stress_2.t
Modified: spamassassin/trunk/t/SATest.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/SATest.pm?rev=165468&r1=165467&r2=165468&view=diff
==============================================================================
--- spamassassin/trunk/t/SATest.pm (original)
+++ spamassassin/trunk/t/SATest.pm Sun May 1 00:13:34 2005
@@ -4,10 +4,10 @@
use Cwd;
use Config;
-use File::Path;
-use File::Copy;
use File::Basename;
-
+use File::Copy;
+use File::Path;
+use File::Spec;
BEGIN {
# No spamd test in Windows unless env override says user figured out a way
@@ -147,6 +147,19 @@
$delta = int(rand(32768));
}
return $port;
+}
+
+sub locate_command {
+ my ($command) = @_;
+
+ my @path = File::Spec->path();
+ push(@path, '/usr/bin') if ! grep { m@/usr/bin/?$@ } @path;
+ for my $path (@path) {
+ $location = "$path/$command";
+ $location =~ s@//@/@g;
+ return $location if -x $location;
+ }
+ return 0;
}
sub sa_t_finish {
Modified: spamassassin/trunk/t/spamd_prefork_stress.t
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/spamd_prefork_stress.t?rev=165468&r1=165467&r2=165468&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_prefork_stress.t (original)
+++ spamassassin/trunk/t/spamd_prefork_stress.t Sun May 1 00:13:34 2005
@@ -9,11 +9,15 @@
our $RUN_THIS_TEST;
+my $pgrep;
+my $pkill;
+
# require pkill and pgrep be installed to run this test
BEGIN {
$RUN_THIS_TEST = conf_bool('run_spamd_prefork_stress_test');
- (-x "/usr/bin/pkill") or $RUN_THIS_TEST = 0;
- (-x "/usr/bin/pgrep") or $RUN_THIS_TEST = 0;
+ $pkill = locate_command("pkill");
+ $pgrep = locate_command("pgrep");
+ $RUN_THIS_TEST = 0 if !$pkill || !$pgrep;
plan tests => ($SKIP_SPAMD_TESTS || !$RUN_THIS_TEST ? 0 : 14)
};
@@ -23,7 +27,7 @@
"'run_spamd_prefork_stress_test' set to 'y'.\n";
exit unless $RUN_THIS_TEST;
-system("pgrep", "spamd child");
+system($pgrep, "spamd child");
if ($? >> 8 == 0) {
die "not running test: existing 'spamd child' processes would be killed.\n";
}
@@ -49,7 +53,7 @@
my $i = 0;
for ($i = 0; $i < 1999; $i++) {
print "killing [$i]\n";
- system ("pkill", "-f", "spamd child");
+ system ($pkill, "-f", "spamd child");
}
clear_pattern_counters();
Modified: spamassassin/trunk/t/spamd_prefork_stress_2.t
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/spamd_prefork_stress_2.t?rev=165468&r1=165467&r2=165468&view=diff
==============================================================================
--- spamassassin/trunk/t/spamd_prefork_stress_2.t (original)
+++ spamassassin/trunk/t/spamd_prefork_stress_2.t Sun May 1 00:13:34 2005
@@ -9,11 +9,15 @@
our $RUN_THIS_TEST;
+my $pgrep;
+my $pkill;
+
# require pkill and pgrep be installed to run this test
BEGIN {
$RUN_THIS_TEST = conf_bool('run_spamd_prefork_stress_test');
- (-x "/usr/bin/pkill") or $RUN_THIS_TEST = 0;
- (-x "/usr/bin/pgrep") or $RUN_THIS_TEST = 0;
+ $pkill = locate_command("pkill");
+ $pgrep = locate_command("pgrep");
+ $RUN_THIS_TEST = 0 if !$pkill || !$pgrep;
plan tests => ($SKIP_SPAMD_TESTS || !$RUN_THIS_TEST ? 0 : 14)
};
@@ -23,7 +27,7 @@
"'run_spamd_prefork_stress_test' set to 'y'.\n";
exit unless $RUN_THIS_TEST;
-system("pgrep", "spamd child");
+system($pgrep, "spamd child");
if ($? >> 8 == 0) {
die "not running test: existing 'spamd child' processes would be killed.\n";
}
@@ -49,7 +53,7 @@
my $i = 0;
for ($i = 0; $i < 1999; $i++) {
print "killing [$i]\n";
- system ("pkill", "-f", "spamd child");
+ system ($pkill, "-f", "spamd child");
}
clear_pattern_counters();