Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # ========== Copyright Header Begin ========================================== |
2 | # | |
3 | # OpenSPARC T2 Processor File: Regreport.pm | |
4 | # Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
5 | # 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
6 | # | |
7 | # * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
8 | # | |
9 | # This program is free software; you can redistribute it and/or modify | |
10 | # it under the terms of the GNU General Public License as published by | |
11 | # the Free Software Foundation; version 2 of the License. | |
12 | # | |
13 | # This program is distributed in the hope that it will be useful, | |
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | # GNU General Public License for more details. | |
17 | # | |
18 | # You should have received a copy of the GNU General Public License | |
19 | # along with this program; if not, write to the Free Software | |
20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | # | |
22 | # For the avoidance of doubt, and except that if any non-GPL license | |
23 | # choice is available it will apply instead, Sun elects to use only | |
24 | # the General Public License version 2 (GPLv2) at this time for any | |
25 | # software where a choice of GPL license versions is made | |
26 | # available with the language indicating that GPLv2 or any later version | |
27 | # may be used, or where a choice of which version of the GPL is applied is | |
28 | # otherwise unspecified. | |
29 | # | |
30 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
31 | # CA 95054 USA or visit www.sun.com if you need additional information or | |
32 | # have any questions. | |
33 | # | |
34 | # ========== Copyright Header End ============================================ | |
35 | package Regreport; | |
36 | ||
37 | use strict; | |
38 | use warnings; | |
39 | use IO::Handle; | |
40 | use Cwd; # to get safe current working directory | |
41 | use Cwd 'chdir'; # so $ENV{PWD} is set as well | |
42 | ||
43 | require Exporter; | |
44 | ||
45 | our @ISA = qw(Exporter); | |
46 | ||
47 | STDOUT->autoflush(1); | |
48 | STDERR->autoflush(1); | |
49 | ||
50 | #------------------------------------------------------------------------- | |
51 | # Items to export into callers namespace by default. Note: do not export | |
52 | # names by default without a very good reason. Use EXPORT_OK instead. | |
53 | # Do not simply export all your public functions/methods/constants. | |
54 | ||
55 | # This allows declaration use Regreport ':all'; | |
56 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | |
57 | # will save memory. | |
58 | #------------------------------------------------------------------------- | |
59 | ||
60 | my @funcs = qw(regenerate chk_single_diag wait_regression regress_stat cutitup); | |
61 | my @vars = qw($wait_sec $debug $sas_only $cut_name $rsfh $clean_pass | |
62 | $fails_only $sim); | |
63 | ||
64 | our %EXPORT_TAGS = ( | |
65 | funcs => [ @funcs ], | |
66 | vars => [ @vars ], | |
67 | all => [ @funcs, @vars] ); | |
68 | ||
69 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |
70 | ||
71 | our @EXPORT = @{ $EXPORT_TAGS{'all'} }; | |
72 | ||
73 | our $VERSION = '3.60_n2.20'; | |
74 | ||
75 | # Preloaded methods go here. | |
76 | ||
77 | #====================================================== | |
78 | $SIG{INT}= \&cleanup; | |
79 | #====================================================== | |
80 | ||
81 | our($wait_sec)= 100; # polling interval (for -regress) | |
82 | our($debug, $sas_only, $cut_name, $clean_pass, $fails_only,$sim); | |
83 | our($rsfh) = \*STDOUT; # the file handler where regress_stat dumps | |
84 | ||
85 | my $period=100; | |
86 | my(@errlines); # error lines being gathered | |
87 | my(@perf_errors); # performance error lines being gathered | |
88 | my ($diagplerr, $tsotoolerr); | |
89 | my(%stat_details, %stats); # status hash per diag | |
90 | ||
91 | my (%group_count); # # of diags in different groups | |
92 | my (%group_count_stat); # 2-D array with status per group | |
93 | ||
94 | my $start_time = time; | |
95 | ||
96 | # The status types: | |
97 | #------------------ | |
98 | my(%status_short)= ('pass' => 'PASS', | |
99 | 'fail' => 'FAIL', | |
100 | 'asst' => 'ASST', | |
101 | 'diag' => 'DIAG', | |
102 | 'lcns' => 'LIC', | |
103 | 'maxc' => 'MAXC', | |
104 | 'sckt' => 'SOCKT', | |
105 | 'timo' => 'TIMEO', | |
106 | 'simx' => 'NAS', | |
107 | 'perf' => 'PERF', | |
108 | 'dream' => 'DREAM', | |
109 | 'unkn' => 'UNKN', | |
110 | 'unfi' => 'UNFIN', | |
111 | 'nomem' => 'NOMEM' | |
112 | ); | |
113 | ||
114 | my(%STATUS_NAME)= ('pass' => 'PASS', | |
115 | 'fail' => 'FAIL', | |
116 | 'asst' => 'Assertion Fired', | |
117 | 'diag' => 'Diag Problem', | |
118 | 'lcns' => 'License Problem', | |
119 | 'maxc' => 'MaxCycles Hit', | |
120 | 'sckt' => 'Socket Problem', | |
121 | 'timo' => 'Timeout', | |
122 | 'simx' => 'Simics Problem', | |
123 | 'perf' => 'Performance', | |
124 | 'dream' => 'Killed By Dream', | |
125 | 'unkn' => 'Unknown', | |
126 | 'unfi' => 'UnFinished', | |
127 | 'nomem' => 'Out of Memory' | |
128 | ); | |
129 | ||
130 | my @status_types = qw(pass fail asst maxc timo diag sckt perf simx dream lcns unkn unfi nomem); | |
131 | ||
132 | #default error pattern | |
133 | #--------------------- | |
134 | my($good_trap_va) = 422000; | |
135 | my($hgood_trap_va) = 82000; | |
136 | my($bad_trap_va) = 422020; | |
137 | my($hbad_trap_va) = 82020; | |
138 | ||
139 | #-------------------------------------------------------------- | |
140 | my $w=100; | |
141 | my($drawline) = ("=" x $w) . "\n"; | |
142 | my($errline_num) = 0; | |
143 | my($found_wall_sec) = 0; | |
144 | my($found_sim_cyc) = 0; | |
145 | my($wall_sec) = 0; | |
146 | my($sim_cyc) = 0; | |
147 | ||
148 | my($GUNZIP) = "gzip -dc"; # gunzip | |
149 | ||
150 | my($err_lines_per_diag) = 10; # lines per diag (to report) | |
151 | ||
152 | my($animate)= 0; #0: to turn off display of diags | |
153 | ||
154 | (my($TOOLBIN)= $0)=~ s%/[^/]+$%%; #same path as this script | |
155 | ||
156 | ||
157 | my ($grp_pos_in_name) = 1; | |
158 | ||
159 | my ($log_exists); | |
160 | ||
161 | my ($outofmemory) = 0; | |
162 | my ($outofmemory_sig); | |
163 | my ($dreamback); | |
164 | my ($dreamjobid); | |
165 | ||
166 | ||
167 | my @relnames; | |
168 | ||
169 | #================================================================== | |
170 | # START of LIB | |
171 | #================================================================== | |
172 | sub chk_statuslog { | |
173 | my($diag)= @_; | |
174 | ||
175 | my(@templist) = (); | |
176 | $found_wall_sec = 0; | |
177 | $found_sim_cyc = 0; | |
178 | $wall_sec = 0; | |
179 | $sim_cyc = 0; | |
180 | $errline_num = 0; | |
181 | ||
182 | my($status) = 'unfi'; | |
183 | ||
184 | #figure out diag directory | |
185 | #========================= | |
186 | if($diag eq '.') { | |
187 | chop($diag= `pwd`); | |
188 | $diag=~ m%([^/]+)$%; | |
189 | $diag= $1; | |
190 | # ... if($diag=~ /\w+:([^:]+:[^:]+):\d+/) { $diag= $1; } | |
191 | }elsif(! -d $diag) { die "No such diag directory: $diag\n"; } | |
192 | else{ chdir($diag); } | |
193 | ||
194 | # extract key info from prev generated file | |
195 | #========================================== | |
196 | my($stat_file)= 'status.log'; | |
197 | my($finished)= 0; | |
198 | if(-f $stat_file) { #status file already generated | |
199 | open(IN, "< $stat_file") || die "Cannot open $stat_file\n"; | |
200 | $finished= 1; | |
201 | }elsif(-f "$stat_file.gz") { #status file already generated | |
202 | open(IN, "$GUNZIP $stat_file.gz |") || die "Cannot gunzip $stat_file\n"; | |
203 | $finished= 1; | |
204 | } | |
205 | ||
206 | if($finished) { | |
207 | $status = 'unkn'; | |
208 | while(<IN>) { #print lines to stdout | |
209 | if(/^Rundir/) { #extract status, and | |
210 | $status= &get_status($_); | |
211 | } | |
212 | elsif(/^Cycles=(\d+\.?\d*), Seconds=(\d+\.?\d*)/) { | |
213 | $sim_cyc = $1; | |
214 | $wall_sec = $2; | |
215 | } | |
216 | push(@templist, $_); | |
217 | } | |
218 | close(IN); | |
219 | ||
220 | if(-r 'sims.log' || -r 'sims.log.gz') | |
221 | { | |
222 | if(-r "sims.log") { open (F, "sims.log");} | |
223 | elsif(-r "sims.log.gz") { open (F, "$GUNZIP sims.log.gz |");} | |
224 | ||
225 | print STDERR " I am doing sims\n" if($debug); | |
226 | while(<F>) | |
227 | { | |
228 | if (/Chronologic VCS simulator/o && ($sim eq 'vcs')){ last;} | |
229 | elsif (/Cadence Design Systems/ && ($sim eq 'ncv')){ last;} | |
230 | elsif(!$sas_only && /SIMICS STEP/o){ last;} | |
231 | elsif(/Found diag under.*(verif.*\.s)/) { | |
232 | my($tmp) = "Diag: " . "\$DV_ROOT\/" . $1 . "\n"; | |
233 | $templist[0] = $tmp; | |
234 | } | |
235 | elsif(/midas: fatal error|no diag/i){ | |
236 | $status = 'diag'; | |
237 | my($tmp) = "Rundir: " . $diag . ":0" . "\t\t\t Diag Problem\n"; | |
238 | $templist[0] = $tmp; | |
239 | push(@templist, $_); | |
240 | last; | |
241 | } | |
242 | elsif(/error.*performance\s+mismatch/i){ | |
243 | $status = 'perf'; | |
244 | my($tmp) = "Rundir: " . $diag . ":0" . "\t\t\t Performance Problem\n"; | |
245 | $templist[0] = $tmp; | |
246 | push(@templist, $_); | |
247 | last; | |
248 | } elsif(/sas socket open timeout/i){ | |
249 | $status = 'sckt'; | |
250 | my($tmp) = "Rundir: " . $diag . ":0" . "\t\t\t Socket Open Timeout: Probably picked a socket already in use\n"; | |
251 | $templist[0] = $tmp; | |
252 | push(@templist, $_); | |
253 | } elsif(/no space left on device/i ){ | |
254 | $status = 'dream'; | |
255 | my($tmp) = "Rundir: " . $diag . ":0" . "\t\t\t Possible Dream, disk or SIG Problem\n"; | |
256 | $templist[0] = $tmp; | |
257 | push(@templist, $_); | |
258 | } elsif(/caught a sig/i ){ | |
259 | my($tmp); | |
260 | my($tmp1) = $_; | |
261 | &check_logfile; | |
262 | if($outofmemory) { | |
263 | if(&rerun_diag($diag)) { | |
264 | # since the diag has been restarted, indicate it is unfinished | |
265 | $status = 'unfi'; | |
266 | push(@templist, "$diag unfinished\n"); | |
267 | push(@templist, "$drawline"); | |
268 | last; | |
269 | }else { | |
270 | $status = 'nomem'; | |
271 | $tmp = "Rundir: " . $diag . ":0" . "\t\t\t Ran out of memory\n"; | |
272 | } | |
273 | } else { | |
274 | $status = 'dream'; | |
275 | $tmp = "Rundir: " . $diag . ":0" . "\t\t\t Possible Dream, disk or SIG Problem\n"; | |
276 | } | |
277 | $templist[0] = $tmp; | |
278 | push(@templist, $tmp1); | |
279 | }elsif (/-max_error|exit_on_error|stop_on_error|-no-warn-mismatch|vcs_run|ncv_run/){ next;} | |
280 | elsif(/regress_date/i){ push(@templist, $_);} | |
281 | elsif(/regress_time/i){ push(@templist, $_);} | |
282 | elsif(/group_name/i){ push(@templist, $_);} | |
283 | elsif(/running on\s+(\S+)/) { $dreamback = $1; } | |
284 | elsif(/drmjobid\s+(\S+\s+\S+)/) { $dreamjobid = $1;} | |
285 | } | |
286 | print "finished simsgrep\n" if($debug); | |
287 | close(F); | |
288 | } | |
289 | push(@templist, $drawline); | |
290 | } | |
291 | else{ | |
292 | push(@templist, "$diag unfinished\n"); | |
293 | push(@templist, "$drawline"); | |
294 | } | |
295 | $stats{$diag} = $status; | |
296 | $stat_details{$diag} = [@templist]; | |
297 | ||
298 | # Clean up passing, if requested | |
299 | if ($clean_pass && $status eq 'pass') { | |
300 | opendir (DIR, "."); | |
301 | my @delfiles = grep(!/$stat_file|^\.+$/, readdir(DIR)); | |
302 | close DIR; | |
303 | print "Delfiles: @delfiles" if ($debug); | |
304 | system ("rm -rf @delfiles"); | |
305 | } | |
306 | chdir('..'); | |
307 | return ($status, $sim_cyc, $wall_sec); | |
308 | } | |
309 | ||
310 | #====================================================================== | |
311 | ||
312 | sub chk_single_diag { | |
313 | if ( !(-r 'sims.log') and !(-r 'sims.log.gz') ) { | |
314 | print "-----> sims.log / sims.log.gz does not exist ! \n"; | |
315 | exit(0); | |
316 | } | |
317 | my($diag)= @_; | |
318 | ||
319 | my(@templist); | |
320 | $found_wall_sec = 0; | |
321 | $found_sim_cyc = 0; | |
322 | $wall_sec = 0; | |
323 | $sim_cyc = 0; | |
324 | $errline_num = 0; | |
325 | @errlines = (); | |
326 | ||
327 | my($status) = 'unkn'; | |
328 | ||
329 | #figure out diag directory | |
330 | #========================= | |
331 | if($diag eq '.') { | |
332 | chop($diag= `pwd`); | |
333 | $diag=~ m%([^/]+)$%; | |
334 | $diag= $1; | |
335 | }elsif(! -d $diag) { die "No such diag directory: $diag\n"; } | |
336 | else{ chdir($diag); } | |
337 | ||
338 | if($cut_name){ | |
339 | my @tempnamelist = split ':', $diag; | |
340 | if(($tempnamelist[$#tempnamelist] =~ /^\d+$/) && ($#tempnamelist > 0)){ | |
341 | $#tempnamelist--; | |
342 | } | |
343 | $diag = join ':', @tempnamelist; | |
344 | } | |
345 | ||
346 | # extract key info from files | |
347 | #============================ | |
348 | ||
349 | my($open_sym) = 0; | |
350 | if(-e "symbol.tbl"){ | |
351 | open(SYM, "symbol.tbl") || die "Cannot open symbol.tbl\n"; | |
352 | $open_sym = 1; | |
353 | } elsif(-e "symbol.tbl.gz"){ | |
354 | open(SYM, "$GUNZIP symbol.tbl.gz |") || die "Cannot gunzip symbol.tbl.gz\n"; | |
355 | $open_sym = 1; | |
356 | } | |
357 | ||
358 | if($open_sym){ | |
359 | while(<SYM>){ | |
360 | if(/good_trap\s+(\w+)/){ | |
361 | $good_trap_va = $1; | |
362 | } | |
363 | elsif(/\.HT0_GoodTrap_0x100\s+0+(\w+)/){ | |
364 | $hgood_trap_va = $1; | |
365 | } | |
366 | elsif(/bad_trap\s+(\w+)/){ | |
367 | $bad_trap_va = $1; | |
368 | } | |
369 | elsif(/\.HT0_BadTrap_0x101\s+\w+\s+0+(\w+)/){ | |
370 | $hbad_trap_va = $1; | |
371 | } | |
372 | } | |
373 | if($debug){ | |
374 | print "good trap $good_trap_va \tbad trap $bad_trap_va \n"; | |
375 | print "hgood trap $hgood_trap_va \thbad trap $hbad_trap_va \n"; | |
376 | } | |
377 | } | |
378 | ||
379 | my($something) = 0; | |
380 | if(-r 'midas.log' || -r 'midas.log.gz') { | |
381 | if(-r "midas.log") { open (F, "midas.log");} | |
382 | elsif(-r "midas.log.gz") { open (F, "$GUNZIP midas.log.gz |");} | |
383 | &midasgrep; | |
384 | close(F); | |
385 | $something = 1; | |
386 | } | |
387 | ||
388 | $log_exists = 0;my @data; | |
389 | if(!$sas_only) | |
390 | { | |
391 | if(-r 'sims.log' || -r 'sims.log.gz') | |
392 | { | |
393 | if(-r "sims.log") { open (F, "sims.log") or die("Unable to open file sims.log"); } | |
394 | elsif(-r "sims.log.gz") { open (F, "$GUNZIP sims.log.gz |") or die("Unable to open file sims.log.gz"); } | |
395 | } | |
396 | @data=<F>; | |
397 | close F; | |
398 | my @d = grep { /Vera: Loading main|ERROR|SIGDIE|regreport checking|regreport clock period|Time:.*[p|f]s|CPU Time:|ncsim: CPU Usage/ } @data; | |
399 | #my @d = grep { /Vera: Loading main|ERROR|regreport(?! will determine)|SIGDIE|GOOD End|^Time:|[cC][pP][uU] [tT]ime[ ]*[:=]|finish at simulation time [0-9]+|Firing: [0-9]+|Message:|Signature:/ } @data; | |
400 | &sim_grep (\@d ); | |
401 | $something = 1; | |
402 | $log_exists = 1; | |
403 | } | |
404 | elsif(-r 'dream.log' || -r 'dream.log.gz') { | |
405 | if(-r "dream.log") { open (F, "dream.log");} | |
406 | elsif(-r "dream.log.gz") { open (F, "$GUNZIP dream.log.gz |");} | |
407 | &dreamloggrep; | |
408 | close(F); | |
409 | $something = 1; | |
410 | }elsif($sas_only && (-r 'sims.log' || -r 'sims.log.gz')) { | |
411 | if(-r "sims.log") { open (F, "sims.log");} | |
412 | elsif(-r "sims.log.gz") { open (F, "$GUNZIP sims.log.gz |");} | |
413 | #---------------------------------------------------------------------- | |
414 | # this is a little hacky but listen up: | |
415 | # for the weird situation when I am checking a single diag for sas_only run | |
416 | # regreport -1 -sas_only | |
417 | # I open sims.log but perform the dreamloggrep checks | |
418 | #---------------------------------------------------------------------- | |
419 | &dreamloggrep; | |
420 | close(F); | |
421 | $something = 1; | |
422 | } | |
423 | ||
424 | if(-r 'sas.log' || -r 'sas.log.gz') { | |
425 | if(-r "sas.log") { open (F, " tail -1000 sas.log |");} | |
426 | elsif(-r "sas.log.gz") { open (F, "$GUNZIP sas.log.gz | tail -1000 |");} | |
427 | &sasgrep; | |
428 | close(F); | |
429 | $something = 1; | |
430 | } | |
431 | ||
432 | if(!$something) { | |
433 | printf $rsfh "Rundir: %-40s %s\n", $diag.":0", $STATUS_NAME{'unkn'}; | |
434 | return ('unkn', 0, 0); | |
435 | } | |
436 | ||
437 | ||
438 | #analyze failure | |
439 | #=============== | |
440 | my($long_stat, $i, $curr_line); | |
441 | ||
442 | $long_stat= "$STATUS_NAME{'unkn'} (No Status)"; | |
443 | $status = 'unkn'; | |
444 | for($i = 0; $i < $errline_num; $i++) | |
445 | { | |
446 | $curr_line= $errlines[$i]; | |
447 | if($curr_line =~ /(\w+-MISMATCH)/) { | |
448 | $long_stat= "$STATUS_NAME{'fail'} ($1)"; | |
449 | $status = 'fail'; | |
450 | last; | |
451 | }elsif($curr_line=~/SIGDIE.*sas socket open timeout/) { | |
452 | $long_stat= "$STATUS_NAME{'sckt'} (Socket)"; | |
453 | $status = 'sckt'; | |
454 | last; | |
455 | }elsif($curr_line=~/ERROR - failing assertion/) { | |
456 | $long_stat= "$STATUS_NAME{'asst'} (Monitor)"; | |
457 | $status = 'asst'; | |
458 | last; | |
459 | }elsif($curr_line =~ /ERROR.*TIMEOUT/o) { | |
460 | $long_stat= "$STATUS_NAME{'timo'} (Monitor)"; | |
461 | $status= 'timo' ; | |
462 | last; | |
463 | }elsif($curr_line =~ /ERROR:\s+Maximum Simulation Cycles\s+(.*?)\s+Reached/o) { | |
464 | $long_stat= "$STATUS_NAME{'maxc'} $1"; | |
465 | $status = 'timo'; | |
466 | last; | |
467 | }elsif($curr_line=~/ERROR/o) { | |
468 | $long_stat= "$STATUS_NAME{'fail'} (Monitor)"; | |
469 | $status = 'fail'; | |
470 | last; | |
471 | }elsif($curr_line =~ /SAS-MEM: ASSERT ERROR:/s) { | |
472 | my($msg)= $'; #' | |
473 | $msg=~ s/(.*)\n//; #$1 is the line after | |
474 | $long_stat= "$STATUS_NAME{'fail'} (SAS-MEM:$1)"; # 'ASSERT ERROR:' | |
475 | $status = 'fail'; | |
476 | last; | |
477 | }elsif(($curr_line =~ /GOOD End/)||(!$log_exists && ($curr_line =~ /SAS hits GOOD TRAP -> PASS/))){ | |
478 | if(-r 'tsotool.log' || -r 'tsotool.log.gz') { | |
479 | if(-r "tsotool.log") { open (F, "tsotool.log");} | |
480 | elsif(-r "tsotool.log.gz") { open (F, "$GUNZIP tsotool.log.gz |");} | |
481 | $tsotoolerr = &tsotoolgrep; | |
482 | close(F); | |
483 | } | |
484 | ||
485 | if(-r 'diag_pl.log' || -r 'diag_pl.log.gz') { | |
486 | if(-r "diag_pl.log") { open (F, "diag_pl.log");} | |
487 | elsif(-r "diag_pl.log.gz") { open (F, "$GUNZIP diag_pl.log.gz |");} | |
488 | $diagplerr = &diagplgrep; | |
489 | close(F); | |
490 | } | |
491 | ||
492 | if($tsotoolerr){ | |
493 | $long_stat= "$STATUS_NAME{'fail'} tso_analyze failure"; | |
494 | $status = 'fail'; | |
495 | } | |
496 | elsif($diagplerr){ | |
497 | $long_stat= "$STATUS_NAME{'perf'}"; | |
498 | $status = 'perf'; | |
499 | } | |
500 | else{ | |
501 | $long_stat= "$STATUS_NAME{'pass'}"; | |
502 | $status = 'pass'; | |
503 | } | |
504 | }elsif($curr_line =~ /no diag|midas.*error/i) { | |
505 | $long_stat= $STATUS_NAME{'diag'}; | |
506 | $status = 'diag'; | |
507 | last; | |
508 | }elsif($curr_line =~ /Caught a SIG/) { | |
509 | &check_logfile (\@data); | |
510 | if($outofmemory) { | |
511 | $long_stat= "$STATUS_NAME{'nomem'} (Exceed Dream Memory Limit?)"; | |
512 | $status = 'nomem'; | |
513 | } else { | |
514 | $long_stat= "$STATUS_NAME{'dream'} (Exceed Dream Time Limit?)"; | |
515 | $status = 'dream'; | |
516 | } | |
517 | last; | |
518 | }elsif($curr_line =~ /(simv|ncsim) run exited with error: (.*)/) { | |
519 | $long_stat= "$STATUS_NAME{'unkn'} ($1)"; | |
520 | $status = 'unkn'; | |
521 | last; | |
522 | }elsif($curr_line =~ /cannot connect|cannot bring up server connection|the command did not complete properly/io) { | |
523 | $long_stat= $STATUS_NAME{'sckt'}; | |
524 | $status = 'sckt'; | |
525 | last; | |
526 | }elsif($curr_line =~ /simics.*shaky/i) { | |
527 | $long_stat= "$STATUS_NAME{'simx'}"; | |
528 | $status = 'simx'; | |
529 | last; | |
530 | }elsif($sas_only && ($curr_line =~ /v:0x$bad_trap_va/i)){ | |
531 | $long_stat= "$STATUS_NAME{'fail'} SAS-MEM fail in sas_only mode BAD TRAP v:0x$bad_trap_va"; | |
532 | $status = 'fail'; | |
533 | last; | |
534 | }elsif($sas_only && ($curr_line =~ /v:0x$hbad_trap_va/i)){ | |
535 | $long_stat= "$STATUS_NAME{'fail'} SAS-MEM fail in sas_only mode HBAD TRAP v:0x$bad_trap_va"; | |
536 | $status = 'fail'; | |
537 | last; | |
538 | }elsif($sas_only && ($curr_line =~ /v:0x$good_trap_va/i)){ | |
539 | $long_stat= "$STATUS_NAME{'pass'} SAS-MEM pass in sas_only mode GOOD TRAP v:0x$good_trap_va"; | |
540 | $status = 'pass'; | |
541 | last; | |
542 | }elsif($sas_only && ($curr_line =~ /v:0x$hgood_trap_va/i)){ | |
543 | $long_stat= "$STATUS_NAME{'pass'} SAS-MEM pass in sas_only mode HGOOD TRAP v:0x$good_trap_va"; | |
544 | $status = 'pass'; | |
545 | last; | |
546 | }elsif($curr_line =~ /SAS hits MAX CYCLE -> FAIL/){ | |
547 | $long_stat= "$STATUS_NAME{'maxc'} SAS hits MAX CYCLE -> FAIL"; | |
548 | $status = 'maxc'; | |
549 | last; | |
550 | } | |
551 | } | |
552 | foreach (@data) { | |
553 | if (/Found diag under.*(verif.*\.s)/) { | |
554 | printf $rsfh "Diag: %-70s\n","\$DV_ROOT\/".$1;last; | |
555 | } | |
556 | } | |
557 | printf $rsfh "Rundir: %-40s %s\n", $diag.":0", $long_stat; | |
558 | my $date=`date`; | |
559 | print $rsfh "Time finished: $date"; | |
560 | for($i = 0; $i <= $#errlines; $i++){ | |
561 | next if ($errlines[$i] =~ /Vera: Loading main/); | |
562 | print $rsfh $errlines[$i]; | |
563 | } | |
564 | if(($status eq 'pass' || $status eq 'fail' || $status eq 'asst') && $found_sim_cyc && $found_wall_sec) { | |
565 | printf $rsfh "Cycles=%.2f, Seconds=%.2f, C/S=%.2f\n", $sim_cyc, $wall_sec, $sim_cyc/$wall_sec; | |
566 | } | |
567 | ||
568 | if($diagplerr){ | |
569 | print $rsfh join '', @perf_errors; | |
570 | } | |
571 | ||
572 | STDOUT->autoflush(1); | |
573 | ($status, $sim_cyc, $wall_sec); | |
574 | } | |
575 | ||
576 | #================================================================ | |
577 | ||
578 | sub wait_regression { | |
579 | my($ofile, $regress_dir) = @_; #output file, regression directory | |
580 | ||
581 | my(@idle_char)= ('|', '/', '-', '\\'); | |
582 | my $spinner; | |
583 | my($iter)= 0; | |
584 | my($unfini) = 1; | |
585 | my($last_unfini); | |
586 | my($idle_time) = 0; | |
587 | my($total_time) = 0; | |
588 | # increased the watchdog timer value from 20000 s to 86400 s (24 hrs) | |
589 | my $watchdog=86400; | |
590 | my $regress_timeout = $ENV{REGREPORT_TIMEOUT} || $watchdog; | |
591 | ||
592 | STDOUT->autoflush(1); | |
593 | STDERR->autoflush(1); | |
594 | $animate= 0; #turn diag name printing/erasing | |
595 | system("clear"); | |
596 | # Generate release history if diff_rel_<name>.log exists | |
597 | create_rel_hist($regress_dir); | |
598 | print STDERR $drawline; | |
599 | print STDERR "\t\tSTATUS OF REGRESSION IN OPENSPARC T2\n"; | |
600 | print STDERR $drawline; | |
601 | ||
602 | while($unfini) { | |
603 | open(OUTFILE, "> $ofile") or die "cannot open $ofile"; | |
604 | $rsfh = \*OUTFILE; | |
605 | print STDERR "\b" x $w; | |
606 | ($unfini) = (regress_stat(1, $regress_dir))[2]; | |
607 | print STDERR "\b" x $w; | |
608 | close(OUTFILE); | |
609 | ||
610 | ||
611 | $spinner = $idle_char[$iter&3] x 3; | |
612 | if(!$unfini){ | |
613 | open(OUTFILE, ">> $ofile") or die "cannot open $ofile"; | |
614 | print STDERR "\n$drawline"; | |
615 | chomp( my $regname = `basename $regress_dir`); | |
616 | print STDERR "Regression $regname has completed\n"; | |
617 | if ($ofile =~ /^\//) { | |
618 | print STDERR "Details are in $ofile\n"; | |
619 | } else { | |
620 | print STDERR "Details are in $ENV{PWD}/$ofile\n"; | |
621 | } | |
622 | print STDERR "Regression Directory is $regress_dir\n"; | |
623 | if ($total_time<3600) { | |
624 | printf STDERR "Total Time Waited : %3d mins %3d secs\n",int($total_time/60),($total_time-(int($total_time/60)*60)); | |
625 | printf OUTFILE "Total Time Waited : %3d mins %3d secs\n",int($total_time/60),($total_time-(int($total_time/60)*60)); | |
626 | } | |
627 | else { | |
628 | printf STDERR "Total Time Waited : %3d hrs %3d mins\n",int($total_time/3600),int(($total_time-(int($total_time/3600)*3600))/60); | |
629 | printf OUTFILE "Total Time Waited : %3d hrs %3d mins\n",int($total_time/3600),int(($total_time-(int($total_time/3600)*3600))/60); | |
630 | } | |
631 | if ($clean_pass && | |
632 | $group_count_stat{ALL}->{'pass'} == $group_count{'ALL'}) { | |
633 | printf OUTFILE "Cleaning Run Directories ..\n"; | |
634 | printf STDERR "Cleaning Run Directories ..\n"; | |
635 | opendir (DIR, "$regress_dir"); | |
636 | foreach (grep(!/^\.+$/,readdir DIR)) { | |
637 | system ("rm -rf $regress_dir/$_") if (-d "$regress_dir/$_"); | |
638 | } | |
639 | close DIR; | |
640 | } | |
641 | print STDERR $drawline; | |
642 | close OUTFILE; | |
643 | return 0; | |
644 | } | |
645 | else{ | |
646 | my ($ih,$im,$th,$tm)=(0,0,0,0); | |
647 | if ($idle_time<3600) { $im=int($idle_time/60); } | |
648 | else { $ih=int($idle_time/3600); $im=int(($idle_time-($ih*3600))/60); } | |
649 | if ($total_time<3600) { $tm=int($total_time/60); } | |
650 | else { $th=int($total_time/3600); $tm=int(($total_time-($th*3600))/60); } | |
651 | if(!$iter) { #making progress | |
652 | printf STDERR "%-12s %6d diags remain; idle: %3d mins, total: %3d mins %-3s",'Just now started',$unfini,$im,$tm,$spinner; } | |
653 | elsif ($last_unfini > $unfini){ | |
654 | $spinner = $idle_char[($iter++)&3] x 3; | |
655 | print STDERR "\b" x $w; | |
656 | if ($idle_time<3600 && $total_time<3600) { | |
657 | printf STDERR "%-12s %6d diags remain; idle: %3d mins, total: %3d mins %-3s",'Steady progress',$unfini,$im,$tm,$spinner; } | |
658 | elsif ($idle_time<3600 && $total_time>3600) { | |
659 | printf STDERR "%-12s %6d diags remain; idle: %3d mins, total: %3d hrs %3d mins %-3s",'Steady progress',$unfini,$im,$th,$tm,$spinner; } | |
660 | else { #($idle_time>3600 && $total_time>3600) | |
661 | printf STDERR "%-12s %6d diags remain; idle: %3d hrs %3d mins, total: %3d hrs %3d mins %-3s",'Steady progress',$unfini,$ih,$im,$th,$tm,$spinner; } | |
662 | $idle_time = 0; | |
663 | } | |
664 | else{ | |
665 | print STDERR "\b" x $w; | |
666 | if ($idle_time<3600 && $total_time<3600) { | |
667 | printf STDERR "%-12s %6d diags remain; idle: %3d mins, total: %3d mins %-3s",'No progress',$unfini,$im,$tm,$spinner; } | |
668 | elsif ($idle_time<3600 && $total_time>3600) { | |
669 | printf STDERR "%-12s %6d diags remain; idle: %3d mins, total: %3d hrs %3d mins %-3s",'No progress',$unfini,$im,$th,$tm,$spinner; } | |
670 | else { #($idle_time>3600 && $total_time>3600) | |
671 | printf STDERR "%-12s %6d diags remain; idle: %3d hrs %3d mins, total: %3d hrs %3d mins %-3s",'No progress',$unfini,$ih,$im,$th,$tm,$spinner; } | |
672 | } | |
673 | print STDERR "\n"; | |
674 | } | |
675 | if($total_time > $regress_timeout){ | |
676 | print STDERR "\n$drawline"; | |
677 | if ($total_time<3600) { | |
678 | print STDERR "Well, ",int($total_time/60)," mins ",($total_time-(int($total_time/60)*60)), "secs have passed, and the regression is not over yet!\n"; } | |
679 | else { | |
680 | print STDERR "Well, ",int($total_time/3600)," hrs ",int(($total_time-(int($total_time/3600)*3600))/60)," mins have passed, and the regression is not over yet!\n"; } | |
681 | print STDERR "So, I am quitting now... Please, check the regression manually.\n"; | |
682 | print STDERR "Run \"%regreport -regenerate\" first, followed by \"%regreport <RUNDIR>\"!\n"; | |
683 | return ($unfini); | |
684 | } | |
685 | sleep($wait_sec) if($unfini); | |
686 | $idle_time+= $wait_sec; | |
687 | $total_time = (time - $start_time); | |
688 | $iter++; | |
689 | $last_unfini = $unfini; | |
690 | } | |
691 | return ($unfini); | |
692 | } | |
693 | ||
694 | #=================================================================== | |
695 | sub regenerate { | |
696 | ||
697 | my($list); | |
698 | $list= `ls -1`; | |
699 | my(@dir)= split("\n", $list); | |
700 | my($diag); | |
701 | my($i) =0; | |
702 | foreach $diag (@dir) { | |
703 | next if(! -d $diag); | |
704 | next if($diag eq 'coverage' ); | |
705 | next if($diag eq 'tre' ); | |
706 | $i++; | |
707 | print STDERR "$i: regenerating $diag\n"; | |
708 | next if(! -d $diag); | |
709 | chdir($diag); | |
710 | open(OUTFILE, "> status.log") or die "cannot open status.log"; | |
711 | $rsfh = \*OUTFILE; | |
712 | chk_single_diag("."); | |
713 | close(OUTFILE); | |
714 | chdir('..'); | |
715 | } | |
716 | } | |
717 | ||
718 | #=================================================================== | |
719 | #=================================================================== | |
720 | ||
721 | sub regress_stat { | |
722 | my ($dup_summary) = shift(@_); | |
723 | my($regress_dir)= shift(@_); | |
724 | my($status, $cyc, $sec); | |
725 | ||
726 | my ($curr_dir); | |
727 | chop($curr_dir= `pwd`); | |
728 | ||
729 | if(-d $regress_dir){ chdir($regress_dir); } | |
730 | else { print STDERR "Cannot chdir into $regress_dir\n"; } | |
731 | ||
732 | ||
733 | chop($regress_dir= `pwd`); | |
734 | ||
735 | my($i, $list, $specific_args); #list: specified diag dir list | |
736 | $specific_args = ""; | |
737 | foreach $i (@_) { | |
738 | $specific_args .= "$i* "; | |
739 | } | |
740 | if($specific_args){ $list= `ls -d1 $specific_args`;} | |
741 | else{ $list= `ls -1`;} | |
742 | ||
743 | my(@dir)= split("\n", $list); | |
744 | ||
745 | my($index)= 0; | |
746 | my($group, $diag_name); | |
747 | my(%pass_fail_count, %pass_fail_cyc, %pass_fail_sec); | |
748 | ||
749 | #======================================== | |
750 | # figure out the different groups | |
751 | #======================================== | |
752 | ||
753 | my($diag); | |
754 | foreach $diag (@dir) { | |
755 | next if(! -d $diag); | |
756 | next if($diag eq 'coverage' ); | |
757 | next if($diag eq 'tre' ); | |
758 | my @diag_name_parts = split ':',$diag; | |
759 | $group_count{$diag_name_parts[$grp_pos_in_name]} = 0 if(scalar(@diag_name_parts) > $grp_pos_in_name); | |
760 | } | |
761 | ||
762 | $group_count{'ALL'} = 0; | |
763 | my(@group_list)= reverse sort keys %group_count; | |
764 | ||
765 | #======================================== | |
766 | # initialize some variables | |
767 | #======================================== | |
768 | foreach my $status (%STATUS_NAME) { | |
769 | foreach $group (@group_list) { | |
770 | $group_count{$group}= 0; | |
771 | $group_count_stat{$group}->{$status}= 0; | |
772 | $pass_fail_count{$group}= 0; | |
773 | $pass_fail_cyc{$group}= 0; | |
774 | $pass_fail_sec{$group}= 0; | |
775 | } | |
776 | } | |
777 | ||
778 | #======================================== | |
779 | # walk-thru all diag dir and collect info | |
780 | #======================================== | |
781 | foreach $diag (@dir) { | |
782 | next if(! -d $diag); | |
783 | next if($diag eq 'coverage' ); | |
784 | next if($diag eq 'tre' ); | |
785 | my @diag_name_parts = split ':',$diag; | |
786 | $group = ""; | |
787 | if(scalar(@diag_name_parts) > $grp_pos_in_name){ | |
788 | $group= $diag_name_parts[$grp_pos_in_name]; | |
789 | if(defined $group_count{$group}){ | |
790 | ++ $group_count{$group}; | |
791 | } | |
792 | else{ | |
793 | die "Something is wrong at walk-thru group is $group\n"; | |
794 | } | |
795 | } | |
796 | ++ $group_count{'ALL'}; | |
797 | ||
798 | if($animate) { | |
799 | $diag_name= sprintf("%-60s %4d", $diag, ++$index); | |
800 | print STDERR "\b" x $w; | |
801 | print STDERR $diag_name; #print processed diag name | |
802 | STDERR->autoflush(1); | |
803 | } | |
804 | ||
805 | print STDERR " I am here\n" if($debug); | |
806 | ($status, $cyc, $sec)= &chk_statuslog($diag); | |
807 | print STDERR " I am over ($status, $cyc, $sec)\n" if($debug); | |
808 | ||
809 | ++ $group_count_stat{$group}->{$status} if ($group); | |
810 | ++ $group_count_stat{ALL}->{$status}; | |
811 | ||
812 | ### to calcuate cycles per second | |
813 | #================================ | |
814 | if($sec!=0 && ($status eq 'pass')) { | |
815 | if($group){ | |
816 | $pass_fail_count{$group} ++; | |
817 | $pass_fail_cyc{$group}+= $cyc; | |
818 | $pass_fail_sec{$group}+= $sec; | |
819 | } | |
820 | $pass_fail_count{ALL} ++; | |
821 | $pass_fail_cyc{ALL}+= $cyc; | |
822 | $pass_fail_sec{ALL}+= $sec; | |
823 | } | |
824 | ||
825 | if($animate) { print STDERR "\b" x $w; } | |
826 | } | |
827 | if($animate){ printf STDERR "%-60s %4d", "Total diags:", $group_count{'ALL'}; } | |
828 | ||
829 | #====================================== | |
830 | # print summary information | |
831 | #====================================== | |
832 | ||
833 | # Don't print status type if 0 .. | |
834 | ||
835 | my @active_types = qw(pass fail); | |
836 | foreach my $type (@status_types) { | |
837 | next if (grep(/$type/, @active_types)); | |
838 | foreach (@group_list) { | |
839 | if ($group_count_stat{$_}->{$type} >0) { | |
840 | push (@active_types, $type); | |
841 | last; | |
842 | } | |
843 | } | |
844 | } | |
845 | ||
846 | my $hide_summary = ! $dup_summary || $group_count_stat{'ALL'}->{unfi}; | |
847 | print STDERR "\b" x 120; | |
848 | ||
849 | # header | |
850 | #======= | |
851 | print $rsfh "\nSummary for $regress_dir\n"; | |
852 | print STDERR "\nSummary for $regress_dir\n" if (! $hide_summary); | |
853 | foreach (@relnames) { | |
854 | print $rsfh "Release : $_\n"; | |
855 | print STDERR "Release : $_\n" if (! $hide_summary); | |
856 | s/v=/-v /; | |
857 | my $hist = join(" ", `hist_obj $_ | tail -2`) ; | |
858 | $hist =~ s/\n/ /g; | |
859 | print $rsfh "History :$hist \n"; | |
860 | print STDERR "History :$hist \n" if (! $hide_summary); | |
861 | ||
862 | } | |
863 | print $rsfh $drawline; | |
864 | print STDERR $drawline if (! $hide_summary); | |
865 | ||
866 | printf $rsfh "%20.20s:", 'Group' ; | |
867 | printf STDERR "%20.20s:", 'Group' if (! $hide_summary); | |
868 | printf $rsfh "%5s |", "Total"; | |
869 | printf STDERR "%5s |", "Total" if (! $hide_summary); | |
870 | foreach my $type (@active_types) { | |
871 | printf $rsfh "%5s |", $status_short{$type}; | |
872 | printf STDERR "%5s |", $status_short{$type} if (! $hide_summary); | |
873 | } | |
874 | printf $rsfh "%20s |", "Cycles"; | |
875 | printf STDERR "%20s |", "Cycles" if (! $hide_summary); | |
876 | printf $rsfh "%12s |", "Time"; | |
877 | printf STDERR "%12s |", "Time" if (! $hide_summary); | |
878 | printf $rsfh "%6s |", "C/S"; | |
879 | printf STDERR "%6s |", "C/S" if (! $hide_summary); | |
880 | print $rsfh "\n", '-' x $w, "\n"; | |
881 | print STDERR "\n", '-' x $w, "\n" if (! $hide_summary); | |
882 | ||
883 | ||
884 | # status counts | |
885 | #============== | |
886 | foreach $group (@group_list) { | |
887 | if ($group eq 'ALL') { | |
888 | print $rsfh '-' x $w, "\n"; | |
889 | print STDERR '-' x $w, "\n" if (! $hide_summary); | |
890 | } | |
891 | printf $rsfh "%20.20s:", $group; | |
892 | printf STDERR "%20.20s:", $group if (! $hide_summary); | |
893 | printf $rsfh "%5d |", $group_count{$group}; | |
894 | printf STDERR "%5d |", $group_count{$group} if (! $hide_summary); | |
895 | foreach my $type (@active_types) { | |
896 | printf $rsfh "%5d |", $group_count_stat{$group}->{$type}; | |
897 | printf STDERR "%5d |", $group_count_stat{$group}->{$type} | |
898 | if (! $hide_summary); | |
899 | } | |
900 | printf $rsfh "%20s |", $pass_fail_sec{$group} ? | |
901 | sprintf("%20.2f",$pass_fail_cyc{$group}) : 'N/A' ; | |
902 | if (! $hide_summary) { | |
903 | printf STDERR "%20s |", $pass_fail_sec{$group} ? | |
904 | sprintf("%20.2f",$pass_fail_cyc{$group}) : 'N/A' ; | |
905 | } | |
906 | ||
907 | printf $rsfh "%12s |", $pass_fail_sec{$group} ? | |
908 | sprintf("%12.2f",$pass_fail_sec{$group}) : 'N/A' ; | |
909 | if (! $hide_summary) { | |
910 | printf STDERR "%12s |", $pass_fail_sec{$group} ? | |
911 | sprintf("%12.2f",$pass_fail_sec{$group}) : 'N/A' ; | |
912 | } | |
913 | printf $rsfh "%6s |", $pass_fail_sec{$group} ? | |
914 | sprintf("%6.2f",$pass_fail_cyc{$group}/$pass_fail_sec{$group}) : 'N/A' ; | |
915 | if (! $hide_summary) { | |
916 | printf STDERR "%6s |", $pass_fail_sec{$group} ? | |
917 | sprintf("%6.2f",$pass_fail_cyc{$group}/$pass_fail_sec{$group}) : 'N/A' ; | |
918 | } | |
919 | ||
920 | print $rsfh "\n"; | |
921 | print STDERR "\n" if (! $hide_summary); | |
922 | } | |
923 | ||
924 | print $rsfh '=' x $w, "\n"; | |
925 | print STDERR '=' x $w, "\n" if (! $hide_summary); | |
926 | print $rsfh "\n"; | |
927 | print STDERR "\n" if (! $hide_summary); | |
928 | ||
929 | printf $rsfh "Total Diags : %20d\n", $group_count{ALL}; | |
930 | printf $rsfh "Total Passed : %20d\n", $group_count_stat{ALL}->{'pass'}; | |
931 | printf $rsfh "Total Unknown: %20d\n", $group_count_stat{ALL}->{'unkn'}; | |
932 | printf $rsfh "Total Unfini : %20d\n", $group_count_stat{ALL}->{'unfi'}; | |
933 | printf $rsfh "Total Fail : %20d\n", $group_count_stat{ALL}->{'fail'} + | |
934 | $group_count_stat{ALL}->{'asst'} + | |
935 | $group_count_stat{ALL}->{'perf'} + | |
936 | $group_count_stat{ALL}->{'timo'} + | |
937 | $group_count_stat{ALL}->{'maxc'} ; | |
938 | printf $rsfh "Total Cycles : %20s\n", $pass_fail_sec{ALL} ? | |
939 | sprintf("%20.2f", $pass_fail_cyc{ALL}) : 'N/A'; | |
940 | printf $rsfh "Total Time : %20s\n", $pass_fail_sec{ALL} ? | |
941 | sprintf("%20.2f", $pass_fail_sec{ALL}) : 'N/A'; | |
942 | printf $rsfh "Average C/S : %20s\n", $pass_fail_sec{ALL} ? | |
943 | sprintf("%20.2f",$pass_fail_cyc{ALL}/$pass_fail_sec{ALL}) : 'N/A'; | |
944 | ||
945 | if (!$hide_summary) { | |
946 | printf STDERR "Total Diags : %20d\n", $group_count{ALL}; | |
947 | printf STDERR "Total Passed : %20d\n", $group_count_stat{ALL}->{'pass'}; | |
948 | printf STDERR "Total Unknown: %20d\n", $group_count_stat{ALL}->{'unkn'}; | |
949 | printf STDERR "Total Unfini : %20d\n", $group_count_stat{ALL}->{'unfi'}; | |
950 | printf STDERR "Total Fail : %20d\n", $group_count_stat{ALL}->{'fail'} + | |
951 | $group_count_stat{ALL}->{'asst'} + | |
952 | $group_count_stat{ALL}->{'perf'} + | |
953 | $group_count_stat{ALL}->{'timo'} + | |
954 | $group_count_stat{ALL}->{'maxc'} ; | |
955 | printf STDERR "Total Cycles : %20s\n", $pass_fail_sec{ALL} ? | |
956 | sprintf("%20.2f", $pass_fail_cyc{ALL}) : 'N/A'; | |
957 | printf STDERR "Total Time : %20s\n", $pass_fail_sec{ALL} ? | |
958 | sprintf("%20.2f", $pass_fail_sec{ALL}) : 'N/A'; | |
959 | printf STDERR "Average C/S : %20s\n", $pass_fail_sec{ALL} ? | |
960 | sprintf("%20.2f",$pass_fail_cyc{ALL}/$pass_fail_sec{ALL}) : 'N/A'; | |
961 | } | |
962 | ||
963 | print $rsfh '=' x $w, "\n"; | |
964 | print STDERR '=' x $w, "\n" if (! $hide_summary); | |
965 | print $rsfh "\n"; | |
966 | print STDERR "\n" if (! $hide_summary); | |
967 | ||
968 | ||
969 | ||
970 | ||
971 | # details | |
972 | #======== | |
973 | foreach my $group (@group_list){ | |
974 | print $rsfh $drawline; | |
975 | if($group eq 'ALL'){ | |
976 | print $rsfh "\n\nDetails for ALL not in other groups\n"; | |
977 | } | |
978 | else{ | |
979 | print $rsfh "\n\nDetails for $group\n"; | |
980 | } | |
981 | print $rsfh $drawline; | |
982 | my ($print_header); | |
983 | foreach my $type (@status_types) { | |
984 | next if ($fails_only && $type eq "pass"); | |
985 | $print_header = 0; | |
986 | foreach my $diag (sort keys %stats) { | |
987 | my @diag_name_parts = split ':',$diag; | |
988 | if(($stats{$diag} eq $type) && | |
989 | (((scalar(@diag_name_parts) > $grp_pos_in_name) && ($group eq $diag_name_parts[$grp_pos_in_name])) || | |
990 | ((scalar(@diag_name_parts) <= $grp_pos_in_name) && ($group eq 'ALL'))) | |
991 | ) | |
992 | { | |
993 | if(!$print_header){ | |
994 | print $rsfh "$STATUS_NAME{$type}:\n"; | |
995 | print $rsfh "===================\n"; | |
996 | $print_header = 1; | |
997 | } | |
998 | if(defined($diag) && defined($stat_details{$diag})) { | |
999 | print $rsfh "Rundir: $diag\n"; | |
1000 | print $rsfh join ('',@{$stat_details{$diag}}); | |
1001 | }else{ | |
1002 | print $rsfh "\$stat_details{\$diag} is not defined for diag $diag"; | |
1003 | } | |
1004 | print $rsfh $drawline; | |
1005 | } | |
1006 | } | |
1007 | } | |
1008 | } | |
1009 | ||
1010 | # Added ending status here again.. | |
1011 | ||
1012 | #====================================== | |
1013 | # print summary information | |
1014 | #====================================== | |
1015 | ||
1016 | ||
1017 | $hide_summary = ! $dup_summary || $group_count_stat{'ALL'}->{unfi}; | |
1018 | print STDERR "\b" x 120; | |
1019 | ||
1020 | print $rsfh $drawline; | |
1021 | print STDERR $drawline if (! $hide_summary); | |
1022 | # header | |
1023 | #======= | |
1024 | print $rsfh "\nSummary for $regress_dir\n"; | |
1025 | print STDERR "\nSummary for $regress_dir\n" if (! $hide_summary); | |
1026 | foreach (@relnames) { | |
1027 | print $rsfh "Release : $_\n"; | |
1028 | print STDERR "Release : $_\n" if (! $hide_summary); | |
1029 | } | |
1030 | print $rsfh $drawline; | |
1031 | print STDERR $drawline if (! $hide_summary); | |
1032 | printf $rsfh "%20.20s:", 'Group' ; | |
1033 | printf STDERR "%20.20s:", 'Group' if (! $hide_summary); | |
1034 | printf $rsfh "%5s |", "Total"; | |
1035 | printf STDERR "%5s |", "Total" if (! $hide_summary); | |
1036 | foreach my $type (@active_types) { | |
1037 | printf $rsfh "%5s |", $status_short{$type}; | |
1038 | printf STDERR "%5s |", $status_short{$type} if (! $hide_summary); | |
1039 | } | |
1040 | printf $rsfh "%20s |", "Cycles"; | |
1041 | printf STDERR "%20s |", "Cycles" if (! $hide_summary); | |
1042 | printf $rsfh "%12s |", "Time"; | |
1043 | printf STDERR "%12s |", "Time" if (! $hide_summary); | |
1044 | printf $rsfh "%6s |", "C/S"; | |
1045 | printf STDERR "%6s |", "C/S" if (! $hide_summary); | |
1046 | print $rsfh "\n", '-' x $w, "\n"; | |
1047 | print STDERR "\n", '-' x $w, "\n" if (! $hide_summary); | |
1048 | ||
1049 | ||
1050 | # status counts | |
1051 | #============== | |
1052 | foreach $group (@group_list) { | |
1053 | if ($group eq 'ALL') { | |
1054 | print $rsfh '-' x $w, "\n"; | |
1055 | print STDERR '-' x $w, "\n" if (! $hide_summary); | |
1056 | } | |
1057 | printf $rsfh "%20.20s:", $group; | |
1058 | printf STDERR "%20.20s:", $group if (! $hide_summary); | |
1059 | printf $rsfh "%5d |", $group_count{$group}; | |
1060 | printf STDERR "%5d |", $group_count{$group} if (! $hide_summary); | |
1061 | foreach my $type (@active_types) { | |
1062 | printf $rsfh "%5d |", $group_count_stat{$group}->{$type}; | |
1063 | printf STDERR "%5d |", $group_count_stat{$group}->{$type} | |
1064 | if (! $hide_summary); | |
1065 | } | |
1066 | printf $rsfh "%20s |", $pass_fail_sec{$group} ? | |
1067 | sprintf("%20.2f", $pass_fail_cyc{$group}) : 'N/A' ; | |
1068 | if (! $hide_summary) { | |
1069 | printf STDERR "%20s |", $pass_fail_sec{$group} ? | |
1070 | sprintf("%20.2f", $pass_fail_cyc{$group}) : 'N/A' ; | |
1071 | } | |
1072 | ||
1073 | printf $rsfh "%12s |", $pass_fail_sec{$group} ? | |
1074 | sprintf("%12.2f",$pass_fail_sec{$group}) : 'N/A' ; | |
1075 | if (! $hide_summary) { | |
1076 | printf STDERR "%12s |", $pass_fail_sec{$group} ? | |
1077 | sprintf("%12.2f",$pass_fail_sec{$group}) : 'N/A' ; | |
1078 | } | |
1079 | printf $rsfh "%6s |", $pass_fail_sec{$group} ? | |
1080 | sprintf("%6.2f",$pass_fail_cyc{$group}/$pass_fail_sec{$group}) : 'N/A' ; | |
1081 | if (! $hide_summary) { | |
1082 | printf STDERR "%6s |", $pass_fail_sec{$group} ? | |
1083 | sprintf("%6.2f",$pass_fail_cyc{$group}/$pass_fail_sec{$group}) : 'N/A' ; | |
1084 | } | |
1085 | ||
1086 | print $rsfh "\n"; | |
1087 | print STDERR "\n" if (! $hide_summary); | |
1088 | } | |
1089 | ||
1090 | print $rsfh '=' x $w, "\n"; | |
1091 | print STDERR '=' x $w, "\n" if (! $hide_summary); | |
1092 | print $rsfh "\n"; | |
1093 | print STDERR "\n" if (! $hide_summary); | |
1094 | ||
1095 | printf $rsfh "Total Diags : %20d\n", $group_count{ALL}; | |
1096 | printf $rsfh "Total Passed : %20d\n", $group_count_stat{ALL}->{'pass'}; | |
1097 | printf $rsfh "Total Unknown: %20d\n", $group_count_stat{ALL}->{'unkn'}; | |
1098 | printf $rsfh "Total Unfini : %20d\n", $group_count_stat{ALL}->{'unfi'}; | |
1099 | printf $rsfh "Total Fail : %20d\n", $group_count_stat{ALL}->{'fail'} + | |
1100 | $group_count_stat{ALL}->{'asst'} + | |
1101 | $group_count_stat{ALL}->{'perf'} + | |
1102 | $group_count_stat{ALL}->{'timo'} + | |
1103 | $group_count_stat{ALL}->{'maxc'} ; | |
1104 | printf $rsfh "Total Cycles : %20s\n", $pass_fail_sec{ALL} ? | |
1105 | sprintf("%20.2f", $pass_fail_cyc{ALL}) : 'N/A'; | |
1106 | printf $rsfh "Total Time : %20s\n", $pass_fail_sec{ALL} ? | |
1107 | sprintf("%20.2f", $pass_fail_sec{ALL}) : 'N/A'; | |
1108 | printf $rsfh "Average C/S : %20s\n", $pass_fail_sec{ALL} ? | |
1109 | sprintf("%20.2f",$pass_fail_cyc{ALL}/$pass_fail_sec{ALL}) : 'N/A'; | |
1110 | if (!$hide_summary) { | |
1111 | printf STDERR "Total Diags : %20d\n", $group_count{ALL}; | |
1112 | printf STDERR "Total Passed : %20d\n", $group_count_stat{ALL}->{'pass'}; | |
1113 | printf STDERR "Total Unknown: %20d\n", $group_count_stat{ALL}->{'unkn'}; | |
1114 | printf STDERR "Total Unfini : %20d\n", $group_count_stat{ALL}->{'unfi'}; | |
1115 | printf STDERR "Total Fail : %20d\n", $group_count_stat{ALL}->{'fail'} + | |
1116 | $group_count_stat{ALL}->{'asst'} + | |
1117 | $group_count_stat{ALL}->{'perf'} + | |
1118 | $group_count_stat{ALL}->{'timo'} + | |
1119 | $group_count_stat{ALL}->{'maxc'} ; | |
1120 | printf STDERR "Total Cycles : %20s\n", $pass_fail_sec{ALL} ? | |
1121 | sprintf("%20.2f", $pass_fail_cyc{ALL}) : 'N/A'; | |
1122 | printf STDERR "Total Time : %20s\n", $pass_fail_sec{ALL} ? | |
1123 | sprintf("%20.2f", $pass_fail_sec{ALL}) : 'N/A'; | |
1124 | printf STDERR "Average C/S : %20s\n", $pass_fail_sec{ALL} ? | |
1125 | sprintf("%20.2f",$pass_fail_cyc{ALL}/$pass_fail_sec{ALL}) : 'N/A'; | |
1126 | } | |
1127 | print $rsfh "\n"; | |
1128 | print STDERR "\n" if (! $hide_summary); | |
1129 | print $rsfh '=' x $w, "\n"; | |
1130 | print STDERR '=' x $w, "\n" if (! $hide_summary); | |
1131 | my $ttime = time() - $start_time; | |
1132 | my $hrs = int($ttime/3600); | |
1133 | my $mins = int(($ttime-($hrs*3600))/60); | |
1134 | my $secs = $ttime-($hrs*3600)-($mins*60); | |
1135 | printf $rsfh "Time Waited : %6d hrs, %2d mins, %2d secs\n",$hrs,$mins,$secs; | |
1136 | if (! $hide_summary) { | |
1137 | printf STDERR "Time Waited : %6d hrs, %2d mins, %2d secs\n",$hrs,$mins,$secs; | |
1138 | } | |
1139 | print $rsfh '=' x $w, "\n"; | |
1140 | print STDERR '=' x $w, "\n" if (! $hide_summary); | |
1141 | print $rsfh "\n"; | |
1142 | print STDERR "\n" if (! $hide_summary); | |
1143 | ||
1144 | chdir ($curr_dir) || die " Something went wrong with changing directories\n"; | |
1145 | return ($group_count{'ALL'}, $group_count_stat{'ALL'}->{'pass'}, | |
1146 | $group_count_stat{'ALL'}->{'unfi'}); | |
1147 | ||
1148 | } | |
1149 | #==================================================================== | |
1150 | sub get_status { | |
1151 | my($l)= @_; | |
1152 | my($status)= 'unkn'; | |
1153 | foreach my $st (keys %STATUS_NAME) { | |
1154 | if($l=~ /$STATUS_NAME{$st}/) { | |
1155 | $status= $st; | |
1156 | last; | |
1157 | } | |
1158 | } | |
1159 | $status; | |
1160 | } | |
1161 | #====================================================================== | |
1162 | ||
1163 | sub cleanup { | |
1164 | my($int_type) = shift; | |
1165 | print "\nSomebody sent me a $int_type signal\nQuitting...\n"; | |
1166 | exit 1; | |
1167 | } | |
1168 | #=================================================================== | |
1169 | sub sim_grep | |
1170 | { | |
1171 | my $zin_err=0; my $f=1; | |
1172 | foreach(@{$_[0]}) | |
1173 | { | |
1174 | next if (/Sims Build Cmd|Sims Build Args/); | |
1175 | if (/Vera: Loading main \"cmp._top\"/) { $f=1; } | |
1176 | elsif (/Vera: Loading main \"fc._top\"/) { $f=1000; } | |
1177 | elsif (/(\d+):.*regreport clock period:\s*(\d+).*$/) { | |
1178 | $sim_cyc= $1/($2/$f); | |
1179 | $found_sim_cyc = 1; | |
1180 | } | |
1181 | elsif(/CPU Time:\s+(\d+\.\d+)/ && ($sim eq 'vcs') ) { | |
1182 | $wall_sec= $1; | |
1183 | $found_wall_sec = 1; | |
1184 | } | |
1185 | elsif (/^Time: \d+ (\w)s/ && ($sim eq 'vcs') ) { | |
1186 | if ($1 eq 'f') { $sim_cyc/=1000;} | |
1187 | } | |
1188 | elsif (/ncsim: CPU Usage \- \d+\.\ds system \+ (\d+\.\d)s user \= \d+\.\ds total \(\d+\.\ds\, \d+\.\d\% cpu\)/ && ($sim eq 'ncv') ) { | |
1189 | $wall_sec = $1; | |
1190 | $found_wall_sec = 1; | |
1191 | } | |
1192 | elsif (/0-In ERROR /) { | |
1193 | $zin_err = 1; | |
1194 | if ($sim eq 'vcs') { | |
1195 | $errlines[$errline_num++] = "vcs.log: ". $_; } | |
1196 | elsif ($sim eq 'ncv') { | |
1197 | $errlines[$errline_num++] = "ncsim.log: ". $_; } | |
1198 | } else { | |
1199 | if ($sim eq 'vcs') { | |
1200 | $errlines[$errline_num++] = "vcs.log: ". $_; } | |
1201 | elsif ($sim eq 'ncv') { | |
1202 | $errlines[$errline_num++] = "ncsim.log: ". $_; } | |
1203 | } | |
1204 | } | |
1205 | print "finished sim_grep errlines = $errline_num\n" if($debug); | |
1206 | } | |
1207 | ||
1208 | #=================================================================== | |
1209 | sub sasgrep{ | |
1210 | while(<F>){ | |
1211 | if(/ERROR|SIGDIE|unknown command|pass/){ | |
1212 | $errlines[$errline_num++] = $_;} | |
1213 | } | |
1214 | print "finished sasgrep errlines = $errline_num\n" if($debug); | |
1215 | } | |
1216 | ||
1217 | #=================================================================== | |
1218 | sub tsotoolgrep{ | |
1219 | ||
1220 | print "doing tsotool grep\n"; | |
1221 | my($tsotool_err) = 1; | |
1222 | while(<F>){ | |
1223 | if (/fatal/io){ $tsotool_err = 1; last;} | |
1224 | elsif(/verifying graph invariants.*ok/i){ $tsotool_err = 0;} | |
1225 | } | |
1226 | print "finished tsotool grep\n" if($debug); | |
1227 | ||
1228 | return $tsotool_err; | |
1229 | } | |
1230 | ||
1231 | #=================================================================== | |
1232 | sub diagplgrep{ | |
1233 | print "doing diagpl grep\n" if($debug); | |
1234 | my($diagpl_err) = 0; | |
1235 | @perf_errors = (); | |
1236 | my $print1 = 0; | |
1237 | ||
1238 | while(<F>){ | |
1239 | ||
1240 | if($print1){ | |
1241 | $print1 = 0; | |
1242 | push @perf_errors, ($_); | |
1243 | } | |
1244 | ||
1245 | if(/fail/i){ | |
1246 | $diagpl_err = 1; | |
1247 | $print1 = 1; | |
1248 | push @perf_errors, ($_); | |
1249 | } | |
1250 | elsif(/error/i){ | |
1251 | $diagpl_err = 1; | |
1252 | } | |
1253 | } | |
1254 | return $diagpl_err; | |
1255 | } | |
1256 | ||
1257 | #=================================================================== | |
1258 | sub midasgrep{ | |
1259 | print "doing midas grep\n" if($debug); | |
1260 | while(<F>){ | |
1261 | if(/\berror\b/io){$errlines[$errline_num++] = $_;} | |
1262 | } | |
1263 | } | |
1264 | #=================================================================== | |
1265 | sub dreamloggrep{ | |
1266 | while(<F>){ | |
1267 | if(/ncv_run|vcs_run|no-warn-mismatch/io){ next;} | |
1268 | elsif(/no diag/io){ $errlines[$errline_num++] = $_;} | |
1269 | elsif(/ERROR|SIGDIE/o){ $errlines[$errline_num++] = $_;} | |
1270 | elsif(/getting shaky|pass|reaching max cycles/io){ | |
1271 | $errlines[$errline_num++] = $_;} | |
1272 | ||
1273 | elsif(/missing terminating|no diag found/io){ $errlines[$errline_num++] = $_;} | |
1274 | elsif(/Caught a SIG/io){ $errlines[$errline_num++] = $_;} | |
1275 | elsif($sas_only && /v:0x$good_trap_va/i){ | |
1276 | $errlines[$errline_num++] = $_; | |
1277 | last; | |
1278 | } | |
1279 | elsif($sas_only && /v:0x$hgood_trap_va/i){ | |
1280 | $errlines[$errline_num++] = $_; | |
1281 | last; | |
1282 | } | |
1283 | elsif($sas_only && /v:0x$bad_trap_va/i){ | |
1284 | $errlines[$errline_num++] = $_; | |
1285 | last; | |
1286 | } | |
1287 | elsif($sas_only && /v:0x$hbad_trap_va/i){ | |
1288 | $errlines[$errline_num++] = $_; | |
1289 | last; | |
1290 | } | |
1291 | elsif(/SAS hits MAX CYCLE -> FAIL/){ $errlines[$errline_num++] = $_;} | |
1292 | } | |
1293 | print "finished dreamlog errlines = $errline_num\n" if($debug); | |
1294 | } | |
1295 | ||
1296 | #======================================================================= | |
1297 | sub create_rel_hist { | |
1298 | my $regress_dir = shift(@_); | |
1299 | ||
1300 | # Look for diff_rel*.log files | |
1301 | opendir(REGDIR, $regress_dir); | |
1302 | my @diffiles = grep(/diff_rel.*\.log/, readdir(REGDIR)); | |
1303 | closedir (REGDIR); | |
1304 | foreach (@diffiles) { | |
1305 | next if (-z "$regress_dir/$_"); | |
1306 | chomp(my $fullrelname = `head -1 $regress_dir/$_`); | |
1307 | my ($suffix) = m/diff_rel(.*)\.log/o; | |
1308 | # Pick up local release .. | |
1309 | $fullrelname =~ s/S.*\|\s+(:\/rel\/\S+\s+v=\S+).*/$1/; | |
1310 | $fullrelname =~ s/\[/@/o; $fullrelname =~ s/local\(|\)|\]//go; | |
1311 | if (! grep(/$fullrelname/, @relnames)) {push (@relnames, $fullrelname);} | |
1312 | my ($relname, $ver) = $fullrelname =~ m/@(\w+)\s+v=(\w+:\d+\.\d+)/o; | |
1313 | if (! -e "$regress_dir/hist_rel$suffix.log") { | |
1314 | system("hist_obj -limit 5 :/rel/\@$relname > $regress_dir/hist_rel$suffix.log"); | |
1315 | } | |
1316 | } | |
1317 | } | |
1318 | #======================================================================= | |
1319 | sub cutitup{ | |
1320 | ||
1321 | my @initial_list = (); | |
1322 | if(! -e 'regreport.log'){ | |
1323 | print "Could not cut up regreport.log\n"; | |
1324 | exit 0; | |
1325 | } | |
1326 | else{ | |
1327 | print STDERR "cutitup (cut it up) function activated... \n"; | |
1328 | open(F, " regreport.log"); | |
1329 | my $details_on = 0; | |
1330 | while(<F>){ | |
1331 | if(/Details for ALL not in other groups/){ | |
1332 | next; | |
1333 | }elsif(/Details for\s(\w+)/){ | |
1334 | print STDERR "creating regreport.$1.log\n"; | |
1335 | if(!$details_on){ $details_on = 1; } | |
1336 | else{ close(CGF); } | |
1337 | open(CGF, "> regreport.$1.log") or die " Cannot open regreport.$1.log\n"; | |
1338 | print CGF join ('',@initial_list); | |
1339 | print CGF $_; | |
1340 | } elsif(!$details_on){ | |
1341 | push @initial_list, $_; | |
1342 | } | |
1343 | elsif($details_on){ | |
1344 | print CGF $_; | |
1345 | } | |
1346 | } | |
1347 | if($details_on){ close(CGF); } | |
1348 | close(F); | |
1349 | } | |
1350 | } | |
1351 | #======================================================================= | |
1352 | sub check_logfile | |
1353 | { | |
1354 | $outofmemory = 0; | |
1355 | ||
1356 | foreach(@{$_[0]}) | |
1357 | { | |
1358 | if((/License installation error.\s+\$HOME_0IN does not contain a valid license installation./) || | |
1359 | (/vera_io_printf malloc failed/) || | |
1360 | (/Out of memory/) || | |
1361 | (/Fatal: Out of memory/) || | |
1362 | (/Fatal!\s+not enough memory\s+\[F0\]/)) { # one way that Axis fails | |
1363 | $outofmemory = 1; | |
1364 | $outofmemory_sig = $_; | |
1365 | last; | |
1366 | } | |
1367 | } | |
1368 | close(L); | |
1369 | print "finished check_logfile outofmemory = $outofmemory\n" if($debug); | |
1370 | ||
1371 | } | |
1372 | ||
1373 | #======================================================================= | |
1374 | #======================================================================= | |
1375 | ||
1376 | sub rerun_diag { | |
1377 | my($diag)= @_; | |
1378 | my($rerun_status) = 0; | |
1379 | if(-d 'first_run') { | |
1380 | print STDERR "Not rerunning diag $diag because it has already been rerun once.\n"; | |
1381 | } else { | |
1382 | # check that the diag didn't exceed the amt of memory it requested | |
1383 | my($drmhost,$drmjobnum) = split(" ",$dreamjobid); | |
1384 | my $drmcmd = "drmstat -h $drmhost -c -vvv $drmjobnum"; | |
1385 | open(DRMUSR, "$drmcmd |") || die "Cannot open output of: $drmcmd\n"; | |
1386 | my $freeram = 0; | |
1387 | my $virtsize = 1; | |
1388 | ||
1389 | while (<DRMUSR>) { | |
1390 | if (/freeram\s+(\d+)/) { | |
1391 | $freeram = $1; # in megabytes | |
1392 | } elsif (/Virtual Size:\s+(\d+)K/) { | |
1393 | $virtsize = $1 >> 10;# in kilobytes, convert to megabytes | |
1394 | } | |
1395 | } | |
1396 | close(DRMUSR); | |
1397 | ||
1398 | if( $freeram < $virtsize ) { | |
1399 | printf STDERR "Not rerunning diag $diag because it used more ram (%d meg) than it requested (%d meg)\n", $freeram, $virtsize; | |
1400 | } else { | |
1401 | ||
1402 | print STDERR "\nRerunning diag $diag because it ran out of memory.\n"; | |
1403 | ||
1404 | # make first_run directory and copy log files into it. | |
1405 | my $status = &my_system('/bin/mkdir first_run && /bin/cp *.log first_run/ && /bin/rm -f status.log'); | |
1406 | if ($status) { | |
1407 | print STDERR "ERROR: Problem creating first_run directory or copying/removing log files : status=$status\n"; | |
1408 | } | |
1409 | ||
1410 | # disable the Dream back which has run out of memory, but if it has not been disabled | |
1411 | $drmcmd = "drmback -q $dreamback"; | |
1412 | open(DRMUSR, "$drmcmd |") || die "Cannot open output of: $drmcmd\n"; | |
1413 | my $drmback_is_disabled = 0; | |
1414 | my $lineno = 0; | |
1415 | while (<DRMUSR>) { | |
1416 | $lineno++; | |
1417 | if (($lineno==1) || ($lineno==2)) { | |
1418 | next; | |
1419 | } elsif (/$dreamback/) { | |
1420 | $drmback_is_disabled = 1; | |
1421 | } | |
1422 | } | |
1423 | close(DRMUSR); | |
1424 | if ($drmback_is_disabled == 0 ) { | |
1425 | $drmcmd = "drmdisable -b $dreamback -c 'drmjobid $dreamjobid died due to lack of memory'"; | |
1426 | $status = &my_system("$drmcmd"); | |
1427 | if ($status) { | |
1428 | print STDERR "ERROR: Problem disabling dream back : status=$status\n"; | |
1429 | } | |
1430 | } | |
1431 | ||
1432 | # re-submit the failed diag | |
1433 | $status = &my_system('sims -rerun -overwrite -indrm'); | |
1434 | if ($status) { | |
1435 | print STDERR "ERROR: Problem rerunning job : status=$status\n"; | |
1436 | } | |
1437 | ||
1438 | # send the email | |
1439 | my $mailto = $ENV{USER}; | |
1440 | $mailto .= " email_address"; | |
1441 | ||
1442 | my $subject = "Dream job $dreamjobid died on $dreamback due to lack of memory"; | |
1443 | ||
1444 | my $mailfile = "regreport.mail"; | |
1445 | open( RMAIL, ">$mailfile"); | |
1446 | printf RMAIL "$ENV{USER},\n"; | |
1447 | printf RMAIL "Your dream job $dreamjobid running on $dreamback died due to lack of memory,\n"; | |
1448 | printf RMAIL "with signature: $outofmemory_sig\n"; | |
1449 | printf RMAIL "It was using $virtsize meg, less than the requested $freeram meg of memory.\n"; | |
1450 | printf RMAIL "It was running in directory: $ENV{PWD}\n"; | |
1451 | printf RMAIL "When your regression/regreport completes, the dream back will *not*\n"; | |
1452 | printf RMAIL "be automaticly re-enabled. Please re-enable it yourself with\n"; | |
1453 | printf RMAIL "the command: drmback -n $dreamback\n\n"; | |
1454 | ||
1455 | printf RMAIL "running: /bin/rsh $dreamback '/bin/tail /var/adm/messages; /usr/dist/exe/top -b -o size'\n"; | |
1456 | open( RSH, "/bin/rsh $dreamback '/bin/tail /var/adm/messages; /usr/dist/exe/top -b -o size' |"); | |
1457 | while (<RSH>) { | |
1458 | print RMAIL "$_"; | |
1459 | } | |
1460 | close(RSH); | |
1461 | close(RMAIL); | |
1462 | $status = &my_system ("/bin/mailx -s \"$subject\" $mailto < $mailfile "); | |
1463 | if ($status) { | |
1464 | print STDERR "ERROR: Problem sending email : status=$status\n"; | |
1465 | } | |
1466 | my_system("rm $mailfile"); | |
1467 | ||
1468 | $rerun_status = 1; | |
1469 | } | |
1470 | } | |
1471 | return $rerun_status; # Return the status | |
1472 | } | |
1473 | ||
1474 | ############################################################################### | |
1475 | # | |
1476 | # my_system() - This is a substition function for the built-in Perl | |
1477 | # system() function call. It's needed because Perl's system() | |
1478 | # function masks out SIGINT and SIGQUIT. What that means is | |
1479 | # there is no way to stop the Perl script once it gets | |
1480 | # started because the SIGINT/SIGQUIT are ignored. | |
1481 | # | |
1482 | ############################################################################### | |
1483 | sub my_system { | |
1484 | print STDERR "my_system: cmd = @_\n" if ($debug); | |
1485 | my $pid; | |
1486 | if ($pid = fork) { | |
1487 | waitpid ($pid, 0); | |
1488 | } else { | |
1489 | unless (exec @_) { | |
1490 | print STDERR "ERROR: Unable to execute command $_[0].\n"; | |
1491 | exit 1; | |
1492 | } | |
1493 | } | |
1494 | ||
1495 | return ($? >> 8); # Return the status | |
1496 | } | |
1497 | ||
1498 | #======================================================================= | |
1499 | ||
1500 | 1; | |
1501 | __END__ | |
1502 | # Below is stub documentation for your module. You'd better edit it! | |
1503 | ||
1504 | =head1 NAME | |
1505 | ||
1506 | Regreport | |
1507 | ||
1508 | =head1 SYNOPSIS | |
1509 | ||
1510 | use Regreport; | |
1511 | ||
1512 | Regreport - looks for *.log files in a directory and reports status. | |
1513 | Performs the above in all the directories of a regression | |
1514 | directory. | |
1515 | ||
1516 | =head1 ABSTRACT | |
1517 | ||
1518 | This is a general module for Niagara regression status reporting. | |
1519 | ||
1520 | =head1 DESCRIPTION | |
1521 | ||
1522 | Not updated yet. | |
1523 | ||
1524 | regreport processes the command line | |
1525 | arguments and looks for the following: | |
1526 | <options> [<directory> [<list>]] | |
1527 | ||
1528 | <options>: | |
1529 | -1: print report for the specified or | |
1530 | current-directory diag; | |
1531 | -regress <file>: in regression mode, | |
1532 | writes summary status for finished | |
1533 | diags to <directory>/<file> until all diags | |
1534 | are finished. NOTE: if some diag does not produce | |
1535 | status, regreport will wait forever. | |
1536 | ||
1537 | -ver print version number and exit. | |
1538 | ||
1539 | -sas_only - vcs/ncverilog will not run, only sas will run. | |
1540 | ||
1541 | -[no]cut_name - cuts the last number from sss:sss:ssss:ddd formatted name. | |
1542 | ||
1543 | -regenerate - will regenerate the status.log files in the diag directories. | |
1544 | ||
1545 | <directory> [<list>]: | |
1546 | print report for all diags under <directory>. <list> is | |
1547 | 0 or more of simulation 'group' names, such as 'sparc0', 'cmp', 'cmp1', | |
1548 | 'cmp8', etc. When nothing specified, all groups are included. | |
1549 | ------------------- | |
1550 | chk_single_diag is an exported function which takes a directory name as | |
1551 | an argument and expect a vcs/ncverilog simulation run there. It analyzes the results | |
1552 | and reports. | |
1553 | ------------------- | |
1554 | ||
1555 | =head2 EXPORT | |
1556 | ||
1557 | chk_single_diag and others | |
1558 | ||
1559 | =head1 SEE ALSO | |
1560 | ||
1561 | =head1 AUTHOR | |
1562 | ||
1563 | ||
1564 | =head1 COPYRIGHT AND LICENSE | |
1565 | ||
1566 | ||
1567 | ||
1568 | =cut |