added stub with plan for new volume_size_accuracy test
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 14 Jul 2016 16:19:50 +0000 (18:19 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 12 Nov 2020 14:04:34 +0000 (15:04 +0100)
testing/volume_size_accuracy.py [new file with mode: 0644]

diff --git a/testing/volume_size_accuracy.py b/testing/volume_size_accuracy.py
new file mode 100644 (file)
index 0000000..2e8e5a4
--- /dev/null
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+
+""" Check very accurately the splitting of files into volumes; not a unit test
+
+Check:
+- behaviour for max_volume_sizes % BLOCK_SIZE != 0
+- file sizes very close to size remaining in volume
+
+By doing the following:
+- create a multi-volume archive with max_volume_size % BLOCK_SIZE == 0
+- add a file that nearly fills the volume
+- add a small file that should just fit in or not
+- check expected number and size of volumes
+- repeat with max_volume_size +1, -1, +2, -2, +10, -10
+Repeat with compressed/encrypted data; for this have to find some random data
+that is repeatable (--> :py:mod:`create_pseudo_random_files`) and experiment a
+bit for suitable seeds and sizes
+
+e.g. for max_volume_size = 8 * BLOCK_SIZE:
+
+block | 0      | 1     | 2     | 3     | 4     | 5     | 6     | 7     | (8!)
+------+--------+-------+-------+-------+-------+-------+-------+-------+------
+file0 fits into 5 blocks:
+vol0: | Info0  | Dat00 | Dat01 | Dat02 | Dat03 | Dat04 | Info1 | Dat10 |
+vol1: | Dat11  |       |       |       |       |       |       |       |
+
+OR: file0 needs 6th block --> force volume0 too big:
+vol0: | Info0  | Dat00 | Dat01 | Dat02 | Dat03 | Dat04 | Dat05 | Info1 | Dat10
+vol1: | Dat11  |       |       |       |       |       |       |       |
+
+OR: all fit into first volume
+vol0: | Info0  | Dat00 | Dat01 | Dat02 | Dat03 | Dat04 | Info1 | Dat10 |
+
+NOT: Info block in the end
+vol0: | Info0  | Dat00 | Dat01 | Dat02 | Dat03 | Dat04 | Dat05 | Info1 |
+vol1: | Dat10  | Dat11 |       |       |       |       |       |       |
+
+.. codeauthor:: Intra2net AG <info@intra2net>
+"""
+
+
+from deltatar.tarfile import TarFile
+
+
+def main():
+    """ Main function, called when running file as script
+
+    see module doc for more info
+    """
+    raise NotImplementedError()
+
+
+if __name__ == '__main__':
+    main()