mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
tests: re-open store after datapack truncation
Summary: When I replace lz4 to rust.lz4, the test failed. The change fixes it. That also means datapack corruption detection is not that reliable. However, usually those files are not changed when they are loaded into an in-memory store, so it's probaby fine. Also note the python-lz4 used in production has strange behavior when compressing an empty string: In [6]: lz4.compressHC('') Out[6]: '\x00\x00\x00\x00\xa0#\xd9\x040\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00' In [7]: lz4.compress('') Out[7]: '\x00\x00\x00\x00\xa0#\xd9\x040\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00' In [9]: rustlz4.compress('') Out[9]: bytearray(b'\x00\x00\x00\x00') In [10]: rustlz4.compresshc('') Out[10]: bytearray(b'\x00\x00\x00\x00') In [13]: lz4.compress('1') Out[13]: '\x01\x00\x00\x00\x101' In [14]: rustlz4.compress('1') Out[14]: bytearray(b'\x01\x00\x00\x00\x101') Reviewed By: DurhamG Differential Revision: D13528199 fbshipit-source-id: 9b3e8674f989062928900766156a97d28262c8cb
This commit is contained in:
parent
22e9000fc9
commit
fafc7c6b1c
@ -369,6 +369,11 @@ class datapacktestsbase(object):
|
||||
f.truncate(1)
|
||||
f.close()
|
||||
|
||||
# Re-create the store. Otherwise the behavior is kind of "undefined"
|
||||
# because the size of mmap-ed memory isn't truncated automatically,
|
||||
# and is filled by 0.
|
||||
store = datapackstore(ui, packdir, self.iscdatapack, deletecorruptpacks=True)
|
||||
|
||||
# Look for key again
|
||||
try:
|
||||
ui.pushbuffer(error=True)
|
||||
|
Loading…
Reference in New Issue
Block a user