diff options
author | Tom Rini <trini@konsulko.com> | 2021-11-26 17:10:53 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-11-26 17:10:53 -0500 |
commit | 693650b15d04cd5a5861bd3136c9ed9e23f95c41 (patch) | |
tree | b4a3b3ca5d9b6b6f10e3d6880f1caa17219776c2 /test/py/u_boot_utils.py | |
parent | 2ad8d0cb950da2233a2ec030533f4e54c6d04126 (diff) | |
parent | 2b5e7108594d4e100c88f44353d1fed6456d6471 (diff) |
Merge tag 'efi-2022-01-rc3-2' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2022-01-rc3-2
Test:
* fix pylint warnings
UEFI:
* disable interrupts before removing devices in ExitBootServices()
* implement poweroff in efi_system_reset() on sandbox
* allow booting via EFI even if some block device fails
Diffstat (limited to 'test/py/u_boot_utils.py')
-rw-r--r-- | test/py/u_boot_utils.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/test/py/u_boot_utils.py b/test/py/u_boot_utils.py index e816c7fbb6..089eda5434 100644 --- a/test/py/u_boot_utils.py +++ b/test/py/u_boot_utils.py @@ -1,17 +1,20 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. -# Utility code shared across multiple tests. +""" +Utility code shared across multiple tests. +""" import hashlib import inspect import os import os.path -import pytest +import pathlib import signal import sys import time import re +import pytest def md5sum_data(data): """Calculate the MD5 hash of some data. @@ -48,7 +51,7 @@ def md5sum_file(fn, max_length=None): data = fh.read(*params) return md5sum_data(data) -class PersistentRandomFile(object): +class PersistentRandomFile: """Generate and store information about a persistent file containing random data.""" @@ -144,7 +147,7 @@ def wait_until_file_open_fails(fn, ignore_errors): Nothing. """ - for i in range(100): + for _ in range(100): fh = attempt_to_open_file(fn) if not fh: return @@ -192,9 +195,9 @@ def run_and_log_expect_exception(u_boot_console, cmd, retcode, msg): try: runner = u_boot_console.log.get_runner(cmd[0], sys.stdout) runner.run(cmd) - except Exception as e: - assert(retcode == runner.exit_status) - assert(msg in runner.output) + except Exception: + assert retcode == runner.exit_status + assert msg in runner.output else: raise Exception("Expected an exception with retcode %d message '%s'," "but it was not raised" % (retcode, msg)) @@ -279,17 +282,17 @@ class PersistentFileHelperCtxMgr(object): if filename_timestamp < self.module_timestamp: self.log.action('Removing stale generated file ' + self.filename) - os.unlink(self.filename) + pathlib.Path(self.filename).unlink() def __exit__(self, extype, value, traceback): if extype: try: - os.path.unlink(self.filename) - except: + pathlib.Path(self.filename).unlink() + except Exception: pass return logged = False - for i in range(20): + for _ in range(20): filename_timestamp = os.path.getmtime(self.filename) if filename_timestamp > self.module_timestamp: break |