support/testing/tests/package/test_bmap_tools: add test for host bmap-tools
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [yann.morin.1998@free.fr: check the two files are identical] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
1023f742b8
commit
81d1c6cf28
@ -1,5 +1,6 @@
|
||||
import os
|
||||
import infra
|
||||
import subprocess
|
||||
|
||||
from infra.basetest import BRTest
|
||||
|
||||
@ -59,3 +60,34 @@ class TestPy3BmapTools(TestBmapTools):
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
"""
|
||||
|
||||
|
||||
class TestHostBmapTools(BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
BR2_PACKAGE_HOST_BMAP_TOOLS=y
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
BR2_TARGET_ROOTFS_EXT2=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
bmap_x = os.path.join(self.b.builddir, "host", "bin", "bmaptool")
|
||||
src_f = os.path.join(self.b.builddir, "images", "rootfs.ext2")
|
||||
dst_f = os.path.join(self.b.builddir, "images", "rootfs.ext2.copy")
|
||||
map_f = os.path.join(self.b.builddir, "images", "rootfs.ext2.bmap")
|
||||
|
||||
ret = subprocess.call([bmap_x, "create", "-o", map_f, src_f],
|
||||
stdout=self.b.logfile,
|
||||
stderr=self.b.logfile)
|
||||
self.assertEqual(ret, 0)
|
||||
|
||||
ret = subprocess.call([bmap_x, "copy", src_f, dst_f],
|
||||
stdout=self.b.logfile,
|
||||
stderr=self.b.logfile)
|
||||
self.assertEqual(ret, 0)
|
||||
|
||||
with open(src_f, 'rb') as f:
|
||||
src = f.read()
|
||||
with open(dst_f, 'rb') as f:
|
||||
dst = f.read()
|
||||
self.assertEqual(src, dst)
|
||||
|
Loading…
Reference in New Issue
Block a user