BaseTools: Update Tests/TestTools.py to allow it to work on Windows
On Windows, executables have a '.exe' suffix which needs to be added for them to be found in a path. Also, files need to be explicitly opened as binary. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
This commit is contained in:
committed by
mergify[bot]
parent
b9bbb4ae93
commit
77f75c7fb8
@@ -109,6 +109,8 @@ class BaseToolsTest(unittest.TestCase):
|
|||||||
else: logFile = None
|
else: logFile = None
|
||||||
|
|
||||||
if toolName is None: toolName = self.toolName
|
if toolName is None: toolName = self.toolName
|
||||||
|
if sys.platform == "win32":
|
||||||
|
toolName += ".exe"
|
||||||
bin = self.FindToolBin(toolName)
|
bin = self.FindToolBin(toolName)
|
||||||
if logFile is not None:
|
if logFile is not None:
|
||||||
logFile = open(os.path.join(self.testDir, logFile), 'w')
|
logFile = open(os.path.join(self.testDir, logFile), 'w')
|
||||||
@@ -135,7 +137,7 @@ class BaseToolsTest(unittest.TestCase):
|
|||||||
return open(os.path.join(self.testDir, fileName), mode)
|
return open(os.path.join(self.testDir, fileName), mode)
|
||||||
|
|
||||||
def ReadTmpFile(self, fileName):
|
def ReadTmpFile(self, fileName):
|
||||||
f = open(self.GetTmpFilePath(fileName), 'r')
|
f = open(self.GetTmpFilePath(fileName), 'rb')
|
||||||
data = f.read()
|
data = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
return data
|
return data
|
||||||
|
Reference in New Issue
Block a user