Skip to content

Commit dd4aa25

Browse files
committed
Add a test closing an empty file system
1 parent c5d8525 commit dd4aa25

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

Tests/ContainerizationEXT4Tests/TestEXT4Format.swift

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ struct Ext4FormatTests: ~Copyable {
156156
@Test func groupDescriptors() throws {
157157
let f = try EXT4.EXT4Reader(blockDevice: fsPath)
158158
let gd = try f.getGroupDescriptor(0)
159-
#expect(gd.blockBitmapLow == 551) // move over by 512 blocks (for inodes)
160-
#expect(gd.inodeBitmapLow == 552) // move over by 512 blocks (for inodes)
161-
#expect(gd.inodeTableLow == 39)
159+
#expect(gd.blockBitmapLow == 520)
160+
#expect(gd.inodeBitmapLow == 521)
161+
#expect(gd.inodeTableLow == 8)
162162
#expect(gd.freeBlocksCountLow == 32246) // 512 block used by larger inode table per block group
163163
#expect(gd.freeInodesCountLow == 8176) // 512 times the inodes
164164
#expect(gd.usedDirsCountLow == 5)
@@ -219,3 +219,14 @@ struct Ext4FormatTests: ~Copyable {
219219
#expect(regFile.sizeLow == 4)
220220
}
221221
}
222+
223+
struct Ext4FormatEmptyRangeTests {
224+
@Test func closeEmptyFilesystem() throws {
225+
let fsPath = FilePath(
226+
FileManager.default.temporaryDirectory
227+
.appendingPathComponent(UUID().uuidString, isDirectory: false))
228+
defer { try? FileManager.default.removeItem(at: fsPath.url) }
229+
let formatter = try EXT4.Formatter(fsPath, minDiskSize: 32.kib())
230+
try formatter.close()
231+
}
232+
}

0 commit comments

Comments
 (0)