@@ -68,6 +68,15 @@ fn built_index(path: &Path) -> DeflateIndex {
6868 . index
6969}
7070
71+ /// Builds an archive whose second authenticated member guarantees a portable
72+ /// checkpoint without depending on timing-sensitive marker-path admission.
73+ fn concatenated_gzip ( plain : & [ u8 ] ) -> Vec < u8 > {
74+ let split = plain. len ( ) / 2 ;
75+ let mut compressed = gzip ( & plain[ ..split] , 6 ) ;
76+ compressed. extend_from_slice ( & gzip ( & plain[ split..] , 6 ) ) ;
77+ compressed
78+ }
79+
7180fn assert_seeks_match ( compressed : & Path , index : DeflateIndex , plain : & [ u8 ] , targets : & [ usize ] ) {
7281 let source = fs:: File :: open ( compressed) . expect ( "open archive" ) ;
7382 let mut reader = IndexedReader :: new ( source, index) . expect ( "indexed reader" ) ;
@@ -175,7 +184,7 @@ fn indexed_gzip_reads_the_gzidx_we_write() {
175184 let plain = corpus ( 8 * 1024 * 1024 ) ;
176185 let archive = directory. join ( "corpus.gz" ) ;
177186 let exported = directory. join ( "ours.gzidx" ) ;
178- write ( & archive, & gzip ( & plain, 6 ) ) ;
187+ write ( & archive, & concatenated_gzip ( & plain) ) ;
179188 let index = built_index ( & archive) ;
180189 assert ! ( index. checkpoint_count( ) > 1 ) ;
181190 let mut bytes = Vec :: new ( ) ;
@@ -232,7 +241,7 @@ fn gztool_reads_the_index_we_write() {
232241 let directory = workspace ( "write-gztool" ) ;
233242 let plain = corpus ( 8 * 1024 * 1024 ) ;
234243 let archive = directory. join ( "corpus.gz" ) ;
235- write ( & archive, & gzip ( & plain, 6 ) ) ;
244+ write ( & archive, & concatenated_gzip ( & plain) ) ;
236245 let index = built_index ( & archive) ;
237246 assert ! ( index. checkpoint_count( ) > 1 ) ;
238247 let mut bytes = Vec :: new ( ) ;
0 commit comments