Commit 5435777c authored by Anton Shestakov's avatar Anton Shestakov
Browse files

tests: clarify what repack.py is doing in test-cache-corruption.t

parent 1b6dfac6b17e
Pipeline #20550 passed with stage
in 7 minutes and 31 seconds
......@@ -16,7 +16,10 @@
$ 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:
......@@ -19,6 +22,6 @@
> 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
......@@ -24,5 +27,5 @@
> 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:
......@@ -26,7 +29,7 @@
> 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment