podfailure.pl 811 Bytes
Newer Older
Kevin Tew's avatar
Kevin Tew committed
1
#!/usr/bin/perl
Mike Hibler's avatar
Mike Hibler committed
2 3 4 5 6
#
# EMULAB-COPYRIGHT
# Copyright (c) 2009 University of Utah and the Flux Group.
# All rights reserved.
#
Kevin Tew's avatar
Kevin Tew committed
7 8 9 10
use Modern::Perl;
use File::Temp;
use Data::Dumper;
use IPC::Run3;
Kevin Tew's avatar
Kevin Tew committed
11
my $fn = "BOZO";
Kevin Tew's avatar
Kevin Tew committed
12 13 14 15

my @todos;
while(my $line = <STDIN>) {
  given($line) {
Kevin Tew's avatar
Kevin Tew committed
16 17 18
    when(/#   Failed test/) {}
    when(/#   at /) {}
    when(/^# Coverage for (\S+)/) {
Kevin Tew's avatar
Kevin Tew committed
19 20 21 22 23 24 25 26
      $fn = $1;
      $fn =~ s/::/\//g;
      $fn .= '.pm';
    }
    when( /Looks like you failed/) {
     next;
    }
    when( /^#\s+(\S+)/ ) {
Kevin Tew's avatar
Kevin Tew committed
27
      say "pushed $fn $1";
Kevin Tew's avatar
Kevin Tew committed
28 29 30 31 32 33 34 35 36 37 38
      push @todos, [$fn, $1];
    } 
  }
}

for (@todos) {
  my $temp = File::Temp->new();
  my $sfn = $temp->filename;
  my $fn = $_->[0];
  my $subname = $_->[1];
  $temp->print("/$subname\n");
Kevin Tew's avatar
Kevin Tew committed
39 40
  my $cmd = "vim lib/$fn -s $sfn";
  run3($cmd);
Kevin Tew's avatar
Kevin Tew committed
41 42 43 44
}

#say Dumper(\@todos);
exec 'reset';