/[Frey]/trunk/lib/Frey/Test/Runner.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/Test/Runner.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 570 by dpavlin, Thu Nov 27 22:11:13 2008 UTC revision 776 by dpavlin, Tue Dec 9 20:31:37 2008 UTC
# Line 63  has test_because => ( Line 63  has test_because => (
63  sub as_markup {  sub as_markup {
64          my ($self) = @_;          my ($self) = @_;
65    
66    =for later
67    
68          my $path = 'var/test/';          my $path = 'var/test/';
69          my $running_pid = "$path/running.pid";          my $running_pid = "$path/running.pid";
70    
71          my $pid = read_file $running_pid if -e $running_pid;          my $pid = read_file $running_pid if -e $running_pid;
72          if ( $pid ) {          if ( $pid ) {
73                  if ( kill 0, $pid ) {                  if ( kill 0, $pid ) {
74                          warn "ABORTING: $self started twice";                          warn "ABORTING: $self allready running as pid $pid";
75                          return 'abort';                          return 'abort';
76                  } else {                  } else {
77                          warn "got $pid from $running_pid but no process alive, ignoring...";                          warn "got $pid from $running_pid but no process alive, ignoring...";
# Line 79  sub as_markup { Line 81  sub as_markup {
81          write_file( $running_pid, $$ );          write_file( $running_pid, $$ );
82          warn "# started $self with pid $$ -> $running_pid";          warn "# started $self with pid $$ -> $running_pid";
83    
84    =cut
85    
86          my $f = TAP::Formatter::HTML->new({          my $f = TAP::Formatter::HTML->new({
87  #               silent => 1,  #               silent => 1,
88    
# Line 97  sub as_markup { Line 101  sub as_markup {
101          if ( my $depends = $self->test_because ) {          if ( my $depends = $self->test_because ) {
102                  @tests = grep {                  @tests = grep {
103                          $_ ne '' &&                          $_ ne '' &&
104                            -e $_ &&
105                          ! m{$0} # break recursion                                ! m{$0} # break recursion      
106                  } sort keys %{ $depends } unless @tests;                  } sort keys %{ $depends } unless @tests;
107          }          }
# Line 107  sub as_markup { Line 112  sub as_markup {
112                  warn "can't find any tests ", dump( $self->tests ), " within depends ", dump( $self->test_because );                  warn "can't find any tests ", dump( $self->tests ), " within depends ", dump( $self->test_because );
113  #               warn "running all tests instead";  #               warn "running all tests instead";
114  #               @tests = glob('t/*.t');  #               @tests = glob('t/*.t');
115                  @tests = glob('t/01*.t'); # XXX default tests                  @tests = ( qw{t/00-load.t t/pod.t} ); # XXX default tests
116          }          }
117    
118          $self->title( join(' ', @tests ) );          $self->title( join(' ', @tests ) );
# Line 141  sub as_markup { Line 146  sub as_markup {
146    
147          $html =~ s{(<a class="file") href="#"(.+?)>t/(.+?)</a>}{<a target="editor" href="/editor+t/$3.t+1" name="t/$3.t" $2>$3</a>}sg;          $html =~ s{(<a class="file") href="#"(.+?)>t/(.+?)</a>}{<a target="editor" href="/editor+t/$3.t+1" name="t/$3.t" $2>$3</a>}sg;
148    
149          $html = $self->editor_links( $html );          $html = $self->html_links( $html );
150    
151          if ( my $depends = $self->test_because ) {          if ( my $depends = $self->test_because ) {
152                  $html .= qq|Test dependencies:|                  $html .= qq|Test dependencies:|
153                  . qq|<ul><li>|                  . qq|<ul><li>|
154                  . join("</li>\n<li>",                  . join("</li>\n<li>",
155                          map {                          map {
156                                  qq|<a href="?test=$_"><tt>$_</tt></a> &larr; |                                  my $test = $_;
157                                  .                                  my $depends =
158                                  join(' ',                                  join(' ',
159                                          map {                                          map {
160                                                  if ( m{\s} ) {                                                  if ( m{\s} ) {
# Line 159  sub as_markup { Line 164  sub as_markup {
164  #                                                       qq|<a target="editor" href="/editor+$_+1" title="edit">$_</a>|  #                                                       qq|<a target="editor" href="/editor+$_+1" title="edit">$_</a>|
165                                                  }                                                  }
166                                          } keys %{ $depends->{$_} }                                          } keys %{ $depends->{$_} }
167                                  )                                  );
168                                    qq|<a href="?test=$test"><tt>$test</tt></a>|
169                                    . ( $depends ? qq| &larr; $depends| : '' )
170                                    ;
171                          } @tests )                          } @tests )
172                  . qq|</li></ul>|                  . qq|</li></ul>|
173                  ;                  ;
# Line 169  sub as_markup { Line 177  sub as_markup {
177    
178          $self->add_icon( $1 ) if $html =~ m{class="(passed|failed)"};          $self->add_icon( $1 ) if $html =~ m{class="(passed|failed)"};
179    
180    =for later
181    
182          unlink $running_pid or die "can't remove $running_pid: $!";          unlink $running_pid or die "can't remove $running_pid: $!";
183    
184    =cut
185    
186          return $html;          return $html;
187  }  }
188    

Legend:
Removed from v.570  
changed lines
  Added in v.776

  ViewVC Help
Powered by ViewVC 1.1.26