Mercurial > evolve
changeset 5870:5435777c307c stable
tests: clarify what repack.py is doing in test-cache-corruption.t
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 13 Apr 2021 18:31:14 +0800 |
parents | 1b6dfac6b17e |
children | d6fa75241975 |
files | tests/test-cache-corruption.t |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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('<q') # as seen on 64-bit platforms + > thirtytwo = struct.Struct('<l') # as seen on 32-bit platforms > 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('<q', buf)[0]) + > 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('<l', item)) + > f.write(thirtytwo.pack(item)) > EOF $ cat >> truncate.py << EOF