A very simple perl script to read all log simulation
files of specman regression and generate a nice
failure report.
-
The scripts works on one file at a time. It scans each log file, generated by
specman, for the following error strings (specified in regular expression)
:
- Dut error
- Error:
- Simulation Result: [^P]
For the Dut error, the entire group of lines between two bars are printed.
-
The script is invoked by scanning the log directories. Two examples follow:
- find ELOG -type f | xargs -n1 | xargs -i= perl ~/bin/e_reg_report.pl =
-
foreach x ( `find ELOG/*.elog` )
perl ~/bin/e_reg_report.pl $x
end
-
The script is listed below:
- #!/bin/perl
- open(FPR, $ARGV[0]) || die("open fail $ARGV[0]\n");
- open(FPW, ">>reg_rpt.txt");
- @ignore_a = ();
- push(@ignore_a, "SEQ_WATCHDOG_TC issued on channel");
- $line_i=0;
- $dut_error=0;
- while(eof(FPR) != 1) {
- $line=<FPR>; chomp($line);
- $n=$#a;
- if($line =~ /Dut error/) {
- $dut_error=1;
- }
- if($line =~ /-----------------------/) {
- if($n == -1) {
- push(@a, $line);
- } else {
- push(@a, $line);
- if($dut_error == 1) {
- #shall I ignore the error
- $ignore=-1;
- foreach $j ( @a ) {
- $len=$#ignore_a;
- if($len >= 0) {
- foreach $k ( @ignore_a ) {
- $ignore=index($j, $k);
- if($ignore >= 0) {last;};
- }
- if($ignore >= 0) {last;};
- }
- }
- if($ignore < 0) {
- foreach $j ( @a ) {
- print FPW ("$ARGV[0] :: $j\n");
- }
- }
- $dut_error=0;
- }
- @a=(); $n=0;
- }
- }
- elsif($n >= 0) {
- push(@a, $line);
- }
- elsif($line =~ /Error:/) {
- print FPW ("$ARGV[0] :: $line\n");
- }
- elsif($line =~ /Simulation Result: [^P]/) {
- print FPW ("$ARGV[0] :: $line\n");
- }
- $line_i++;
- }#while
- close FPR;
- close FPW;
|