summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorYingke Liu <yingke.d.liu@intel.com>2014-12-01 08:22:07 +0000
committeryingke <yingke@Edk2>2014-12-01 08:22:07 +0000
commitedafa0bbe423d5d6129f4d18de176dfd73b6cfcf (patch)
treeac3d1f60b082e0bd034f6c43ec386b88e7155f5b /BaseTools
parentc1589a2c24abbc026120e3b045f9045448f64b2d (diff)
downloadedk2-edafa0bbe423d5d6129f4d18de176dfd73b6cfcf.tar.gz
edk2-edafa0bbe423d5d6129f4d18de176dfd73b6cfcf.tar.bz2
edk2-edafa0bbe423d5d6129f4d18de176dfd73b6cfcf.zip
Enhance error handling for external tool.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yingke Liu <yingke.d.liu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16458 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/GenFds/GuidSection.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py
index 0e5bb3b270..006cf0f216 100644
--- a/BaseTools/Source/Python/GenFds/GuidSection.py
+++ b/BaseTools/Source/Python/GenFds/GuidSection.py
@@ -159,6 +159,13 @@ class GuidSection(GuidSectionClassObject) :
SecNum + \
'.tmp'
TempFile = os.path.normpath(TempFile)
+ #
+ # Remove temp file if its time stamp is older than dummy file
+ # Just in case the external tool fails at this time but succeeded before
+ # Error should be reported if the external tool does not generate a new output based on new input
+ #
+ if os.path.exists(TempFile) and os.path.exists(DummyFile) and os.path.getmtime(TempFile) < os.path.getmtime(DummyFile):
+ os.remove(TempFile)
FirstCall = False
CmdOption = '-e'
@@ -183,6 +190,12 @@ class GuidSection(GuidSectionClassObject) :
FirstCall = False
ReturnValue[0] = 0
GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, CmdOption)
+ #
+ # There is external tool which does not follow standard rule which return nonzero if tool fails
+ # The output file has to be checked
+ #
+ if not os.path.exists(TempFile):
+ EdkLogger.error("GenFds", COMMAND_FAILURE, 'Fail to call %s, no output file was generated' % ExternalTool)
FileHandleIn = open(DummyFile,'rb')
FileHandleIn.seek(0,2)
@@ -257,6 +270,7 @@ class GuidSection(GuidSectionClassObject) :
ToolDefinition = ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary
ToolPathTmp = None
+ ToolOption = None
for ToolDef in ToolDefinition.items():
if self.NameGuid == ToolDef[1]:
KeyList = ToolDef[0].split('_')