-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3dc3544
commit b972104
Showing
8 changed files
with
212 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
![memory map diagram](report.png) | ||
|name|origin|size|remaining|collisions | ||
|:-|:-|:-|:-|:-| | ||
|<span style='color:steelblue'>kernel</span>|0x10|0x50|-0x10|{'rootfs': '0x50'}| | ||
|<span style='color:darkcyan'>uboot</span>|0xD0|0x50|-0x10|{'uboot-scr': '0x110'}| | ||
|<span style='color:aqua'>rootfs</span>|0x50|0x30|0x10|{'kernel': '0x50'}| | ||
|<span style='color:cornflowerblue'>dtb</span>|0x90|0x30|0x10|{}| | ||
|<span style='color:blue'>uboot-scr</span>|0x110|0x30|0x50|{'uboot': '0x110'}| | ||
|<span style='color:forestgreen'>kernel</span>|0x10|0x50|-0x10|{'rootfs': '0x50'}| | ||
|<span style='color:cornflowerblue'>uboot</span>|0xD0|0x50|-0x10|{'uboot-scr': '0x110'}| | ||
|<span style='color:cadetblue'>rootfs</span>|0x50|0x30|0x10|{'kernel': '0x50'}| | ||
|<span style='color:springgreen'>dtb</span>|0x90|0x30|0x10|{}| | ||
|<span style='color:green'>uboot-scr</span>|0x110|0x30|0x50|{'uboot': '0x110'}| |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import mm.diagram | ||
import unittest | ||
import mm.types | ||
import pathlib | ||
import PIL.Image | ||
|
||
# Check the output report at /tmp/pytest/tests.test_distance.md | ||
|
||
|
||
def test_skip_region(): | ||
""" """ | ||
|
||
report = pathlib.Path(f"/tmp/pytest/{__name__}.md") | ||
image_full = pathlib.Path(f"/tmp/pytest/{__name__}_full.png") | ||
image_crop_join = pathlib.Path(f"/tmp/pytest/{__name__}_cropped.png") | ||
|
||
report.unlink(missing_ok=True) | ||
image_full.unlink(missing_ok=True) | ||
image_crop_join.unlink(missing_ok=True) | ||
|
||
diagram_height = 1000 | ||
with unittest.mock.patch('sys.argv', | ||
['mmap_digram.diagram', | ||
'kernel', | ||
'0x10', | ||
'0x30', | ||
'rootfs', | ||
'0x50', | ||
'0x30', | ||
'dtb', | ||
'0x190', | ||
'0x30', | ||
"-o", str(report), | ||
"-l", str(diagram_height)]): | ||
|
||
d = mm.diagram.MemoryMap() | ||
for region in d._region_list: | ||
if region.name == "kernel": | ||
assert region._origin == "0x10" | ||
assert region._size == "0x30" | ||
assert region.remain == "0x10" | ||
if region.name == "rootfs": | ||
assert region._origin == "0x50" | ||
assert region._size == "0x30" | ||
assert region.remain == "0x110" | ||
if region.name == "dtb": | ||
assert region._origin == "0x190" | ||
assert region._size == "0x30" | ||
assert region.remain == "0x228" | ||
|
||
assert report.is_file | ||
|
||
assert image_full.is_file | ||
assert PIL.Image.open(image_full).width == 400 | ||
assert PIL.Image.open(image_full).height == 1000 | ||
|
||
assert image_crop_join.is_file | ||
assert PIL.Image.open(image_crop_join).width == 400 | ||
assert PIL.Image.open(image_crop_join).height == 316 |