bldsystemtools/commonbldutils/GenResult/FaultsData.pm
changeset 37 be14ecca790f
parent 25 85578ba0aa08
child 38 86a1ec9fa7ba
child 42 f532653c45c0
equal deleted inserted replaced
25:85578ba0aa08 37:be14ecca790f
     1 # Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # Script that returns the no.of errors, Warnings and Advisory notes for a stage.
       
    15 # 
       
    16 #
       
    17 
       
    18 #!/usr/bin/perl -w
       
    19 package FaultsData;
       
    20 #~ use BragStatus;
       
    21 use strict;
       
    22 use Date::Calc;
       
    23 
       
    24 # global log file locations
       
    25 # - to be set by main() function
       
    26 # on module entry
       
    27 our $iGTLogFileLocation;
       
    28 our $iTVLogFileLocation;
       
    29 our $iTVEBSLogFileLocation;
       
    30 our $iBUILDLogFileLocation;
       
    31 our $iCBRLogFileLocation;
       
    32 our $iROMLogFileLocation;
       
    33 our $iCDBLogFileLocation;
       
    34 our $iLinkPathLocation;
       
    35 our $iLogsPublishLocation;
       
    36 our $iGTFileName;
       
    37 our $iTVFileName;
       
    38 our $iTVEBSFileName;
       
    39 our $iBUILDFileName;
       
    40 our $iCBRFileName;
       
    41 our $iROMFileName;
       
    42 our $iCDBFileName;
       
    43 our $iBraggflag = 0;
       
    44 
       
    45 our %iProducts;
       
    46 our %iTests;
       
    47 
       
    48 my $iGTFileFound    = "1";
       
    49 my $iTVFileFound    = "1";
       
    50 my $iTVEBSFileFound = "1";
       
    51 my $iBUILDFileFound = "1";
       
    52 my $iCBRFileFound   = "1";
       
    53 my $iROMFileFound   = "1";
       
    54 my $iCDBFileFound   = "1";
       
    55 
       
    56 
       
    57 # stores the list of stages
       
    58 my $iBuildStages = 'GT|TV|ROM|CBR|CDB|BUILD';
       
    59 
       
    60 sub stageSummary {
       
    61     my ($iDir, $iSnapshot, $iProduct, $iLinkPath, $iStage) = @_;
       
    62     my $temp = "";
       
    63     if($iStage ne "PREBUILD")
       
    64     {
       
    65       ##############extract Errors Now################
       
    66       # set file names, so that they can be accessed globally
       
    67       $iGTFileName    = "GT.summary.html";
       
    68       $iTVFileName    = "TV.summary.html";
       
    69       $iTVEBSFileName = "TV.EBS.summary.html";
       
    70       $iBUILDFileName = "$iSnapshot"."_Symbian_OS_v"."$iProduct".".summary.html";
       
    71       $iCBRFileName   = "$iSnapshot"."_Symbian_OS_v"."$iProduct"."_cbr.summary.html";
       
    72       $iCDBFileName   = "$iSnapshot"."_Symbian_OS_v"."$iProduct"."_cdb.summary.html";
       
    73       $iROMFileName   = "techviewroms"."$iSnapshot"."_Symbian_OS_v"."$iProduct". ".log";
       
    74     
       
    75       $iDir =~  s/[^\\]$/$&\\/; #add trailing backslash, if missing
       
    76       $iLogsPublishLocation  = $iDir;
       
    77       
       
    78 
       
    79       if (-e $iLinkPath) {
       
    80           $iLinkPathLocation = $iLinkPath;
       
    81       } else {
       
    82           # if no link path is specified, then use current directory location
       
    83           #print "WARNING:" .$iLinkPath. " does not exist, linking with relative paths\n";
       
    84           $iLinkPathLocation = $iLogsPublishLocation;
       
    85       }
       
    86       
       
    87       if (-e $iLogsPublishLocation) 
       
    88       {
       
    89           $iGTLogFileLocation      = $iLogsPublishLocation.$iGTFileName;
       
    90           $iTVLogFileLocation      = $iLogsPublishLocation.$iTVFileName;
       
    91           $iTVEBSLogFileLocation   = $iLogsPublishLocation.$iTVEBSFileName;
       
    92           $iBUILDLogFileLocation   = $iLogsPublishLocation.$iBUILDFileName;
       
    93           $iCBRLogFileLocation     = $iLogsPublishLocation.$iCBRFileName;
       
    94           $iROMLogFileLocation     = $iLogsPublishLocation.$iROMFileName;
       
    95           $iCDBLogFileLocation     = $iLogsPublishLocation.$iCDBFileName;
       
    96           
       
    97           my @Components = extractErrors($iStage);
       
    98           if(@Components)
       
    99           {
       
   100             #~ foreach my $t (@Components)
       
   101             #~ {
       
   102               #~ print "FAULTS::@$t[0]\t@$t[1]\t@$t[2]\t@$t[3]\t@$t[4]\t@$t[5]\t@$t[6]\n";
       
   103             #~ }
       
   104             return @Components;
       
   105           }
       
   106           #############Update Log Files Locations######################
       
   107           getLogFileLocation($iStage)
       
   108       }
       
   109       else
       
   110       {
       
   111           print "ERROR: Report not created: $! \n";
       
   112       }
       
   113     }
       
   114 }
       
   115 
       
   116 sub getTime
       
   117 {
       
   118     my ($sec,$min,$hours,$mday,$mon,$year)= localtime();
       
   119     $year += 1900;
       
   120     $mon +=1;
       
   121     my @date = ($year,$mon,$mday,$hours,$min,$sec);
       
   122     my $date = sprintf("%d-%02d-%02dT%02d:%02d:%02d", @date);
       
   123     return ($date);
       
   124 }
       
   125 
       
   126 #------------------------------------------------------------------Functions form GenResult.pm--------------------------------------------------------------
       
   127 ##########################################################################
       
   128 #
       
   129 # Name    :  getGTResults()
       
   130 # Synopsis:  To parse a logfile, and output results
       
   131 #            into a common data format for processing
       
   132 #
       
   133 # Inputs  :  None
       
   134 # Outputs : Array of refs to arrays containing 5 scalars. The structure
       
   135 #           is then used by the  printResultRow() to display
       
   136 #
       
   137 #  1    <array 'container'>
       
   138 #         |
       
   139 #  0-n    <array ref>
       
   140 #            |
       
   141 #            -- <scalar[0]>  component name
       
   142 #            -- <scalar[1]>  number of errors
       
   143 #            -- <scalar[2]>  link to errors
       
   144 #            -- <scalar[3]>  number of warnings
       
   145 #            -- <scalar[4]>  link to warnings
       
   146 #            -- <scalar[5]>  number of advisorynotes
       
   147 #            -- <scalar[6]>  link to advisorynotes
       
   148 #
       
   149 # Note: Links are currently not used, but instead constructed from the
       
   150 #       component name and logfile location. Can be used in future for
       
   151 #       logs located elsewhere etc.
       
   152 ##########################################################################
       
   153 sub getGTResults {
       
   154    
       
   155 
       
   156     my $iComponent;
       
   157     my $iErrors;
       
   158     my $iErrorLink;
       
   159     my $iWarnings;
       
   160     my $iWarningLink;
       
   161 	my $iAdvisoryNotes;
       
   162 	my $iAdvisoryNotesLink;
       
   163     my $iRemarks;
       
   164     my @components;
       
   165   
       
   166     open (GTLOGFILE, $iGTLogFileLocation) || setHandleErrors($_[0]);
       
   167     
       
   168     my @iGTLog = <GTLOGFILE>;
       
   169     foreach (@iGTLog) {
       
   170         
       
   171         if (m/(Component_)(.*)(\s[0-9]{0,2}:[0-9]{0,2}:[0-9]{0,2}\.?[0-9]{0,3})\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)/) 	    {
       
   172                  if (($4 != 0) || ($5 !=0) || ($6 != 0)) {
       
   173                 $iComponent = $2;
       
   174                 $iErrors    = $4;
       
   175                 $iWarnings  = $5;
       
   176                 $iAdvisoryNotes = $6;
       
   177                 $iRemarks   = $7;   # currently we ignore remarks from components.
       
   178                 
       
   179                 # now extract the URL for each warning. At the moment, this is a relative link
       
   180                 # MUST make it absolute, to avoid problems
       
   181                 
       
   182                 my @componentdetails = ($iComponent, $iErrors, $iErrorLink, $iWarnings, $iWarningLink, $iAdvisoryNotes, $iAdvisoryNotesLink);
       
   183                 push @components, \@componentdetails;
       
   184             }
       
   185 			
       
   186 			
       
   187         }
       
   188 				
       
   189         }
       
   190     # return array of refs to arrays
       
   191     return @components;
       
   192 }
       
   193 
       
   194 ##########################################################################
       
   195 #
       
   196 # Name    :  getTVResults()
       
   197 # Synopsis:  To parse a logfile, and output results
       
   198 #            into a common data format for processing
       
   199 #
       
   200 # Inputs  :  None
       
   201 # Outputs : Array of refs to arrays containing 5 scalars. The structure
       
   202 #           is then used by the  printResultRow() to display
       
   203 #
       
   204 #  1    <array 'container'>
       
   205 #         |
       
   206 #  0-n    <array ref>
       
   207 #            |
       
   208 #            -- <scalar[0]>  component name
       
   209 #            -- <scalar[1]>  number of errors
       
   210 #            -- <scalar[2]>  link to errors
       
   211 #            -- <scalar[3]>  number of warnings
       
   212 #            -- <scalar[4]>  link to warnings
       
   213 #            -- <scalar[5]>  number of advisorynotes
       
   214 #            -- <scalar[6]>  link to advisorynotes
       
   215 #
       
   216 # Note: Links are currently not used, but instead constructed from the
       
   217 #       component name and logfile location. Can be used in future for
       
   218 #       logs located elsewhere etc.
       
   219 ##########################################################################
       
   220 sub getTVResults {
       
   221     
       
   222     my $iComponent;
       
   223     my $iErrors;
       
   224     my $iErrorLink;
       
   225     my $iWarnings;
       
   226     my $iWarningLink;
       
   227 	my $iAdvisoryNotes;
       
   228 	my $iAdvisoryNotesLink;
       
   229     my $iRemarks;
       
   230     
       
   231     my @components;
       
   232     open (TVLOGFILE, $iTVLogFileLocation) || setHandleErrors($_[0]);
       
   233 
       
   234     my @iTVLog = <TVLOGFILE>;
       
   235     
       
   236     foreach (@iTVLog) {
       
   237         
       
   238         if (m/(Component_)(.*)(\s[0-9]{0,2}:[0-9]{0,2}:[0-9]{0,2}\.?[0-9]{0,3})\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)/) {
       
   239              
       
   240             if (($4 != 0) || ($5 !=0) || ($6 != 0)) {
       
   241                 
       
   242                 $iComponent = $2;
       
   243                 $iErrors    = $4;
       
   244                 $iWarnings  = $5;
       
   245                 $iAdvisoryNotes = $6;
       
   246                 $iRemarks   = $7;   # currently we ignore remarks from components.
       
   247                 
       
   248                 # now extract the URL for each warning. At the moment, this is a relative link
       
   249                 # MUST make it absolute, to avoid problems
       
   250                 
       
   251                 my @componentdetails = ($iComponent, $iErrors, $iErrorLink, $iWarnings, $iWarningLink, $iAdvisoryNotes, $iAdvisoryNotesLink);
       
   252                 push @components, \@componentdetails;
       
   253             }
       
   254         }
       
   255     }
       
   256     
       
   257     open (TVEBSLOGFILE, $iTVEBSLogFileLocation) || setHandleErrors($_[0]);
       
   258     my @iTVEBSLog = <TVEBSLOGFILE>;
       
   259      foreach (@iTVEBSLog) {
       
   260         
       
   261         if (m/(Component_)(.*)(\s[0-9]{0,2}:[0-9]{0,2}:[0-9]{0,2}\.?[0-9]{0,3})\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)/) {
       
   262              
       
   263             if (($4 != 0) || ($5 !=0) || ($6 != 0)) {
       
   264                 
       
   265                 $iComponent = $2;
       
   266                 $iErrors    = $4;
       
   267                 $iWarnings  = $5;
       
   268                 $iAdvisoryNotes = $6;
       
   269                 $iRemarks   = $7;   # currently we ignore remarks from components.
       
   270                 
       
   271                 # now extract the URL for each warning. At the moment, this is a relative link
       
   272                 # MUST make it absolute, to avoid problems
       
   273                 
       
   274                 my @componentdetails = ($iComponent, $iErrors, $iErrorLink, $iWarnings, $iWarningLink, $iAdvisoryNotes, $iAdvisoryNotesLink);
       
   275                 push @components, \@componentdetails;
       
   276             }
       
   277         }
       
   278     }
       
   279     
       
   280     # return array of refs to arrays
       
   281     return @components;
       
   282 }
       
   283 
       
   284 
       
   285 ##########################################################################
       
   286 #
       
   287 # Name    :  getBUILDResults()
       
   288 # Synopsis:  To parse a logfile, and output results
       
   289 #            into a common data format for processing
       
   290 #
       
   291 # Inputs  :  None
       
   292 # Outputs : Array of refs to arrays containing 5 scalars. The structure
       
   293 #           is then used by the  printResultRow() to display
       
   294 #
       
   295 #  1    <array 'container'>
       
   296 #         |
       
   297 #  0-n    <array ref>
       
   298 #            |
       
   299 #            -- <scalar[0]>  component name
       
   300 #            -- <scalar[1]>  number of errors
       
   301 #            -- <scalar[2]>  link to errors
       
   302 #            -- <scalar[3]>  number of warnings
       
   303 #            -- <scalar[4]>  link to warnings
       
   304 #            -- <scalar[5]>  number of advisorynotes
       
   305 #            -- <scalar[6]>  link to advisorynotes
       
   306 #
       
   307 # Note: Links are currently not used, but instead constructed from the
       
   308 #       component name and logfile location. Can be used in future for
       
   309 #       logs located elsewhere etc.
       
   310 ##########################################################################
       
   311 sub getBUILDResults {
       
   312     
       
   313     my $iComponent;
       
   314     my $iErrors;
       
   315     my $iErrorLink;
       
   316     my $iWarnings;
       
   317     my $iWarningLink;
       
   318 	my $iAdvisoryNotes;
       
   319 	my $iAdvisoryNotesLink;
       
   320     my $iRemarks;
       
   321     
       
   322     my @components;
       
   323     open (BUILDLOGFILE, $iBUILDLogFileLocation) ||setHandleErrors($_[0]);
       
   324     my @iBUILDLog = <BUILDLOGFILE>;
       
   325     
       
   326     foreach (@iBUILDLog) {
       
   327         
       
   328         if (m/(Component_)(.*)(\s[0-9]{0,2}:[0-9]{0,2}:[0-9]{0,2}\.?[0-9]{0,3}?)\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)/) {
       
   329              
       
   330             if (($4 != 0) || ($5 !=0) || ($6 != 0)) {
       
   331                 
       
   332                 $iComponent = $2;
       
   333                 $iErrors    = $4;
       
   334                 $iWarnings  = $5;
       
   335                 $iAdvisoryNotes = $6;
       
   336                 $iRemarks   = $7;   # currently we ignore remarks from components.
       
   337                                # now extract the URL for each warning. At the moment, this is a relative link
       
   338                 # MUST make it absolute, to avoid problems
       
   339                 
       
   340                 my @componentdetails = ($iComponent, $iErrors, $iErrorLink, $iWarnings, $iWarningLink, $iAdvisoryNotes, $iAdvisoryNotesLink);
       
   341                 push @components, \@componentdetails;
       
   342             }
       
   343         }
       
   344     }
       
   345     
       
   346     # return array of refs to arrays
       
   347     return @components;
       
   348 }
       
   349 
       
   350 ##########################################################################
       
   351 #
       
   352 # Name    :  getCBRResults()
       
   353 # Synopsis:  To parse a logfile, and output results
       
   354 #            into a common data format for processing
       
   355 #
       
   356 # Inputs  :  None
       
   357 # Outputs : Array of refs to arrays containing 5 scalars. The structure
       
   358 #           is then used by the  printResultRow() to display
       
   359 #
       
   360 #  1    <array 'container'>
       
   361 #         |
       
   362 #  0-n    <array ref>
       
   363 #            |
       
   364 #            -- <scalar[0]>  component name
       
   365 #            -- <scalar[1]>  number of errors
       
   366 #            -- <scalar[2]>  link to errors
       
   367 #            -- <scalar[3]>  number of warnings
       
   368 #            -- <scalar[4]>  link to warnings
       
   369 #            -- <scalar[5]>  number of advisorynotes
       
   370 #            -- <scalar[6]>  link to advisorynotes
       
   371 #
       
   372 # Note: Links are currently not used, but instead constructed from the
       
   373 #       component name and logfile location. Can be used in future for
       
   374 #       logs located elsewhere etc.
       
   375 ##########################################################################
       
   376 sub getCBRResults {
       
   377     
       
   378     my $iComponent;
       
   379     my $iErrors;
       
   380     my $iErrorLink;
       
   381     my $iWarnings;
       
   382     my $iWarningLink;
       
   383 	my $iAdvisoryNotes;
       
   384 	my $iAdvisoryNotesLink;
       
   385     my $iRemarks;
       
   386     
       
   387     my @components;
       
   388     open (CBRLOGFILE, $iCBRLogFileLocation) || setHandleErrors($_[0]);
       
   389 
       
   390     my @iCBRLog = <CBRLOGFILE>;
       
   391     
       
   392     foreach (@iCBRLog) {
       
   393         
       
   394         if (m/(Overall_Total\s)([0-9]{0,2}:[0-9]{0,2}:[0-9]{0,2})\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)/) {
       
   395             if (($3 != 0) || ($4 !=0) || ($5 != 0)) {
       
   396                                 
       
   397                 $iComponent = "Total";
       
   398                 $iErrors    = $3;
       
   399                 $iWarnings  = $4;
       
   400                 $iAdvisoryNotes = $5;
       
   401                 $iRemarks   = $6;   # currently we ignore remarks from components.
       
   402                 
       
   403                 # now extract the URL for each warning. At the moment, this is a relative link
       
   404                 # MUST make it absolute, to avoid problems
       
   405                 
       
   406                 my @componentdetails = ($iComponent, $iErrors, $iErrorLink, $iWarnings, $iWarningLink, $iAdvisoryNotes, $iAdvisoryNotesLink);
       
   407                 push @components, \@componentdetails;
       
   408             }
       
   409         }
       
   410     }
       
   411     
       
   412     # return array of refs to arrays
       
   413     return @components;
       
   414 }
       
   415 
       
   416 ##########################################################################
       
   417 #
       
   418 # Name    :  getROMResults()
       
   419 # Synopsis:  To parse a text logfile, and output results
       
   420 #            into a common data format for processing
       
   421 #
       
   422 # Inputs  :  None
       
   423 # Outputs : Array of refs to arrays containing 5 scalars. The structure
       
   424 #           is then used by the  printResultRow() to display
       
   425 #
       
   426 #  1    <array 'container'>
       
   427 #         |
       
   428 #  0-n    <array ref>
       
   429 #            |
       
   430 #            -- <scalar[0]>  component name
       
   431 #            -- <scalar[1]>  number of errors
       
   432 #            -- <scalar[2]>  link to errors
       
   433 #            -- <scalar[3]>  number of warnings
       
   434 #            -- <scalar[4]>  link to warnings
       
   435 #            -- <scalar[5]>  number of advisorynotes
       
   436 #            -- <scalar[6]>  link to advisorynotes
       
   437 #
       
   438 ##########################################################################
       
   439 sub getROMResults {
       
   440     
       
   441     my $iComponent;
       
   442     my $iErrors;
       
   443     my $iErrorLink;
       
   444     my $iWarnings;
       
   445     my $iWarningLink;
       
   446 	my $iAdvisoryNotes;
       
   447 	my $iAdvisoryNotesLink;
       
   448     my $iRemarks;
       
   449     my @components;
       
   450     open (ROMLOGFILE, $iROMLogFileLocation) || setHandleErrors($_[0]);
       
   451 
       
   452     my @iROMLog = <ROMLOGFILE>;
       
   453     
       
   454     # special kludge to deal with multi-line errors from ROMBUILD!
       
   455     #
       
   456     my $i = 0;
       
   457     my @iSingleLineErrors;
       
   458     
       
   459     foreach (@iROMLog) {
       
   460         ++$i;
       
   461         if ((m/ERROR: Can't build dependence graph for/) ||
       
   462             (m/ERROR: Can't resolve dll ref table for/)) {
       
   463         
       
   464             # read 4 lines for the single error
       
   465             my $iErr = $_ . $iROMLog[$i].$iROMLog[$i+1].$iROMLog[$i+2].$iROMLog[$i+3];
       
   466             $iErr =~ s/\t|\n/ /g; # replace tabs and newlines with a space
       
   467 
       
   468             # remove multi-line error, so that we dont process it twice
       
   469             $iROMLog[$i-1] = "";
       
   470             $iROMLog[$i]   = "";
       
   471             $iROMLog[$i+1] = "";
       
   472             $iROMLog[$i+2] = "";
       
   473             $iROMLog[$i+3] = "";
       
   474             
       
   475             push @iSingleLineErrors, $iErr;
       
   476         }
       
   477     }
       
   478     
       
   479     # now merge two arrays before processing
       
   480     push (@iROMLog, @iSingleLineErrors);
       
   481     
       
   482     
       
   483     # identify unique lines in log, as errors
       
   484     # are repeated for each ROM built
       
   485     my %iSeenLines = ();
       
   486     foreach my $iUniqueItem (@iROMLog) {
       
   487         $iSeenLines{$iUniqueItem}++;
       
   488     }
       
   489     my @iUniqueLogList = keys %iSeenLines;
       
   490     
       
   491     foreach (@iUniqueLogList) {
       
   492 	if((m/WARNING: Sorting Rom Exception Table/) ||
       
   493            (m/WARNING: DEMAND PAGING ROMS ARE A PROTOTYPE FEATURE ONLY/)) {
       
   494            my @componentdetails = ($_, "", $iErrorLink, "", $iWarningLink);
       
   495            push @components, \@componentdetails;
       
   496         } elsif ((m/Missing/) || (m/Invalid Resource name/) || (m/warning:/) || (m/WARNING:/)) {
       
   497            my @componentdetails = ($_, "", $iErrorLink, "1", $iWarningLink);
       
   498                         
       
   499             push @components, \@componentdetails;   
       
   500         }
       
   501         
       
   502         if ((m/ERROR: Can't build dependence graph for/) ||
       
   503             (m/ERROR: Can't resolve dll ref table for/) ||
       
   504             (m/cpp failed/i) ||
       
   505             (m/cannot find oby file/i) ||
       
   506             (m/no such file or directory/i)) {
       
   507             
       
   508             my @componentdetails = ($_, "1", $iErrorLink, "", $iWarningLink);
       
   509             push @components, \@componentdetails;   
       
   510         } elsif (m/ERROR/) {
       
   511             my @componentdetails = ($_, "1", $iErrorLink, "", $iWarningLink);
       
   512             push @components, \@componentdetails;   
       
   513         }
       
   514     }   
       
   515     
       
   516     return @components;
       
   517 }
       
   518 
       
   519 ##########################################################################
       
   520 #
       
   521 # Name    :  getCDBResults()
       
   522 # Synopsis:  To parse a logfile, and output results
       
   523 #            into a common data format for processing
       
   524 #
       
   525 # Inputs  :  None
       
   526 # Outputs : Array of refs to arrays containing 5 scalars. The structure
       
   527 #           is then used by the  printResultRow() to display
       
   528 #
       
   529 #  1    <array 'container'>
       
   530 #         |
       
   531 #  0-n    <array ref>
       
   532 #            |
       
   533 #            -- <scalar[0]>  component name
       
   534 #            -- <scalar[1]>  number of errors
       
   535 #            -- <scalar[2]>  link to errors
       
   536 #            -- <scalar[3]>  number of warnings
       
   537 #            -- <scalar[4]>  link to warnings
       
   538 #            -- <scalar[5]>  number of advisorynotes
       
   539 #            -- <scalar[6]>  link to advisorynotes
       
   540 #
       
   541 # Note: Links are currently not used, but instead constructed from the
       
   542 #       component name and logfile location. Can be used in future for
       
   543 #       logs located elsewhere etc.
       
   544 ##########################################################################
       
   545 sub getCDBResults {
       
   546    
       
   547 
       
   548     my $iComponent;
       
   549     my $iErrors;
       
   550     my $iErrorLink;
       
   551     my $iWarnings;
       
   552     my $iWarningLink;
       
   553 	my $iAdvisoryNotes;
       
   554 	my $iAdvisoryNotesLink;
       
   555     my $iRemarks;
       
   556     my @components;
       
   557     open (CDBLOGFILE, $iCDBLogFileLocation) || warn "RIZ::$!:$iCDBLogFileLocation\n";
       
   558     
       
   559     my @iCDBLog = <CDBLOGFILE>;
       
   560     
       
   561     foreach (@iCDBLog) {
       
   562         
       
   563         if (m/(Component_)(.*)(\s[0-9]{0,2}:[0-9]{0,2}:[0-9]{0,2}\.?[0-9]{0,3})\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*)/) 	    {
       
   564             
       
   565             if (($4 != 0) || ($5 !=0) || ($6 != 0)) {
       
   566                 
       
   567                 $iComponent = $2;
       
   568                 $iErrors    = $4;
       
   569                 $iWarnings  = $5;
       
   570 				$iAdvisoryNotes = $6;
       
   571                 $iRemarks   = $7;   # currently we ignore remarks from components.
       
   572                 
       
   573                 # now extract the URL for each warning. At the moment, this is a relative link
       
   574                 # MUST make it absolute, to avoid problems
       
   575                 my @componentdetails = ($iComponent, $iErrors, $iErrorLink, $iWarnings, $iAdvisoryNotes, $iAdvisoryNotesLink);
       
   576                 push @components, \@componentdetails;
       
   577 				
       
   578             }
       
   579 			}			
       
   580         
       
   581 		if (m/(Component_)(.*)(\s[0-9]{0,2}:[0-9]{0,2}:[0-9]{0,2}\s([0-9]*)\s([0-9]*)\s([0-9]*)\s([0-9]*))/) 	    {
       
   582 			if (($4 != 0) || ($5 !=0) || ($6 != 0)) {
       
   583                 
       
   584                 $iComponent = $2;
       
   585                 $iErrors    = $4;
       
   586                 $iWarnings  = $5;
       
   587 				$iAdvisoryNotes = $6;
       
   588                 $iRemarks   = $7;   
       
   589                 # This  has been added to check the errors which have time in '0:00:00' format.
       
   590                 # now extract the URL for each warning. At the moment, this is a relative link
       
   591                 # MUST make it absolute, to avoid problems
       
   592                 my @componentdetails = ($iComponent, $iErrors, $iErrorLink, $iWarnings, $iAdvisoryNotes, $iAdvisoryNotesLink);
       
   593                 push @components, \@componentdetails;
       
   594 				
       
   595             }
       
   596 			}
       
   597 		}
       
   598 	
       
   599 	# return array of refs to arrays
       
   600     return @components;
       
   601 }
       
   602 
       
   603 ##########################################################################
       
   604 #
       
   605 # Name    :  getResults()
       
   606 # Synopsis:  Factory like function to return an associated data structure
       
   607 #            depending on the type requested. i.e. GT, TV etc.
       
   608 #  
       
   609 # Inputs  :  Scalar containing the log/type required
       
   610 # Outputs :  The output of getXXXResults() functions.
       
   611 #
       
   612 #  1    <array 'container'>
       
   613 #         |
       
   614 #  0-n    <array ref>
       
   615 #            |
       
   616 #            -- <scalar[0]>  component name
       
   617 #            -- <scalar[1]>  number of errors
       
   618 #            -- <scalar[2]>  link to errors
       
   619 #            -- <scalar[3]>  number of warnings
       
   620 #            -- <scalar[4]>  link to warnings
       
   621 #            -- <scalar[5]>  number of advisorynotes
       
   622 #            -- <scalar[6]>  link to advisorynotes
       
   623 #
       
   624 ##########################################################################
       
   625 #~ sub getResults {
       
   626 sub extractErrors {
       
   627     
       
   628     if ($_[0] eq "GT") {
       
   629         return getGTResults($_[0]); }
       
   630     
       
   631     if ($_[0] eq "TV") {
       
   632         return getTVResults($_[0]); }
       
   633     
       
   634     if ($_[0] eq "BUILD") {
       
   635         return getBUILDResults($_[0]); }
       
   636     
       
   637     if ($_[0] eq "CBR") {
       
   638         return getCBRResults($_[0]); }
       
   639    
       
   640     if ($_[0] eq "ROM") {
       
   641         return getROMResults($_[0]); }
       
   642     
       
   643     if ($_[0] eq "CDB") {
       
   644         return getCDBResults($_[0]); }
       
   645 
       
   646 }
       
   647 
       
   648 ##########################################################################
       
   649 #
       
   650 # Name    :  getLogFileLocation()
       
   651 # Synopsis:  Accessor like function, to return the expected log file
       
   652 #            location that is initialised in GenResult::main()
       
   653 #
       
   654 # Inputs  :  Scalar containing the log/type required
       
   655 # Outputs : Scalar containing the log location
       
   656 #
       
   657 ##########################################################################
       
   658 sub getLogFileLocation {
       
   659     
       
   660     if ($_[0] eq "GT") {
       
   661         return setBrowserFriendlyLinks($iLinkPathLocation.$iGTFileName); }
       
   662     
       
   663     if ($_[0] eq "TV") {
       
   664         if($_->[0]=~ /systemtest/i) {
       
   665               return setBrowserFriendlyLinks($iLinkPathLocation.$iTVEBSFileName);}
       
   666         else {   
       
   667         return setBrowserFriendlyLinks($iLinkPathLocation.$iTVFileName); }
       
   668         }
       
   669     
       
   670     if ($_[0] eq "BUILD") {
       
   671         return setBrowserFriendlyLinks($iLinkPathLocation.$iBUILDFileName); }
       
   672     
       
   673     if ($_[0] eq "CBR") {
       
   674         return setBrowserFriendlyLinks($iLinkPathLocation.$iCBRFileName); }
       
   675         
       
   676     if ($_[0] eq "ROM") {
       
   677         return $iLinkPathLocation.$iROMFileName; }
       
   678 
       
   679     if ($_[0] eq "CDB") {
       
   680         return setBrowserFriendlyLinks($iLinkPathLocation.$iCDBFileName); }
       
   681 		
       
   682 }
       
   683 
       
   684 ##########################################################################
       
   685 #
       
   686 # Name    :  getAnchorType()
       
   687 # Synopsis:  Helper function, to return the HTML scanlog anchor for
       
   688 #            a desired log type.
       
   689 #
       
   690 # Inputs  :  Scalar containing the log/type required
       
   691 # Outputs :  Scalar containing the HTML anchor 
       
   692 #
       
   693 ##########################################################################
       
   694 sub getAnchorType {
       
   695     
       
   696     if ($_[0] eq "GT") {
       
   697         return "Component"; }
       
   698     
       
   699     if ($_[0] eq "TV") {
       
   700         return "Component"; }
       
   701     
       
   702     if ($_[0] eq "BUILD") {
       
   703         return "Component"; }
       
   704     
       
   705     if ($_[0] eq "CBR") {
       
   706         return "Overall"; }
       
   707         
       
   708     if ($_[0] eq "CDB") {
       
   709         return "Overall"; }
       
   710 
       
   711 }
       
   712 
       
   713 ##########################################################################
       
   714 #
       
   715 # Name    :  isHTMLFile()
       
   716 # Synopsis:  Identifies which log files should be processed as HTML
       
   717 #
       
   718 # Inputs  :  Scalar containing the log/type required
       
   719 # Outputs :  "1" if the requested log is HTML
       
   720 #
       
   721 ##########################################################################
       
   722 sub isHTMLFile {
       
   723     
       
   724     if ($_[0] eq "GT" || $_[0] eq "TV" || $_[0] eq "BUILD" || $_[0] eq "CBR"  || $_[0] eq "CDB") {
       
   725         return "1"; }
       
   726 }
       
   727 
       
   728 ##########################################################################
       
   729 #
       
   730 # Name    :  isTestBuild()
       
   731 # Synopsis:  Identifies if this report is being generated for a test build
       
   732 #
       
   733 # Inputs  :  Global scalar for linkto location
       
   734 # Outputs :  "1" if the build is being published as a testbuild. This will
       
   735 #            obviously fail if testbuilds are not correctly published to
       
   736 #            \\builds01\devbuilds\test_builds
       
   737 #
       
   738 ##########################################################################
       
   739 sub isTestBuild {
       
   740     
       
   741     # somehow, determine if this is a TBuild
       
   742     if (uc($iLinkPathLocation) =~ m/TEST_BUILD/) {
       
   743         return "1";
       
   744     }
       
   745     
       
   746     return "0";
       
   747 }
       
   748 
       
   749 
       
   750 ##########################################################################
       
   751 #
       
   752 # Name    :  setBrowserFriendlyLinks()
       
   753 # Synopsis:  Re-formats UNC path to file, with a Opera/Fire-Fox friendly
       
   754 #            version. Lotus Notes may cause problems though.
       
   755 # Inputs  :  UNC Path scalar
       
   756 # Outputs :  Scalar
       
   757 #
       
   758 ##########################################################################
       
   759 sub setBrowserFriendlyLinks {
       
   760     my ($iOldLink) = @_;
       
   761     
       
   762     $iOldLink =~ s/\\/\//g;  # swap backslashes to fwd slashes
       
   763     return "file:///".$iOldLink;
       
   764 }
       
   765 
       
   766 ##########################################################################
       
   767 #
       
   768 # Name    :  setBrowserFriendlyLinksForIN()
       
   769 # Purpose:  Generate Links for Bangalore Site
       
   770 # Inputs  :  UNC Path scalar
       
   771 # Outputs :  Scalar
       
   772 #
       
   773 ##########################################################################
       
   774 
       
   775 sub setBrowserFriendlyLinksForIN($ ) {
       
   776     my ($iOldLinkIN) = shift;
       
   777     
       
   778     $iOldLinkIN =~ s/\\/\//g;  # swap backslashes to fwd slashes
       
   779     $iOldLinkIN = "file:///".$iOldLinkIN ;
       
   780     $iOldLinkIN =~ s/builds01/builds04/ ;  # Generate Bangalore Log Location
       
   781     return $iOldLinkIN;
       
   782 }
       
   783 
       
   784 ##########################################################################
       
   785 #
       
   786 # Name    :  setBrowserFriendlyLinksForCN()
       
   787 # Purpose:  Generate Links for Beijing Site
       
   788 # Inputs  :  UNC Path scalar
       
   789 # Outputs :  Scalar
       
   790 #
       
   791 ##########################################################################
       
   792 
       
   793 sub setBrowserFriendlyLinksForCN($ ) {
       
   794     my ($iOldLinkCN) = shift;
       
   795     
       
   796     $iOldLinkCN =~ s/\\/\//g;  # swap backslashes to fwd slashes
       
   797     $iOldLinkCN = "file:///".$iOldLinkCN ;
       
   798     $iOldLinkCN =~ s/builds01/builds05/ ;  # Generate Beijing Log Location
       
   799     return $iOldLinkCN;
       
   800 }
       
   801 
       
   802 
       
   803 # helper function to notify of any missing logs
       
   804 sub setHandleErrors {
       
   805     
       
   806     # set global filenotfound to "0"
       
   807     
       
   808     if ($_[0] eq "GT") {
       
   809         $iGTFileFound    = "0"; }
       
   810     
       
   811     if ($_[0] eq "TV") {
       
   812         $iTVFileFound    = "0"; }
       
   813     
       
   814     if ($_[0] eq "TV") {
       
   815         $iTVEBSFileFound = "0"; }
       
   816     
       
   817     if ($_[0] eq "BUILD") {
       
   818         $iBUILDFileFound = "0"; }
       
   819     
       
   820     if ($_[0] eq "CBR") {
       
   821         $iCBRFileFound   = "0"; }
       
   822         
       
   823     if ($_[0] eq "ROM") {
       
   824         $iROMFileFound   = "0"; }
       
   825     
       
   826     if ($_[0] eq "CDB") {
       
   827         $iCDBFileFound   = "0"; }
       
   828 
       
   829 }
       
   830 
       
   831 # accessor function to return the flag for this type
       
   832 sub getHandleErrors {
       
   833     
       
   834     if ($_[0] eq "GT") {
       
   835         return $iGTFileFound; }
       
   836     
       
   837     if ($_[0] eq "TV") {
       
   838         return $iTVFileFound; }
       
   839     
       
   840     if ($_[0] eq "TV") {
       
   841         return $iTVEBSFileFound; }
       
   842         
       
   843     if ($_[0] eq "BUILD") {
       
   844         return $iBUILDFileFound; }
       
   845     
       
   846     if ($_[0] eq "CBR") {
       
   847         return $iCBRFileFound; }
       
   848     
       
   849     if ($_[0] eq "ROM") {
       
   850         return $iROMFileFound; }
       
   851 
       
   852     if ($_[0] eq "CDB") {
       
   853         return $iCDBFileFound; }
       
   854 }
       
   855 
       
   856 1;