From 7c7d6e24e922ec5e963e9d5972f778328568efb7 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 28 Nov 2012 11:36:54 +0200 Subject: [PATCH] test_fiemap: test with different buffer sizes Test the 'Fiemap' class with several different buffer sizes. Change-Id: I250f576c4804c02e3691197d8542430571fcb6d4 Signed-off-by: Artem Bityutskiy --- tests/test_fiemap.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_fiemap.py b/tests/test_fiemap.py index ba69ae7..f183d37 100644 --- a/tests/test_fiemap.py +++ b/tests/test_fiemap.py @@ -15,14 +15,15 @@ class Error(Exception): """ A class for exceptions generated by this test. """ pass -def _do_test(f_image, mapped, holes): +def _do_test(f_image, mapped, holes, buf_size = Fiemap.DEFAULT_BUFFER_SIZE): """ Verifiy that Fiemap reports the correct mapped areas and holes ranges fro the 'f_image' file object. The 'mapped' and 'holes' lists contains the - correct ranges. """ + correct ranges. The 'buf_size' argument specifies the Fiemap class internal + buffer size. """ # Make sure that Fiemap's get_mapped_ranges() returns the same ranges as # we have in the 'mapped' list. - fiemap = Fiemap.Fiemap(f_image) + fiemap = Fiemap.Fiemap(f_image, buf_size) fiemap_iterator = fiemap.get_mapped_ranges(0, fiemap.blocks_cnt) iterator = itertools.izip_longest(fiemap_iterator, mapped) @@ -72,3 +73,7 @@ class TestCreateCopy(unittest.TestCase): delete) for f_image, mapped, holes in iterator: _do_test(f_image, mapped, holes) + _do_test(f_image, mapped, holes, Fiemap.MIN_BUFFER_SIZE) + _do_test(f_image, mapped, holes, Fiemap.MIN_BUFFER_SIZE * 2) + _do_test(f_image, mapped, holes, Fiemap.DEFAULT_BUFFER_SIZE / 2) + _do_test(f_image, mapped, holes, Fiemap.DEFAULT_BUFFER_SIZE * 2) -- 2.7.4