httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestServer.pm
Date Thu, 22 Nov 2001 03:13:04 GMT
stas        01/11/21 19:13:04

  Modified:    perl-framework/Apache-Test/lib/Apache TestServer.pm
  Log:
  - wait much longer for the server to start
  - show the waiting timer when the server is starting
  
  Revision  Changes    Path
  1.41      +28 -38    httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm
  
  Index: TestServer.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestServer.pm,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- TestServer.pm	2001/10/22 06:15:36	1.40
  +++ TestServer.pm	2001/11/22 03:13:04	1.41
  @@ -417,7 +417,7 @@
       }
   
       while ($old_pid and $old_pid == $self->pid) {
  -        warning "old pid file ($old_pid) still exists\n";
  +        warning "old pid file ($old_pid) still exists";
           sleep 1;
       }
   
  @@ -426,34 +426,26 @@
       $mpm = "($mpm MPM)" if $mpm;
       print "using $version $mpm\n";
   
  -    my $tries = 6;
  +    my $wait_secs = 60; # XXX: make a constant?
   
  -    for (1..$tries) {
  -        my $pid = $self->pid;
  -        if ($pid) {
  -            if($_ > 1) {
  -                print "ok\n";
  -            }
  -        }
  -        else {
  -            if ($_ == 1) {
  -                print "waiting for server to warm up...";
  -            }
  -            elsif ($_ > $tries) {
  -                print "giving up\n";
  -                last;
  -            }
  -            else {
  -                print "...";
  -            }
  -            sleep $_;
  -            next;
  +    my $start_time = time;
  +    my $preamble = "\rwaiting for server to start: ";
  +    while (1) {
  +        my $delta = time - $start_time;
  +        print $preamble, sprintf "%02d:%02d", (gmtime $delta)[1,0];
  +        sleep 1;
  +        if ($self->pid) {
  +            print $preamble, "ok (waited $delta secs)\n";
  +            last;
  +        }
  +        elsif ($delta > $wait_secs) {
  +            print $preamble, "giving up after $delta secs\n";
  +            last;
           }
  -        last;
       }
   
       if (my $pid = $self->pid) {
  -        print "\nserver $self->{name} started\n";
  +        print "server $self->{name} started\n";
   
           my $vh = $config->{vhosts};
           my $by_port = sub { $vh->{$a}->{port} <=> $vh->{$b}->{port} };
  @@ -479,26 +471,24 @@
       if ($server_up->()) {
           return 1;
       }
  -    else {
  -        warning "still waiting for server to warm up...";
  -        sleep 1;
  -    }
   
  -    for my $try (1..$tries) {
  +    $start_time = time;
  +    $preamble = "\rstill waiting for server to warm up: ";
  +    while (1) {
  +        my $delta = time - $start_time;
  +        print $preamble, sprintf "%02d:%02d", (gmtime $delta)[1,0];
  +        sleep 1;
           if ($server_up->()) {
  -            print "ok\n";
  -            return 1;
  -        }
  -        elsif ($try >= $tries) {
  -            print "giving up\n";
  +            print $preamble, "ok (waited $delta secs)\n";
  +            last;
           }
  -        else {
  -            print "...";
  -            sleep $try;
  +        elsif ($delta > $wait_secs) {
  +            print $preamble, "giving up after $delta secs\n";
  +            last;
           }
       }
   
  -    $self->failed_msg("\nfailed to start server!");
  +    $self->failed_msg("failed to start server!");
       return 0;
   }
   
  
  
  

Mime
View raw message