On Wed, 5 Sep 2001, Doug MacEachern wrote:
> On Sun, 2 Sep 2001, Stas Bekman wrote:
>
> > this works for me. I had to exit on reconfiguration, since otherwise it'd
> > fail to continue. Should I reconfigure in a different way, so I won't have
> > to exit?
>
> great. you can use refresh() to reconfigure, see Apache::TestRun:
> #if config is cached and MaxClients == 1, must reconfigure
> if (!$$save and $opts->{proxy} eq 'on' and $max == 1) {
> $$save = 1;
> warning "server must be reconfigured for proxy";
> $self->refresh;
> $test_config = $self->{test_config};
> }
>
> if you could tweak things so refresh() would happen in the same place for
> both conditions, that would be great.
mixing the two will make it too messy, so I've just came up with the
status flag and put them next to each other:
Index: Apache-Test/lib/Apache/TestRun.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.46
diff -u -r1.46 TestRun.pm
--- Apache-Test/lib/Apache/TestRun.pm 2001/08/31 10:22:31 1.46
+++ Apache-Test/lib/Apache/TestRun.pm 2001/09/06 02:02:01
@@ -245,6 +245,7 @@
sub configure_opts {
my $self = shift;
my $save = shift;
+ my $refreshed = 0;
my($test_config, $opts) = ($self->{test_config}, $self->{opts});
@@ -256,6 +257,16 @@
$ENV{APACHE_TEST_HTTP11} = 1;
}
+ if (my @reasons = $self->{test_config}->need_reconfiguration) {
+ warning "forcing re-configuration:";
+ warning "\t- $_." for @reasons;
+ unless ($refreshed) {
+ $self->refresh;
+ $refreshed = 1;
+ $test_config = $self->{test_config};
+ }
+ }
+
if (exists $opts->{proxy}) {
my $max = $test_config->{vars}->{maxclients};
$opts->{proxy} ||= 'on';
@@ -263,9 +274,12 @@
#if config is cached and MaxClients == 1, must reconfigure
if (!$$save and $opts->{proxy} eq 'on' and $max == 1) {
$$save = 1;
- warning "server must be reconfigured for proxy";
- $self->refresh;
- $test_config = $self->{test_config};
+ warning "server is reconfigured for proxy";
+ unless ($refreshed) {
+ $self->refresh;
+ $refreshed = 1;
+ $test_config = $self->{test_config};
+ }
}
$test_config->{vars}->{proxy} = $opts->{proxy};
Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.50
diff -u -r1.50 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm 2001/08/28 16:02:56 1.50
+++ Apache-Test/lib/Apache/TestConfig.pm 2001/09/06 02:04:21
@@ -774,6 +774,30 @@
close $out or die "close $conf_file: $!";
}
+sub need_reconfiguration {
+ my $self = shift;
+ my @reasons = ();
+ my $vars = $self->{vars};
+
+ # if httpd.conf is older than httpd executable
+ push @reasons,
+ "$vars->{httpd} is newer than $vars->{t_conf_file}"
+ if -e $vars->{httpd} &&
+ -e $vars->{t_conf_file} &&
+ -M $vars->{httpd} < -M $vars->{t_conf_file};
+
+ # if .in files are newer than their derived versions
+ if (my $extra_conf = $self->generate_extra_conf) {
+ for my $file (@$extra_conf) {
+ push @reasons, "$file.in is newer than $file"
+ if -e $file && -M "$file.in" < -M $file;
+ }
+ }
+
+ return @reasons;
+}
+
+
#shortcuts
my %include_headers = (GET => 1, HEAD => 2);
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/