cvs commit: modperl/lib/Apache test.pm

2000-12-19 Thread dougm

dougm   00/12/19 22:34:20

  Modified:.Changes
   lib/Apache test.pm
  Log:
  various Apache::test enhancements and fixes
  
  Revision  ChangesPath
  1.550 +3 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.549
  retrieving revision 1.550
  diff -u -r1.549 -r1.550
  --- Changes   2000/11/25 15:39:21 1.549
  +++ Changes   2000/12/20 06:34:19 1.550
  @@ -10,6 +10,9 @@
   
   =item 1.24_02-dev
   
  +various Apache::test enhancements and fixes
  +[Ken Williams [EMAIL PROTECTED], Dave Rolsky [EMAIL PROTECTED]]
  +
   Documenting the new PerlAddVar httpd.conf directive
   [Stas Bekman [EMAIL PROTECTED]]
   
  
  
  
  1.21  +24 -8 modperl/lib/Apache/test.pm
  
  Index: test.pm
  ===
  RCS file: /home/cvs/modperl/lib/Apache/test.pm,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- test.pm   2000/10/13 17:21:18 1.20
  +++ test.pm   2000/12/20 06:34:20 1.21
  @@ -1,14 +1,15 @@
   package Apache::test;
   
   use strict;
  -use vars qw(@EXPORT $USE_THREAD $USE_SFIO $PERL_DIR);
  +use vars qw(@EXPORT $USE_THREAD $USE_SFIO $PERL_DIR @EXPORT_OK);
   use Exporter ();
   use Config;
   use FileHandle ();
   *import = \Exporter::import;
   
  -@EXPORT = qw(test fetch simple_fetch have_module skip_test 
  +@EXPORT = qw(test fetch simple_fetch have_module skip_test
 $USE_THREAD $USE_SFIO $PERL_DIR WIN32 grab run_test); 
  +@EXPORT_OK = qw(have_httpd);
   
   BEGIN { 
   if(not $ENV{MOD_PERL}) {
  @@ -86,14 +87,15 @@
   
   sub _ask {
   # Just a function for asking the user questions
  -my ($prompt, $default, $mustfind) = @_;
  +my ($prompt, $default, $mustfind, $canskip) = @_;
   
  +my $skip = defined $canskip ? " ('$canskip' to skip)" : '';
   my $response;
   do {
  - print "$prompt [$default]: ";
  + print "$prompt [$default]$skip: ";
chomp($response = STDIN);
$response ||= $default;
  -} until (!$mustfind || (-e $response || !print("$response not found\n")));
  +} until (!$mustfind || ($response eq $canskip) || (-e $response || 
!print("$response not found\n")));
   
   return $response;
   }
  @@ -108,10 +110,16 @@
   
   my $httpd = $ENV{'APACHE'} || which('apache') || which('httpd') || 
'/usr/lib/httpd/httpd';
   
  -$httpd = _ask("\n", $httpd, 1);
  +$httpd = _ask("\n", $httpd, 1, '!');
  +if ($httpd eq '!') {
  + print "Skipping.\n";
  + return;
  +}
   system "$Config{lns} $httpd t/httpd";
   
  -if (lc _ask("Search existing config file for dynamic module dependencies?", 
'n') eq 'y') {
  +# Default: search for dynamic dependencies if mod_so is present, don't bother 
otherwise.
  +my $default = (`t/httpd -l` =~ /mod_so\.c/ ? 'y' : 'n');
  +if (lc _ask("Search existing config file for dynamic module dependencies?", 
$default) eq 'y') {
my %compiled;
for (`t/httpd -V`) {
if (/([\w]+)="(.*)"/) {
  @@ -148,6 +156,8 @@
   
   my @modules   =   grep /^\s*(Add|Load)Module/, @lines;
   my ($server_root) = (map /^\s*ServerRoot\s*(\S+)/, @lines);
  +$server_root =~ s/^"//;
  +$server_root =~ s/"$//;
   
   # Rewrite all modules to load from an absolute path.
   foreach (@modules) {
  @@ -310,6 +320,10 @@
   exit;
   }
   
  +sub have_httpd {
  +return -e 't/httpd';
  +}
  +
   sub run {
   require Test::Harness;
   my $self = shift;
  @@ -514,7 +528,9 @@
*MY::test = sub { Apache::test-MM_test(%params) };
   
# In t/*.t script (or test.pl)
  - (Some methods of Doug's that I haven't reviewed or documented yet)
  + use Apache::test qw(skip_test have_httpd);
  + skip_test unless have_httpd;
  + (Some more methods of Doug's that I haven't reviewed or documented yet)
   
   =head1 DESCRIPTION
   
  
  
  



cvs commit: modperl/src/modules/perl mod_perl.c

2000-12-19 Thread dougm

dougm   00/12/19 22:39:48

  Modified:.Changes
   src/modules/perl mod_perl.c
  Log:
  stop win32 crash when bringing down service
  
  Revision  ChangesPath
  1.551 +3 -0  modperl/Changes
  
  Index: Changes
  ===
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.550
  retrieving revision 1.551
  diff -u -r1.550 -r1.551
  --- Changes   2000/12/20 06:34:19 1.550
  +++ Changes   2000/12/20 06:39:47 1.551
  @@ -10,6 +10,9 @@
   
   =item 1.24_02-dev
   
  +stop win32 crash when bringing down service
  +[John K. Sterling [EMAIL PROTECTED]]
  +
   various Apache::test enhancements and fixes
   [Ken Williams [EMAIL PROTECTED], Dave Rolsky [EMAIL PROTECTED]]
   
  
  
  
  1.134 +15 -1 modperl/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===
  RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
  retrieving revision 1.133
  retrieving revision 1.134
  diff -u -r1.133 -r1.134
  --- mod_perl.c2000/10/06 20:18:28 1.133
  +++ mod_perl.c2000/12/20 06:39:48 1.134
  @@ -507,7 +507,21 @@
   
   static void mp_dso_unload(void *data) 
   { 
  -array_header *librefs = xs_dl_librefs((pool *)data);
  +array_header *librefs;
  +
  +#ifdef WIN32
  +// This is here to stop a crash when bringing down
  +// a service.  Apparently the dso is unloaded too early.
  +// This if statement tests to see if we are running as a 
  +// service. apache does the same
  +// see apache's isProcessService() in service.c 
  +if (AllocConsole()) {
  +FreeConsole();
  +return;
  +} 
  +#endif
  +
  +librefs = xs_dl_librefs((pool *)data);
   perl_shutdown(NULL, NULL);
   unload_xs_so(librefs);
   }