aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2017-04-06 14:58:49 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-11 18:10:49 +0100
commit88701cef6ba399e82f96ed1b0eef9a44ed8c1687 (patch)
tree564b54f67f21930cdf9627f9a1366028f7fad330 /scripts
parent3f1f42984021d87ac43aaa16f38b706c2c965e02 (diff)
downloadopenembedded-core-contrib-88701cef6ba399e82f96ed1b0eef9a44ed8c1687.tar.gz
oe-selftest: test wic sparse_copy API
Added new parameter 'api' to sparse_copy function to specify underlying filemap API to use. By default sparse_copy will try both available APIs. Added test case for sparse_copy to wic test suite. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/filemap.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 080668e7c2..1f1aacc522 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -530,9 +530,11 @@ def filemap(image, log=None):
except ErrorNotSupp:
return FilemapSeek(image, log)
-def sparse_copy(src_fname, dst_fname, offset=0, skip=0):
+def sparse_copy(src_fname, dst_fname, offset=0, skip=0, api=None):
"""Efficiently copy sparse file to or into another file."""
- fmap = filemap(src_fname)
+ if not api:
+ api = filemap
+ fmap = api(src_fname)
try:
dst_file = open(dst_fname, 'r+b')
except IOError: