Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mercurial
evolve
Commits
5435777c307c
Commit
5435777c
authored
Apr 13, 2021
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/test-cache-corruption.t
View file @
5435777c
...
...
@@ -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
(
s
truct
.
unpack
(
'
<q
',
buf
)[
0
])
>
data
.
append
(
s
ixtyfour
.
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment