source: status/parse.pl @ 1147

Last change on this file since 1147 was 1147, checked in by Earle Martin, 14 years ago

First stab at test output parsing.

File size: 752 bytes
Line 
1#!/usr/bin/perl
2
3use warnings;
4use strict;
5
6use Data::Dumper;
7use Template;
8
9my $file = $ARGV[0];
10
11die 'No input file specified'  unless $file;
12die "That file doesn't exist"  unless -e $file;
13die "That isn't a plain file"  unless -f _;
14die "That file isn't readable" unless -r _;
15
16open (my $RESULTS, '<', $file) or die "Can't open $file: $!";
17my @lines = <$RESULTS>;
18close $RESULTS;
19
20my (%tests, $current_test);
21
22foreach (@lines) {
23                chomp;
24
25                if (m{^t/(.*?)\.}) {
26                        $current_test = $1;
27                } elsif (/^ok$/) {
28                        $tests{$current_test} = 100;
29                } elsif (/Failed .*? tests, (.*?)% okay/) {
30                        $tests{$current_test} = $1;
31                }
32}
33
34my $tt = Template->new({
35        INCLUDE_PATH => 'templates',
36});
37
38$tt->process('tests.tt', { 'tests' => \%tests }) or die $tt->error;
Note: See TracBrowser for help on using the repository browser.