common/tools/raptor/RaptorRecipe.pm
changeset 764 d00048f1b036
parent 738 53abda826a9f
child 776 789c8f6f86af
equal deleted inserted replaced
763:5fdd5e70280d 764:d00048f1b036
    57 my $CATEGORY_RECIPEFAILURE_ARMCC_CONTROLLINGEXPRESSIONISCONSTANT = 'armcc_controlling_expression_is_constant';
    57 my $CATEGORY_RECIPEFAILURE_ARMCC_CONTROLLINGEXPRESSIONISCONSTANT = 'armcc_controlling_expression_is_constant';
    58 my $CATEGORY_RECIPEFAILURE_ARMCC_INTERNALFAULT = 'armcc_internal_fault';
    58 my $CATEGORY_RECIPEFAILURE_ARMCC_INTERNALFAULT = 'armcc_internal_fault';
    59 my $CATEGORY_RECIPEFAILURE_ARMCC_GENERICWARNINGSERRORS = 'armcc_generic_warnings_errors';
    59 my $CATEGORY_RECIPEFAILURE_ARMCC_GENERICWARNINGSERRORS = 'armcc_generic_warnings_errors';
    60 my $CATEGORY_RECIPEFAILURE_ELF2E32_SYMBOLMISSINGFROMELFFILE = 'elf2e32_symbol_missing_from_elf_file';
    60 my $CATEGORY_RECIPEFAILURE_ELF2E32_SYMBOLMISSINGFROMELFFILE = 'elf2e32_symbol_missing_from_elf_file';
    61 
    61 
       
    62 my $mmp_with_issues = {};
       
    63 
    62 
    64 
    63 sub process
    65 sub process
    64 {
    66 {
    65 	my ($text, $component, $phase, $recipe, $file, $line) = @_;
    67 	my ($text, $config, $component, $mmp, $phase, $recipe, $file, $line) = @_;
    66 	
    68 	
    67 	my $category = $CATEGORY_RECIPEFAILURE;
    69 	my $category = $CATEGORY_RECIPEFAILURE;
    68 	my $severity = '';
    70 	my $severity = '';
    69 	my $subcategory = '';
    71 	my $subcategory = '';
    70 	
    72 	
       
    73 	# if mmp is defined assign severity=MAJOR for the first failure
       
    74 	# then severity=MINOR to all other (for each logfile)
       
    75 	if ($mmp and defined $mmp_with_issues->{$::current_log_file}->{$mmp})
       
    76 	{
       
    77 		$severity = $RaptorCommon::SEVERITY_MINOR;
       
    78 	}
       
    79 	elsif ($mmp)
       
    80 	{
       
    81 		$mmp_with_issues->{$::current_log_file} = {} if (!defined $mmp_with_issues->{$::current_log_file});
       
    82 		$mmp_with_issues->{$::current_log_file}->{$mmp} = 1;
       
    83 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
    84 	}
       
    85 	else
       
    86 	{
       
    87 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
    88 	}
       
    89 	
       
    90 	
    71 	if ($text =~ m,Error:  #5: cannot open source input file .*: No such file or directory,)
    91 	if ($text =~ m,Error:  #5: cannot open source input file .*: No such file or directory,)
    72 	{
    92 	{
    73 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
    74 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_CANNOTOPENSOURCEINPUTFILE;
    93 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_CANNOTOPENSOURCEINPUTFILE;
    75 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
    94 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
    76 	}
    95 	}
    77 	elsif ($text =~ m,Fatal error: L6002U: Could not open file .*: No such file or directory,)
    96 	elsif ($text =~ m,Fatal error: L6002U: Could not open file .*: No such file or directory,)
    78 	{
    97 	{
    79 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
    80 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMLINK_COULDNOTOPENFILE;
    98 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMLINK_COULDNOTOPENFILE;
    81 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
    99 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
    82 	}
   100 	}
    83 	elsif ($text =~ m,elf2e32 : Error: E1001: Could not open file : .*.,)
   101 	elsif ($text =~ m,elf2e32 : Error: E1001: Could not open file : .*.,)
    84 	{
   102 	{
    85 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
    86 		my $subcategory = $CATEGORY_RECIPEFAILURE_ELF2E32_COULDNOTOPENFILE;
   103 		my $subcategory = $CATEGORY_RECIPEFAILURE_ELF2E32_COULDNOTOPENFILE;
    87 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
   104 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
    88 	}
   105 	}
    89 	elsif ($text =~ m,elf2e32 : Error: E1036: Symbol .* Missing from ELF File,)
   106 	elsif ($text =~ m,elf2e32 : Error: E1036: Symbol .* Missing from ELF File,)
    90 	{
   107 	{
    91 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
    92 		my $subcategory = $CATEGORY_RECIPEFAILURE_ELF2E32_SYMBOLMISSINGFROMELFFILE;
   108 		my $subcategory = $CATEGORY_RECIPEFAILURE_ELF2E32_SYMBOLMISSINGFROMELFFILE;
    93 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
   109 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
    94 	}
   110 	}
    95 	elsif ($text =~ m,Error: L6833E: File '.*' does not exist,)
   111 	elsif ($text =~ m,Error: L6833E: File '.*' does not exist,)
    96 	{
   112 	{
    97 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
    98 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMAR_FILEDOESNOTEXIST;
   113 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMAR_FILEDOESNOTEXIST;
    99 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
   114 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   100 	}
   115 	}
   101 	elsif ($text =~ m,: Warning:  #236-D: controlling expression is constant,)
   116 	elsif ($text =~ m,: Warning:  #236-D: controlling expression is constant,)
   102 	{
   117 	{
   103 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
   104 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_CONTROLLINGEXPRESSIONISCONSTANT;
   118 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_CONTROLLINGEXPRESSIONISCONSTANT;
   105 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
   119 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   106 	}
   120 	}
   107 	elsif ($text =~ m,/armcc.exe , and $text =~ m,Internal fault: ,)
   121 	elsif ($text =~ m,/armcc.exe , and $text =~ m,Internal fault: ,)
   108 	{
   122 	{
   109 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
   110 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_INTERNALFAULT;
   123 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_INTERNALFAULT;
   111 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
   124 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   112 	}
   125 	}
   113 	# the following captures generic armcc error/warnings, not captured by regexps above
   126 	# the following captures generic armcc error/warnings, not captured by regexps above
   114 	elsif ($text =~ m,/armcc.exe , and $text =~ m,: \d+ warnings\, \d+ errors$,)
   127 	elsif ($text =~ m,/armcc.exe , and $text =~ m,: \d+ warnings\, \d+ errors$,)
   115 	{
   128 	{
   116 		$severity = $RaptorCommon::SEVERITY_MAJOR;
       
   117 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_GENERICWARNINGSERRORS;
   129 		my $subcategory = $CATEGORY_RECIPEFAILURE_ARMCC_GENERICWARNINGSERRORS;
   118 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
   130 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   119 	}
   131 	}
   120 	else # log everything by default
   132 	else # log everything by default
   121 	{
   133 	{
   122 		RaptorCommon::dump_fault($category, $subcategory, $severity, $component, $phase, $recipe, $file, $line);
   134 		RaptorCommon::dump_fault($category, $subcategory, $severity, $config, $component, $mmp, $phase, $recipe, $file, $line);
   123 	}
   135 	}
   124 }
   136 }
   125 
   137 
   126 sub on_start_buildlog
   138 sub on_start_buildlog
   127 {
   139 {
   197 		else
   209 		else
   198 		{
   210 		{
   199 			print "WARNING: can't understand bldinf attribute of recipe: $recipe_info->{bldinf}. Won't dump to failed recipes file.\n";
   211 			print "WARNING: can't understand bldinf attribute of recipe: $recipe_info->{bldinf}. Won't dump to failed recipes file.\n";
   200 		}
   212 		}
   201 		
   213 		
       
   214 		# also normalize mmp path if this exists
       
   215 		if ($recipe_info->{mmp})
       
   216 		{
       
   217 			$recipe_info->{mmp} = lc($recipe_info->{mmp});
       
   218 			$recipe_info->{mmp} =~ s,^[A-Za-z]:,,;
       
   219 			$recipe_info->{mmp} =~ s,[\\],/,g;
       
   220 		}
       
   221 		
   202 		$characters =~ s,^[\r\n]*,,;
   222 		$characters =~ s,^[\r\n]*,,;
   203 		$characters =~ s,[\r\n]*$,,;
   223 		$characters =~ s,[\r\n]*$,,;
   204 		
   224 		
   205 		if ($package)
   225 		if ($package)
   206 		{
   226 		{
   207 			$filename = "$::basedir/$package.txt";
   227 			$filename = "$::raptorbitsdir/$package.txt";
   208 			if (!-f$filename)
   228 			if (!-f$filename)
   209 			{
   229 			{
   210 				print "Writing recipe file $filename\n";
   230 				print "Writing recipe file $filename\n";
   211 				open(FILE, ">$filename");
   231 				open(FILE, ">$filename");
   212 				close(FILE);
   232 				close(FILE);
   229 			print FILE "---failure_item_$failure_item\---\n";
   249 			print FILE "---failure_item_$failure_item\---\n";
   230 			print FILE "$characters\n\n";
   250 			print FILE "$characters\n\n";
   231 			close(FILE);
   251 			close(FILE);
   232 		}
   252 		}
   233 		
   253 		
   234 		process($characters, $recipe_info->{bldinf}, $recipe_info->{phase}, $recipe_info->{name}, "$package.txt", $failure_item);
   254 		process($characters, $recipe_info->{config}, $recipe_info->{bldinf}, $recipe_info->{mmp}, $recipe_info->{phase}, $recipe_info->{name}, "$package.txt", $failure_item);
   235 	}
   255 	}
   236 
   256 
   237 	$characters = '';
   257 	$characters = '';
   238 }
   258 }
   239 
   259