Debian Codegraph @

debian/patches/fix-tests-32-bit.diff

raw
1 --- a/src/tests/write/zip64/mod.rs
2 +++ b/src/tests/write/zip64/mod.rs
3 @@ -14,7 +14,7 @@
4 // Useful constants for writing a large file.
5 const BATCH_SIZE: usize = 100_000;
6 const NUM_BATCHES: usize = NON_ZIP64_MAX_SIZE as usize / BATCH_SIZE + 1;
7 -const BATCHED_FILE_SIZE: usize = NUM_BATCHES * BATCH_SIZE;
8 +const BATCHED_FILE_SIZE: u64 = NUM_BATCHES as u64 * BATCH_SIZE as u64;
9
10 /// Test writing a small zip64 file.
11 /// No zip64 extra fields will be emitted for EntryWhole.
12 @@ -50,11 +50,12 @@
13
14 /// Test writing a large zip64 file. This test will use upwards of 4GB of memory.
15 #[tokio::test]
16 +#[cfg(not(target_pointer_width="32"))]
17 async fn test_write_large_zip64_file() {
18 init_logger();
19
20 // Allocate space with some extra for metadata records
21 - let mut buffer = Vec::with_capacity(BATCHED_FILE_SIZE + 100_000);
22 + let mut buffer = Vec::with_capacity((BATCHED_FILE_SIZE + 100_000).try_into().unwrap());
23 let mut writer = ZipFileWriter::new(&mut buffer);
24
25 // Stream-written zip files are dubiously spec-conformant. We need to specify a valid file size
26 @@ -95,18 +96,21 @@
27 }
28 bytes_total += read_bytes;
29 }
30 - assert_eq!(bytes_total, BATCHED_FILE_SIZE);
31 + assert_eq!(bytes_total as u64, BATCHED_FILE_SIZE);
32 }
33
34 /// Test writing a file, and reading it with async-zip
35 +/// Skip this test on 32-bit architectures as it will
36 +/// Run out of address space.
37 #[tokio::test]
38 +#[cfg(not(target_pointer_width="32"))]
39 async fn test_write_large_zip64_file_self_read() {
40 use futures_lite::io::AsyncReadExt;
41
42 init_logger();
43
44 // Allocate space with some extra for metadata records
45 - let mut buffer = Vec::with_capacity(BATCHED_FILE_SIZE + 100_000);
46 + let mut buffer = Vec::with_capacity((BATCHED_FILE_SIZE + 100_000).try_into().unwrap());
47 let mut writer = ZipFileWriter::new(&mut buffer);
48
49 let entry = ZipEntryBuilder::new("file".into(), Compression::Stored);
50 @@ -132,7 +136,7 @@
51 }
52 bytes_total += read_bytes;
53 }
54 - assert_eq!(bytes_total, BATCHED_FILE_SIZE);
55 + assert_eq!(bytes_total as u64, BATCHED_FILE_SIZE);
56 }
57
58 /// Test writing a zip64 file with more than u16::MAX files.