X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FUPT%2FUnitTest%2FInfBinarySectionTest.py;h=12e3045f3753ba2faead154c0b18376660e1bd3e;hb=2e351cbe8e190271b3716284fc1076551d005472;hp=f3b43ee0bc2754949a725057c948f2b12b053a89;hpb=4234283c3acb8c35014acc1546621fbc2621b095;p=mirror_edk2.git
diff --git a/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py b/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py
index f3b43ee0bc..12e3045f37 100644
--- a/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py
+++ b/BaseTools/Source/Python/UPT/UnitTest/InfBinarySectionTest.py
@@ -1,16 +1,11 @@
## @file
-# This file contain unit test for Test [Binary] section part of InfParser
+# This file contain unit test for Test [Binary] section part of InfParser
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2018, 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
-# http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+from __future__ import print_function
import os
#import Object.Parser.InfObject as InfObject
from Object.Parser.InfCommonObject import CurrentLine
@@ -48,7 +43,7 @@ GUID | Test/Test.guid | DEBUG
"""
#
-# Have 3 elements, Type | FileName | Target
+# Have 3 elements, Type | FileName | Target
# Target with MACRO defined in [Define] section
#
SectionStringsCommonItem4 = \
@@ -57,7 +52,7 @@ GUID | Test/Test.guid | $(TARGET)
"""
#
-# Have 3 elements, Type | FileName | Target
+# Have 3 elements, Type | FileName | Target
# FileName with MACRO defined in [Binary] section
#
SectionStringsCommonItem5 = \
@@ -114,7 +109,7 @@ GUID | Test/Test.guid | DEBUG | MSFT | TEST | TRUE | OVERFLOW
#-------------start of VER type binary item test input------------------------#
#
-# Has 1 element, error format
+# Has 1 element, error format
#
SectionStringsVerItem1 = \
"""
@@ -198,7 +193,7 @@ UI | Test/Test2.ui | * | FALSE
"""
#
-# Has 1 element, error format
+# Has 1 element, error format
#
SectionStringsUiItem4 = \
"""
@@ -252,7 +247,7 @@ def StringToSectionString(String):
continue
SectionString.append((Line, LineNo, ''))
LineNo = LineNo + 1
-
+
return SectionString
def PrepareTest(String):
@@ -268,33 +263,33 @@ def PrepareTest(String):
#
FileName = os.path.normpath(os.path.realpath(ValueList[1].strip()))
try:
- TempFile = open (FileName, "w")
+ TempFile = open (FileName, "w")
TempFile.close()
except:
- print "File Create Error"
+ print("File Create Error")
CurrentLine = CurrentLine()
CurrentLine.SetFileName("Test")
CurrentLine.SetLineString(Item[0])
CurrentLine.SetLineNo(Item[1])
InfLineCommentObject = InfLineCommentObject()
-
+
ItemList.append((ValueList, InfLineCommentObject, CurrentLine))
-
+
return ItemList
if __name__ == '__main__':
Logger.Initialize()
-
+
InfBinariesInstance = InfBinariesObject()
ArchList = ['COMMON']
Global.gINF_MODULE_DIR = os.getcwd()
-
+
AllPassedFlag = True
-
+
#
# For All Ui test
#
- UiStringList = [
+ UiStringList = [
SectionStringsUiItem1,
SectionStringsUiItem2,
SectionStringsUiItem3,
@@ -302,10 +297,10 @@ if __name__ == '__main__':
SectionStringsUiItem5,
SectionStringsUiItem6,
SectionStringsUiItem7,
- SectionStringsUiItem8
+ SectionStringsUiItem8
]
-
- for Item in UiStringList:
+
+ for Item in UiStringList:
Ui = PrepareTest(Item)
if Item == SectionStringsUiItem4 or Item == SectionStringsUiItem5:
try:
@@ -313,11 +308,11 @@ if __name__ == '__main__':
except Logger.FatalError:
pass
else:
- try:
+ try:
InfBinariesInstance.SetBinary(Ui = Ui, ArchList = ArchList)
except:
- AllPassedFlag = False
-
+ AllPassedFlag = False
+
#
# For All Ver Test
#
@@ -330,25 +325,25 @@ if __name__ == '__main__':
SectionStringsVerItem6,
SectionStringsVerItem7
]
- for Item in VerStringList:
+ for Item in VerStringList:
Ver = PrepareTest(Item)
if Item == SectionStringsVerItem1 or \
Item == SectionStringsVerItem2:
-
+
try:
InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)
except:
pass
-
+
else:
try:
InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)
except:
- AllPassedFlag = False
-
+ AllPassedFlag = False
+
#
# For All Common Test
- #
+ #
CommonStringList = [
SectionStringsCommonItem1,
SectionStringsCommonItem2,
@@ -362,25 +357,25 @@ if __name__ == '__main__':
SectionStringsCommonItem10
]
- for Item in CommonStringList:
+ for Item in CommonStringList:
CommonBin = PrepareTest(Item)
if Item == SectionStringsCommonItem10 or \
Item == SectionStringsCommonItem1:
-
+
try:
InfBinariesInstance.SetBinary(CommonBinary = CommonBin, ArchList = ArchList)
except:
pass
-
+
else:
try:
InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)
except:
- print "Test Failed!"
+ print("Test Failed!")
AllPassedFlag = False
-
+
if AllPassedFlag :
- print 'All tests passed...'
+ print('All tests passed...')
else:
- print 'Some unit test failed!'
+ print('Some unit test failed!')