# HG changeset patch # User Anton Shestakov # Date 1618309874 -28800 # Node ID 5435777c307cb8698039b702fabc67d400e42f73 # Parent 1b6dfac6b17ef2e5bf2ce786ee081b3b5a044339 tests: clarify what repack.py is doing in test-cache-corruption.t diff -r 1b6dfac6b17e -r 5435777c307c tests/test-cache-corruption.t --- a/tests/test-cache-corruption.t Mon Apr 05 16:36:35 2021 +0800 +++ b/tests/test-cache-corruption.t Tue Apr 13 18:31:14 2021 +0800 @@ -16,17 +16,20 @@ $ cat >> repack.py << EOF > import struct > import sys + > # imitating array.array().tobytes() with a platform-dependent item size + > sixtyfour = struct.Struct(' thirtytwo = struct.Struct(' data = [] > with open(sys.argv[1], 'rb') as f: > header = f.read(24) > while True: - > buf = f.read(8) + > buf = f.read(sixtyfour.size) > if not buf: break - > data.append(struct.unpack(' data.append(sixtyfour.unpack(buf)[0]) > with open(sys.argv[1], 'wb') as f: > f.write(header) > for item in data: - > f.write(struct.pack(' f.write(thirtytwo.pack(item)) > EOF $ cat >> truncate.py << EOF