[69143c]: admin / report.pl  Maximize  Restore  History

Download this file

79 lines (68 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/perl
#
# $Id: report.pl,v 1.1.2.1 2004-03-11 08:52:20 lsf37 Exp $
# Author: Gerwin Klein, NICTA
# License: GPL (GNU GENERAL PUBLIC LICENSE)
#
# Parses log file and generates report of entry status.
# Prints out diff to last report.
#
if ($#ARGV!=1) {
print "usage: report.pl <logfile> <report-file>\n";
exit 1;
}
$logfile=$ARGV[0];
$report=$ARGV[1];
$FAIL="FAIL";
$OK="ok";
# read log file
open (IN,$logfile) || die "could not open [$logfile]";
@lines = <IN>;
close IN;
# parse log file
for $i ( 0 .. $#lines) {
$_ = $lines[$i];
if ( /^Testing \[([^\]]+)\]/ ) {
$tests{$1} = 1;
}
if ( /The following tests failed/ ) {
foreach $f (split (/[ \n]/,$lines[$i+1])) {
$fail{$f} = 1;
}
}
}
# read and parse old report
open (IN,$report);
while (<IN>) {
chop;
($name, $f) = split /[:]/;
$old_tests{$name} = 1;
$old_fail{$name} = ($f =~ /$FAIL/);
}
close IN;
# save old report
rename ($report, $report.".old");
# write new report
open (OUT,">$report") || die "could not open [$report] for writing.";
foreach $t (keys tests) {
$status = $fail{$t} ? $FAIL : $OK;
print OUT "$t: $status\n";
}
close OUT;
# output diff
foreach $t (keys old_tests) {
$old_status = $old_fail{$t} ? $FAIL : $OK;
$new_status = $fail{$t} ? $FAIL : $OK;
if (!$tests{$t}) {
print "[$t] was removed. Last status was $old_status.\n";
}
elsif ($old_fail{$t} != $fail{$t}) {
print "[$t] changed from $old_status to $new_status.\n";
}
}
foreach $t (keys tests) {
if (!$old_tests{$t}) {
$new_status = $fail{$t} ? $FAIL : $OK;
print "[$t] is new. Status is $new_status.\n";
}
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks