Revision: 16458
          http://sourceforge.net/p/edk2/code/16458
Author:   yingke
Date:     2014-12-01 08:22:07 +0000 (Mon, 01 Dec 2014)
Log Message:
-----------
Enhance error handling for external tool.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/Python/GenFds/GuidSection.py

Modified: trunk/edk2/BaseTools/Source/Python/GenFds/GuidSection.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/GenFds/GuidSection.py    2014-12-01 
08:17:51 UTC (rev 16457)
+++ trunk/edk2/BaseTools/Source/Python/GenFds/GuidSection.py    2014-12-01 
08:22:07 UTC (rev 16458)
@@ -159,6 +159,13 @@
                        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 @@
                 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 @@
 
         ToolDefinition = 
ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary
         ToolPathTmp = None
+        ToolOption = None
         for ToolDef in ToolDefinition.items():
             if self.NameGuid == ToolDef[1]:
                 KeyList = ToolDef[0].split('_')


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to