From b6faf76e9522607b90a8c120393f45e8d0d56b5d Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 5 May 2017 14:27:29 +0200 Subject: [PATCH] adjust acceptable size window for compressed unit test data MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit A low bound of 330 causes the test to fail with version 1.2.3 of zlib. Earlier this did not occur because in concat mode, tarfile would always write an empty zlib compressed chunk right at the beginning of the archive and then immediately create a new one as soon as actual input arrived. For this reason, the resulting archive size remained within the bounds chosen in test_multivol.py. Due to the removal of the redundancy, this is no longer the case. The problem is masked on newer versions of zlib (tested: 1.2.8 of fc25) which create larger compressed files in general for the same inputs. For the “test_compress_single” unit test, the input consists of a an archive 61440 bytes. Compress with level 9, window bits 31, and a memlevel of 9, the output length is: version size (B) 1.2.3 308 1.2.8 324 Add to that the file name in our custom header and the latter passes 330 B whereas the former doesn’t. A lower bound of 315 is justified. --- testing/test_multivol.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/testing/test_multivol.py b/testing/test_multivol.py index 8c9790e..72fb0d9 100644 --- a/testing/test_multivol.py +++ b/testing/test_multivol.py @@ -268,7 +268,10 @@ class MultivolGnuFormatTest(BaseTest): # check size of first volume size = os.stat("sample.tar.gz").st_size - assert 330 < size < 410, 'size of sample.tar.gz is {}'.format(size) + arbitrary_low_size_bound = 315 # adjust if zlib changes + arbitrary_high_size_bound = 410 # adjust if zlib changes + assert arbitrary_low_size_bound < size < arbitrary_high_size_bound, \ + 'size of sample.tar.gz is {}'.format(size) os.unlink("big") assert not os.path.exists("big") -- 1.7.1