|
From: <qh...@us...> - 2010-02-02 10:06:21
|
Revision: 1835
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=1835&view=rev
Author: qhuang8
Date: 2010-02-02 10:05:50 +0000 (Tue, 02 Feb 2010)
Log Message:
-----------
Enhance ECC tools:
1. Add same Include File Name checkpoint
2. Add -w option support to specify workspace environment
3. Add -e option support to specify an exception file list
4. Print out the error file, line number, error info in the command output in the standard format to be captured by some editor when ECC tool is run as the plug in.
Modified Paths:
--------------
trunk/BaseTools/Source/Python/Ecc/Check.py
trunk/BaseTools/Source/Python/Ecc/Ecc.py
trunk/BaseTools/Source/Python/Table/TableReport.py
Modified: trunk/BaseTools/Source/Python/Ecc/Check.py
===================================================================
--- trunk/BaseTools/Source/Python/Ecc/Check.py 2010-02-02 08:42:48 UTC (rev 1834)
+++ trunk/BaseTools/Source/Python/Ecc/Check.py 2010-02-02 10:05:50 UTC (rev 1835)
@@ -1,7 +1,7 @@
## @file
# This file is used to define checkpoints used by ECC tool
#
-# Copyright (c) 2008, Intel Corporation
+# Copyright (c) 2008 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -298,7 +298,8 @@
for Key in RecordDict:
if len(RecordDict[Key]) > 1:
for Item in RecordDict[Key]:
- EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg = "The file name for '%s' is duplicate" % (Item[1]), BelongsToTable = 'File', BelongsToItem = Item[0])
+ if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Item[1]):
+ EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg = "The file name for [%s] is duplicate" % (Item[1]), BelongsToTable = 'File', BelongsToItem = Item[0])
# Check whether all include file contents is guarded by a #ifndef statement.
def IncludeFileCheckIfndef(self):
@@ -738,17 +739,17 @@
self.NamingConventionCheckDefineStatement(FileTable)
self.NamingConventionCheckTypedefStatement(FileTable)
self.NamingConventionCheckIfndefStatement(FileTable)
- self.NamingConventionCheckVariableName(FileTable)
+ self.NamingConventionCheckVariableName(FileTable)
self.NamingConventionCheckSingleCharacterVariable(FileTable)
self.NamingConventionCheckPathName()
self.NamingConventionCheckFunctionName()
-
+
# Check whether only capital letters are used for #define declarations
def NamingConventionCheckDefineStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckDefineStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #define statement ...")
-
+
SqlCommand = """select ID, Value from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_MACRO_DEFINE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
@@ -763,7 +764,7 @@
def NamingConventionCheckTypedefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #typedef statement ...")
-
+
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_TYPEDEF)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
@@ -783,7 +784,7 @@
def NamingConventionCheckIfndefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #ifndef statement ...")
-
+
SqlCommand = """select ID, Value from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
@@ -818,7 +819,7 @@
if EccGlobalData.gConfig.NamingConventionCheckVariableName == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of variable name ...")
Pattern = re.compile(r'^[A-Zgm]+\S*[a-z]\S*$')
-
+
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_VARIABLE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
@@ -846,7 +847,7 @@
def NamingConventionCheckSingleCharacterVariable(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckSingleCharacterVariable == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of single character variable name ...")
-
+
SqlCommand = """select ID, Name from %s where Model = %s""" %(FileTable, MODEL_IDENTIFIER_VARIABLE)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
for Record in RecordSet:
Modified: trunk/BaseTools/Source/Python/Ecc/Ecc.py
===================================================================
--- trunk/BaseTools/Source/Python/Ecc/Ecc.py 2010-02-02 08:42:48 UTC (rev 1834)
+++ trunk/BaseTools/Source/Python/Ecc/Ecc.py 2010-02-02 10:05:50 UTC (rev 1835)
@@ -1,7 +1,7 @@
## @file
# This file is used to be the main entrance of ECC tool
#
-# Copyright (c) 2009, Intel Corporation
+# Copyright (c) 2009 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -225,6 +225,9 @@
EdkLogger.quiet("Loading ECC configuration ... done")
(Options, Target) = self.EccOptionParser()
+ if Options.Workspace:
+ os.environ["WORKSPACE"] = Options.Workspace
+
# Check workspace envirnoment
if "WORKSPACE" not in os.environ:
EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
@@ -244,6 +247,8 @@
self.OutputFile = Options.OutputFile
if Options.ReportFile != None:
self.ReportFile = Options.ReportFile
+ if Options.ExceptionFile != None:
+ self.ExceptionFile = Options.ExceptionFile
if Options.Target != None:
if not os.path.isdir(Options.Target):
EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target)
@@ -294,6 +299,8 @@
help="Specify the name of an output file, if and only if one filename was specified.")
Parser.add_option("-r", "--reportfile filename", action="store", type="string", dest="ReportFile",
help="Specify the name of an report file, if and only if one filename was specified.")
+ Parser.add_option("-e", "--exceptionfile filename", action="store", type="string", dest="ExceptionFile",
+ help="Specify the name of an exception file, if and only if one filename was specified.")
Parser.add_option("-m", "--metadata", action="store_true", type=None, help="Only scan meta-data files information if this option is specified.")
Parser.add_option("-s", "--sourcecode", action="store_true", type=None, help="Only scan source code files information if this option is specified.")
Parser.add_option("-k", "--keepdatabase", action="store_true", type=None, help="The existing Ecc database will not be cleaned except report information if this option is specified.")
@@ -307,6 +314,7 @@
"including library instances selected, final dependency expression, "\
"and warning messages, etc.")
Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
+ Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.")
(Opt, Args)=Parser.parse_args()
Modified: trunk/BaseTools/Source/Python/Table/TableReport.py
===================================================================
--- trunk/BaseTools/Source/Python/Table/TableReport.py 2010-02-02 08:42:48 UTC (rev 1834)
+++ trunk/BaseTools/Source/Python/Table/TableReport.py 2010-02-02 10:05:50 UTC (rev 1835)
@@ -1,7 +1,7 @@
## @file
# This file is used to create/update/query/erase table for ECC reports
#
-# Copyright (c) 2008, Intel Corporation
+# Copyright (c) 2008 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -114,7 +114,8 @@
NewRecord = self.Exec(SqlCommand)
if NewRecord != []:
File.write("""%s,%s,"%s",%s,%s,"%s"\n""" % (Index, ErrorID, EccToolError.gEccErrorMessage[ErrorID], NewRecord[0][1], NewRecord[0][0], OtherMsg))
-
+ EdkLogger.quiet("%s(%s): [%s]%s %s" % (NewRecord[0][1], NewRecord[0][0], ErrorID, EccToolError.gEccErrorMessage[ErrorID], OtherMsg))
+
File.close()
except IOError:
NewFilename = 'Report_' + time.strftime("%Y%m%d_%H%M%S.csv", time.localtime())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|