diff options
author | Rebecca Cran <rebecca@bsdio.com> | 2023-05-06 05:01:49 -0600 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-05-11 02:14:12 +0000 |
commit | 77f75c7fb8388a1429374419c823d70fc4cf3881 (patch) | |
tree | cdfc017cd4a9965824d58be190e16554239e5bfb | |
parent | b9bbb4ae9308a98ada574e435e0987a274e7e7a2 (diff) | |
download | edk2-77f75c7fb8388a1429374419c823d70fc4cf3881.tar.gz |
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>
-rw-r--r-- | BaseTools/Tests/TestTools.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/BaseTools/Tests/TestTools.py b/BaseTools/Tests/TestTools.py index 1099fd4eea..545e1e3c13 100644 --- a/BaseTools/Tests/TestTools.py +++ b/BaseTools/Tests/TestTools.py @@ -109,6 +109,8 @@ class BaseToolsTest(unittest.TestCase): else: logFile = None
if toolName is None: toolName = self.toolName
+ if sys.platform == "win32":
+ toolName += ".exe"
bin = self.FindToolBin(toolName)
if logFile is not None:
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)
def ReadTmpFile(self, fileName):
- f = open(self.GetTmpFilePath(fileName), 'r')
+ f = open(self.GetTmpFilePath(fileName), 'rb')
data = f.read()
f.close()
return data
|