Tests for promotion policy
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
@@ -6,8 +6,15 @@
|
||||
from ctypes import string_at
|
||||
|
||||
|
||||
def print_buffer(buf, length, offset=0, width=16, ignore=0,
|
||||
stop_after_count_ignored=0, print_fcn=print):
|
||||
def print_buffer(
|
||||
buf,
|
||||
length,
|
||||
offset=0,
|
||||
width=16,
|
||||
ignore=0,
|
||||
stop_after_count_ignored=0,
|
||||
print_fcn=print,
|
||||
):
|
||||
end = int(offset) + int(length)
|
||||
offset = int(offset)
|
||||
ignored_lines = 0
|
||||
@@ -20,15 +27,25 @@ def print_buffer(buf, length, offset=0, width=16, ignore=0,
|
||||
byteline = ""
|
||||
asciiline = ""
|
||||
if not any(x != ignore for x in cur_line):
|
||||
if stop_after_count_ignored and ignored_lines > stop_after_count_ignored:
|
||||
print_fcn("<{} bytes of '0x{:02X}' encountered, stopping>".
|
||||
format(stop_after_count_ignored * width, ignore))
|
||||
if (
|
||||
stop_after_count_ignored
|
||||
and ignored_lines > stop_after_count_ignored
|
||||
):
|
||||
print_fcn(
|
||||
"<{} bytes of '0x{:02X}' encountered, stopping>".format(
|
||||
stop_after_count_ignored * width, ignore
|
||||
)
|
||||
)
|
||||
return
|
||||
ignored_lines += 1
|
||||
continue
|
||||
|
||||
if ignored_lines:
|
||||
print_fcn("<{} of '0x{:02X}' bytes omitted>".format(ignored_lines * width, ignore))
|
||||
print_fcn(
|
||||
"<{} of '0x{:02X}' bytes omitted>".format(
|
||||
ignored_lines * width, ignore
|
||||
)
|
||||
)
|
||||
ignored_lines = 0
|
||||
|
||||
for byte in cur_line:
|
||||
@@ -58,9 +75,12 @@ class Size:
|
||||
|
||||
def __init__(self, b: int, sector_aligned: bool = False):
|
||||
if sector_aligned:
|
||||
self.bytes = ((b + self._SECTOR_SIZE - 1) // self._SECTOR_SIZE) * self._SECTOR_SIZE
|
||||
self.bytes = int(
|
||||
((b + self._SECTOR_SIZE - 1) // self._SECTOR_SIZE)
|
||||
* self._SECTOR_SIZE
|
||||
)
|
||||
else:
|
||||
self.bytes = b
|
||||
self.bytes = int(b)
|
||||
|
||||
def __int__(self):
|
||||
return self.bytes
|
||||
|
||||
Reference in New Issue
Block a user