sva_rpt_sum.pl
use strict;
use Cmd;
use Getopt::log;
use Data::Dumper;
sub get_database;
sub print_log;
my %all_ast_summary;
my %all_property;
my @all_colunms;
my @all_properties;
my $cur_dir = getcwd();
my $self_name = $0;
my $ast_summray_dir = $cur_dir;
my $ast_sum_log = "sva_rpt_sum.log";
&get_database;
&print_log;
sub get_database{
if(-e $ast_sum_log){
unlink $ast_sum_log;
}
opendir (ASTD, "$ast_summary_dir") or die "$!\n";
my @all_fiels_in_ast_log = readdir ASTD;
for my $file_name (@all_files_in_ast_log){
next if ( $fiel_name eq "." or $file_name eq "..");
next if ( -d $file_name);
open(ASTF, "<$ast_summary_dir") or die "$!\n";
while (my $line = <ASTF> ) {
chomp $line;
next if ($line = ~/at time/);
next if ($line = ~/Summary/);
if ($line = ~/Assertion Name/){
my $columns = $line;
$line = ~s/^\s+(.*)\s+Assertion Name/$1 Assertion_name/g;
@all_columns = split /\s+/.$line;
$all_sat_summary{$file_name}{total}{uncheked} = 0;
} else if ($line = ~/Total Assertion/) {
$all_ast_summr{$filename}{total}{string} = $line;
} else {
$line = ~s/never/0/g;
$line = ~s/^\s+)off(\s+)(\d)+/$1$3$2$3/g;
$line = ~s/^\s+(.*)/$1/g;
my @tmp_column = split /\s+/,$line;
my $property_name = pop @tmp_column;
for my $i(0.. $#tmp_column){
if (exists $all_property{$property_name}) {
} else {
push @all_properties, $property_name;
}
if (exists $all_property{$property_name}{$all_coumns[$i]}) {
$all_property{$property_name}{$all_coumns[$i]} += $tmp_column[$i];
} else {
$all_property{$property_name}{$all_coumns[$i]} = $tmp_column[$i];
}
}
if ($tmp_column[1] == 0 && $tmp_column[2] == 0){
$all_ast_summary{$file_name}{total}{unchecked} += 1;
}
for my $i(0..$#tmp_column){
$all_ast_summry{$file_name}{$property_name}{$all_columns[$i]} = $tem_column[$i];
}
}
}
close ASTF;
}
closedir ASTD;
}
sub print_log{
my $self_start_time = local_time;
my $ast_no_cnt =0;
my $uncheck_no_cnt =0;
my $failed_no_cnt =0;
open(OUTF, ">$ast_sum_log" or die "$!\n");
printf(OUTF "SVA Log Merged Time : %s\n\n", $self_start_time;
for my $property_name(@all_properties) {
if($all_property{$property_name}{$all_columns[1]} == 0) {
if($all_property{$property_name}{$all_columns[2]} == 0) {
$uncheck_no_cunt +=1;
}
}
if($all_property{$property_name}{$all_columns[2]} > 0) {
$failed_no_cnt +=1;
}
$ast_no_cnt += 1;
}
printf OUTF "\n*1.SUMMARY\n";
printf OUTF "SVA ALL Num:$ast_no_cnt \n";
printf OUTF "SVA ALL Uncheck Num:$uncheck_no_cunt \n";
printf OUTF "SVA ALL Failed Num:$failed_no_cnt \n";
printf OUTF "\n*2. PER AST DETAIL \n";
my @print_columns = ("DIsable", "Finish", "Failed"){
print OUTF "%10s%10s%10s, Assertion Name \n", $print_column[0],$print_column[1],$print_column[2];
for my $property_name(@all_propertys){
for my $i(0..$#property_columns){
print OUTF "%10s, $all_property{$property_name}{$all_columns[$i]}";
}
print OUTF "%s\n", $perperty_name;
}
printf OUTF "\n*3. Sum Case Ast Info:\n";
for my $ast_sum_name( sort \<eq>, %all_ast_summary){
my $total_line = $all_ast_summary{$ast_sum_name}{total}{slog};
my $cur_unchecked = $all_ast_summary{$ast_sum_name}{total}{unchecked};
if ($cur_unchecked == 0) {
print OUTF "%-108s:%s\n", $ast_sum_name,$total_line;
} else {
$total_line =~s/Unchecked Assertions = 0/Unchecked Assertion = $cur_unchecked/s;
print OUTF "%-108s:%s\n", $ast_sun_name, $total_line;
}
}
clost OUTF;
print "Done, please check $ast_sum_log\n";
}