From 49567c1a16ff1e5d39609d4449c46655f5b2fe2e Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Mon, 26 Nov 2012 13:41:39 +0200 Subject: [PATCH] test_api_base: run the test for more than one file Instead of running the test of one file of 64MiB, run it 3 times for files of the following sizes: 1. 8MiB 2. 8MiB + 1 byte 3. 8MiB - 1 byte This gives better coverage. Change-Id: I4ea4f5f92dc32c1d8fbf9ea0173b7c39a294968d Signed-off-by: Artem Bityutskiy --- tests/test_api_base.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_api_base.py b/tests/test_api_base.py index d8ea72b..7aab982 100644 --- a/tests/test_api_base.py +++ b/tests/test_api_base.py @@ -125,10 +125,18 @@ class TestCreateCopy(unittest.TestCase): # Create and open a temporary file for the image f_image = tempfile.NamedTemporaryFile("wb+") - # Create a 64MiB random sparse file - test_helpers.create_random_sparse_file(f_image, 64 * 1024 * 1024) + # Create a 8MiB random sparse file + size = 8 * 1024 * 1024 + test_helpers.create_random_sparse_file(f_image, size) # Execute the test on this file self._do_test(f_image) + # Do the same for random sparse files of size 8MiB +/- 1 byte + test_helpers.create_random_sparse_file(f_image, size + 1) + self._do_test(f_image) + + test_helpers.create_random_sparse_file(f_image, size - 1) + self._do_test(f_image) + f_image.close() -- 2.7.4