From fd1bb17259b5c4ed249ec97827ac9ed24748ad5a Mon Sep 17 00:00:00 2001 From: Brian Horton Date: Mon, 9 Apr 2012 14:57:23 -0500 Subject: Cause build to fail if duplicate reason code / module id is found Change the scanforsrcs.pl script to die w/ an error if a duplicate reason code is found within a module. In addition, correct makefile so that the script is run all the time, so that errors are caught before jenkins. And more script to code_pass instead of gen_pass so that all files it needs are created before it's run. Change-Id: Idd5fe546207920e9561091bbed1817efc04f2ebc RTC: 38731 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/869 Tested-by: Jenkins Server Reviewed-by: Terry J. Opie Reviewed-by: A. Patrick Williams III --- src/usr/errl/parser/makefile | 8 ++++---- src/usr/errl/parser/scanforsrcs.pl | 15 +++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/usr/errl/parser') diff --git a/src/usr/errl/parser/makefile b/src/usr/errl/parser/makefile index dd9f132bf..e0307c629 100644 --- a/src/usr/errl/parser/makefile +++ b/src/usr/errl/parser/makefile @@ -49,9 +49,9 @@ CFLAGS:=-g -O0 -I $(ROOTPATH)/src/include/usr -I ${GENDIR} all: gen_pass code_pass -gen_pass: mkdirs ${SRCPARSE_HEADER_TARGET} ${GENDIR}/comps.C +gen_pass: mkdirs ${GENDIR}/comps.C -code_pass: ${IMGDIR}/errlparser +code_pass: ${SRCPARSE_HEADER_TARGET} ${IMGDIR}/errlparser # errlparserbase and errlusrparser are plugins stuff, not errlparser. # OBJFILES = ${OBJDIR}/errlparserbase.o ${OBJDIR}/errlusrparser.o @@ -63,7 +63,7 @@ mkdirs: mkdir -p ${GENDIR} # Parse for error log tags in the Hostboot code, and generate hostBootSrcParse.H -${SRCPARSE_HEADER_TARGET} : +${SRCPARSE_HEADER_TARGET} :: ./scanforsrcs.pl -b ${ROOTPATH} -o ${GENDIR} ${GENDIR}/comps.C: ${ROOTPATH}/src/include/usr/hbotcompid.H @@ -72,7 +72,7 @@ ${GENDIR}/comps.C: ${ROOTPATH}/src/include/usr/hbotcompid.H sed 's/const compId_t \([A-Z0-9]*\)_COMP_ID[ =\t]*\(0[xX][0-9a-fA-F]*\).*/{ "\1", \2 },/' \ > $@ -${OBJDIR}/errlparser.o: errlparser.C ${ROOTPATH}/src/include/usr/errl/hberrltypes.H ${GENDIR}/comps.C +${OBJDIR}/errlparser.o: errlparser.C ${ROOTPATH}/src/include/usr/errl/hberrltypes.H ${GENDIR}/comps.C ${SRCPARSE_HEADER_TARGET} $(CC) -c $(CFLAGS) -o $@ $< diff --git a/src/usr/errl/parser/scanforsrcs.pl b/src/usr/errl/parser/scanforsrcs.pl index 6c187a848..4f6cb73da 100755 --- a/src/usr/errl/parser/scanforsrcs.pl +++ b/src/usr/errl/parser/scanforsrcs.pl @@ -238,11 +238,17 @@ $fh = openHeaderFile(); # Start writing the main header file that will be included by errlparser.C startMainHeaderFile( $fh ); +my $found_dup = 0; + # Write each case statement for printing foreach my $key (sort(keys(%Comps))) { writePrintStatement( $fh, $key, \@{$Comps{$key}} ); } +if($found_dup > 0) +{ + die( "ERROR! Duplicate hash found!\n" ); +} # Finish writing the header finishMainHeaderFile( $fh ); @@ -672,19 +678,20 @@ sub writePrintStatement debugMsg( "Reason Code: $reasonCode" ); # If we've got a duplicate Module Id/Reason code go, on to the - # next one. We can't have duplicates, and its been asked that - # we don't have compile errors because of it. + # next one. We can't have duplicates, so if we do we set found_dup + # so that we can die after this loop if( "$modId.$reasonCode" eq $caseHash{ $compName } ) { debugMsg( "Hash exists, skip subsequent." ); - # Print a warning message + # Print a error message print "\n#################################################################\n"; - print " WARNING - Duplicate hash found for:\n"; + print " ERROR - Duplicate hash found for:\n"; print " component $compName\n"; print " module id $modId\n"; print " reason code $reasonCode\n"; print "#################################################################\n"; + $found_dup = 1; next; } else -- cgit v1.2.3