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 Changes
Date Wed, 05 Nov 2003 09:49:27 GMT
stas        2003/11/05 01:49:27

  Modified:    perl-framework/Apache-Test/lib/Apache TestMM.pm TestRun.pm
               perl-framework/Apache-Test Changes
  Log:
  add support for a new subclass method 'bug_report', which if provided
  will be called when 'make test' fails. we use it in mod_perl to print
  the pointers on how to proceed when the failure occurs.
  
  Revision  Changes    Path
  1.30      +1 -1      httpd-test/perl-framework/Apache-Test/lib/Apache/TestMM.pm
  
  Index: TestMM.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestMM.pm,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -u -r1.29 -r1.30
  --- TestMM.pm	18 Jul 2003 18:50:34 -0000	1.29
  +++ TestMM.pm	5 Nov 2003 09:49:27 -0000	1.30
  @@ -54,7 +54,7 @@
   run_tests : test_clean
   	$(PASSENV) \
   	$(FULLPERL) -I$(INST_ARCHLIB) -I$(INST_LIB) \
  -	t/TEST -verbose=$(TEST_VERBOSE) $(TEST_FILES)
  +	t/TEST -bugreport -verbose=$(TEST_VERBOSE) $(TEST_FILES)
   
   test :: pure_all run_tests test_clean
   
  
  
  
  1.121     +56 -6     httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm
  
  Index: TestRun.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -u -r1.120 -r1.121
  --- TestRun.pm	26 Oct 2003 20:35:01 -0000	1.120
  +++ TestRun.pm	5 Nov 2003 09:49:27 -0000	1.121
  @@ -24,7 +24,7 @@
   my %original_t_perms = ();
   
   my @std_run      = qw(start-httpd run-tests stop-httpd);
  -my @others       = qw(verbose configure clean help ssl http11);
  +my @others       = qw(verbose configure clean help ssl http11 bugreport);
   my @flag_opts    = (@std_run, @others);
   my @string_opts  = qw(order trace);
   my @ostring_opts = qw(proxy ping);
  @@ -46,6 +46,7 @@
      'configure'       => 'force regeneration of httpd.conf (tests will not be run)',
      'clean'           => 'remove all generated test files',
      'help'            => 'display this message',
  +   'bugreport'       => 'print the hint how to report problems',
      'preamble'        => 'config to add at the beginning of httpd.conf',
      'postamble'       => 'config to add at the end of httpd.conf',
      'ping[=block]'    => 'test if server is running or port in use',
  @@ -305,14 +306,30 @@
   
       eval 'END {
                return unless is_parent(); # because of fork
  -             local $?; # preserve the exit status
  -             eval {
  -                Apache::TestRun->new(test_config =>
  -                                     Apache::TestConfig->thaw)->scan_core;
  -             };
  +             $self ||=
  +                 Apache::TestRun->new(test_config => Apache::TestConfig->thaw);
  +             {
  +                 local $?; # preserve the exit status
  +                 eval {
  +                    $self->scan_core;
  +                 };
  +             }
  +             $self->try_bug_report();
            }';
  +    die "failed: $@" if $@;
  +
  +}
  +
  +sub try_bug_report {
  +    my $self = shift;
  +    if ($? && $self->{opts}->{bugreport}) {
  +        $self->bug_report;
  +    }
   }
   
  +# virtual method: does nothing
  +sub bug_report {}
  +
   #throw away cached config and start fresh
   sub refresh {
       my $self = shift;
  @@ -1021,6 +1038,36 @@
   Several methods are sub-classable, if the default behavior should be
   changed.
   
  +=head2 C<bug_report>
  +
  +The C<bug_report()> method is executed when C<t/TEST> was executed
  +with the C<-bugreport> option, and C<make test> (or C<t/TEST>)
  +fail. Normally this is callback which you can use to tell the user how
  +to deal with the problem, e.g. suggesting to read some document or
  +email some details to someone who can take care of it. By default
  +nothing is executed.
  +
  +The C<-bugreport> option is needed so this feature won't become
  +annoying to developers themselves. It's automatically added to the
  +C<run_tests> target in F<Makefile>. So if you repeateadly have to test
  +your code, just don't use C<make test> but run C<t/TEST>
  +directly. Here is an example of a custom C<t/TEST>
  +
  +  My::TestRun->new->run(@ARGV);
  +  
  +  package My::TestRun;
  +  use base 'Apache::TestRun';
  +
  +  sub bug_report {
  +      my $self = shift;
  +  
  +      print <<EOI;
  +  +--------------------------------------------------------+
  +  | Please file a bug report: http://perl.apache.org/bugs/ |
  +  +--------------------------------------------------------+
  +  EOI
  +  }
  +
   =head2 C<pre_configure>
   
   The C<pre_configure()> method is executed before the configuration for
  @@ -1046,5 +1093,8 @@
   
   Notice that the extension is I<.c>, and not I<.so>.
   
  +=head2 C<new_test_config>
  +
  +META: to be completed
   
   =cut
  
  
  
  1.59      +4 -0      httpd-test/perl-framework/Apache-Test/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -u -r1.58 -r1.59
  --- Changes	26 Oct 2003 20:35:00 -0000	1.58
  +++ Changes	5 Nov 2003 09:49:27 -0000	1.59
  @@ -8,6 +8,10 @@
   
   =item 1.06-dev
   
  +add support for a new subclass method 'bug_report', which if provided
  +will be called when 'make test' fails. we use it in mod_perl to print
  +the pointers on how to proceed when the failure occurs. [Stas]
  +
   sudo and su -u aren't portable, therefore use a simple setuid/setguid
   perl program instead, to check whether the root directory of the test
   suite is rwx by the user/group apache is going to run under (when
  
  
  

Mime
View raw message