## @file\r
-# This file contain unit test for Test [Binary] section part of InfParser \r
+# This file contain unit test for Test [Binary] section part of InfParser\r
#\r
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
-# This program and the accompanying materials are licensed and made available \r
-# under the terms and conditions of the BSD License which accompanies this \r
-# distribution. The full text of the license may be found at \r
+# This program and the accompanying materials are licensed and made available\r
+# under the terms and conditions of the BSD License which accompanies this\r
+# distribution. The full text of the license may be found at\r
# http://opensource.org/licenses/bsd-license.php\r
#\r
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
"""\r
\r
#\r
-# Have 3 elements, Type | FileName | Target \r
+# Have 3 elements, Type | FileName | Target\r
# Target with MACRO defined in [Define] section\r
#\r
SectionStringsCommonItem4 = \\r
"""\r
\r
#\r
-# Have 3 elements, Type | FileName | Target \r
+# Have 3 elements, Type | FileName | Target\r
# FileName with MACRO defined in [Binary] section\r
#\r
SectionStringsCommonItem5 = \\r
#-------------start of VER type binary item test input------------------------#\r
\r
#\r
-# Has 1 element, error format \r
+# Has 1 element, error format\r
#\r
SectionStringsVerItem1 = \\r
"""\r
"""\r
\r
#\r
-# Has 1 element, error format \r
+# Has 1 element, error format\r
#\r
SectionStringsUiItem4 = \\r
"""\r
continue\r
SectionString.append((Line, LineNo, ''))\r
LineNo = LineNo + 1\r
- \r
+\r
return SectionString\r
\r
def PrepareTest(String):\r
#\r
FileName = os.path.normpath(os.path.realpath(ValueList[1].strip()))\r
try:\r
- TempFile = open (FileName, "w") \r
+ TempFile = open (FileName, "w")\r
TempFile.close()\r
except:\r
print("File Create Error")\r
CurrentLine.SetLineString(Item[0])\r
CurrentLine.SetLineNo(Item[1])\r
InfLineCommentObject = InfLineCommentObject()\r
- \r
+\r
ItemList.append((ValueList, InfLineCommentObject, CurrentLine))\r
- \r
+\r
return ItemList\r
\r
if __name__ == '__main__':\r
Logger.Initialize()\r
- \r
+\r
InfBinariesInstance = InfBinariesObject()\r
ArchList = ['COMMON']\r
Global.gINF_MODULE_DIR = os.getcwd()\r
- \r
+\r
AllPassedFlag = True\r
- \r
+\r
#\r
# For All Ui test\r
#\r
- UiStringList = [ \r
+ UiStringList = [\r
SectionStringsUiItem1,\r
SectionStringsUiItem2,\r
SectionStringsUiItem3,\r
SectionStringsUiItem5,\r
SectionStringsUiItem6,\r
SectionStringsUiItem7,\r
- SectionStringsUiItem8 \r
+ SectionStringsUiItem8\r
]\r
- \r
- for Item in UiStringList: \r
+\r
+ for Item in UiStringList:\r
Ui = PrepareTest(Item)\r
if Item == SectionStringsUiItem4 or Item == SectionStringsUiItem5:\r
try:\r
except Logger.FatalError:\r
pass\r
else:\r
- try: \r
+ try:\r
InfBinariesInstance.SetBinary(Ui = Ui, ArchList = ArchList)\r
except:\r
- AllPassedFlag = False \r
- \r
+ AllPassedFlag = False\r
+\r
#\r
# For All Ver Test\r
#\r
SectionStringsVerItem6,\r
SectionStringsVerItem7\r
]\r
- for Item in VerStringList: \r
+ for Item in VerStringList:\r
Ver = PrepareTest(Item)\r
if Item == SectionStringsVerItem1 or \\r
Item == SectionStringsVerItem2:\r
- \r
+\r
try:\r
InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)\r
except:\r
pass\r
- \r
+\r
else:\r
try:\r
InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)\r
except:\r
- AllPassedFlag = False \r
- \r
+ AllPassedFlag = False\r
+\r
#\r
# For All Common Test\r
- # \r
+ #\r
CommonStringList = [\r
SectionStringsCommonItem1,\r
SectionStringsCommonItem2,\r
SectionStringsCommonItem10\r
]\r
\r
- for Item in CommonStringList: \r
+ for Item in CommonStringList:\r
CommonBin = PrepareTest(Item)\r
if Item == SectionStringsCommonItem10 or \\r
Item == SectionStringsCommonItem1:\r
- \r
+\r
try:\r
InfBinariesInstance.SetBinary(CommonBinary = CommonBin, ArchList = ArchList)\r
except:\r
pass\r
- \r
+\r
else:\r
try:\r
InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)\r
except:\r
print("Test Failed!")\r
AllPassedFlag = False\r
- \r
+\r
if AllPassedFlag :\r
print('All tests passed...')\r
else:\r