summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbigtedde <big.tedde@gmail.com>2023-07-26 14:59:45 -0700
committerbigtedde <big.tedde@gmail.com>2023-07-26 14:59:45 -0700
commit7b753453e5e456f7d11f99dccd1e1c8defd1e06a (patch)
tree9988fc0b55f0954771f6a12323208c77052291ed /src
parent67334c4e8364e6d3158769c0f9ad6acb68bd9682 (diff)
removed BaseTestCase from chunker_slow.py
Diffstat (limited to 'src')
-rw-r--r--src/borg/testsuite/chunker_slow.py52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/borg/testsuite/chunker_slow.py b/src/borg/testsuite/chunker_slow.py
index 9b5e27613..47d50eacc 100644
--- a/src/borg/testsuite/chunker_slow.py
+++ b/src/borg/testsuite/chunker_slow.py
@@ -5,35 +5,33 @@ from .chunker import cf
from ..chunker import Chunker
from ..crypto.low_level import blake2b_256
from ..constants import * # NOQA
-from . import BaseTestCase
-class ChunkerRegressionTestCase(BaseTestCase):
- def test_chunkpoints_unchanged(self):
- def twist(size):
- x = 1
- a = bytearray(size)
- for i in range(size):
- x = (x * 1103515245 + 12345) & 0x7FFFFFFF
- a[i] = x & 0xFF
- return a
+def test_chunkpoints_unchanged():
+ def twist(size):
+ x = 1
+ a = bytearray(size)
+ for i in range(size):
+ x = (x * 1103515245 + 12345) & 0x7FFFFFFF
+ a[i] = x & 0xFF
+ return a
- data = twist(100000)
+ data = twist(100000)
- runs = []
- for winsize in (65, 129, HASH_WINDOW_SIZE, 7351):
- for minexp in (4, 6, 7, 11, 12):
- for maxexp in (15, 17):
- if minexp >= maxexp:
- continue
- for maskbits in (4, 7, 10, 12):
- for seed in (1849058162, 1234567653):
- fh = BytesIO(data)
- chunker = Chunker(seed, minexp, maxexp, maskbits, winsize)
- chunks = [blake2b_256(b"", c) for c in cf(chunker.chunkify(fh, -1))]
- runs.append(blake2b_256(b"", b"".join(chunks)))
+ runs = []
+ for winsize in (65, 129, HASH_WINDOW_SIZE, 7351):
+ for minexp in (4, 6, 7, 11, 12):
+ for maxexp in (15, 17):
+ if minexp >= maxexp:
+ continue
+ for maskbits in (4, 7, 10, 12):
+ for seed in (1849058162, 1234567653):
+ fh = BytesIO(data)
+ chunker = Chunker(seed, minexp, maxexp, maskbits, winsize)
+ chunks = [blake2b_256(b"", c) for c in cf(chunker.chunkify(fh, -1))]
+ runs.append(blake2b_256(b"", b"".join(chunks)))
- # The "correct" hash below matches the existing chunker behavior.
- # Future chunker optimisations must not change this, or existing repos will bloat.
- overall_hash = blake2b_256(b"", b"".join(runs))
- self.assert_equal(overall_hash, unhexlify("b559b0ac8df8daaa221201d018815114241ea5c6609d98913cd2246a702af4e3"))
+ # The "correct" hash below matches the existing chunker behavior.
+ # Future chunker optimisations must not change this, or existing repos will bloat.
+ overall_hash = blake2b_256(b"", b"".join(runs))
+ assert overall_hash == unhexlify("b559b0ac8df8daaa221201d018815114241ea5c6609d98913cd2246a702af4e3")