Use struct to define all expected data for partitioning scheme tests.

This commit is contained in:
2021-03-03 15:11:22 +00:00
parent 286df1bb12
commit 4e3aa7ae86
15 changed files with 5235 additions and 5430 deletions

View File

@@ -37,60 +37,49 @@ namespace Aaru.Tests.Partitions
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Acorn"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Acorn");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"linux_ics.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// Linux (ICS)
// TODO: Values are incorrect
new[]
{ {
new Partition TestFile = "linux_ics.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 31457280, {
Name = null, Length = 61440,
Type = "GEM", Offset = 512,
Offset = 512, Sequence = 0,
Length = 61440, Size = 31457280,
Sequence = 0, Start = 1,
Start = 1 Type = "GEM"
}, },
new Partition new Partition
{ {
Description = null, Length = 81920,
Size = 41943040, Offset = 31457792,
Name = null, Sequence = 1,
Type = "BGM", Size = 41943040,
Offset = 31457792, Start = 61441,
Length = 81920, Type = "BGM"
Sequence = 1, },
Start = 61441 new Partition
}, {
new Partition Length = 110161,
{ Offset = 73400832,
Description = null, Sequence = 2,
Size = 56402432, Size = 56402432,
Name = null, Start = 143361,
Type = "LNX", Type = "LNX"
Offset = 73400832, },
Length = 110161, new Partition
Sequence = 2, {
Start = 143361 Length = 84400,
}, Offset = 129803264,
new Partition Sequence = 3,
{ Size = 43212800,
Description = null, Start = 253522,
Size = 43212800, Type = "MAC"
Name = null, }
Type = "MAC",
Offset = 129803264,
Length = 84400,
Sequence = 3,
Start = 253522
} }
} }
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -36,279 +36,234 @@ namespace Aaru.Tests.Partitions
public class Atari : PartitionSchemeTest public class Atari : PartitionSchemeTest
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Atari ST"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Atari ST");
public override PartitionTest[] Tests => new[]
public override string[] TestFiles => new[]
{ {
"linux_ahdi.aif", "linux_icd.aif", "tos_1.04.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// Linux (AHDI)
new[]
{ {
new Partition TestFile = "linux_ahdi.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 31457280, {
Name = null, Length = 61440,
Type = "GEM", Offset = 512,
Offset = 512, Sequence = 0,
Length = 61440, Size = 31457280,
Sequence = 0, Start = 1,
Start = 1 Type = "GEM"
}, },
new Partition new Partition
{ {
Description = null, Length = 81920,
Size = 41943040, Offset = 31457792,
Name = null, Sequence = 1,
Type = "BGM", Size = 41943040,
Offset = 31457792, Start = 61441,
Length = 81920, Type = "BGM"
Sequence = 1, },
Start = 61441 new Partition
}, {
new Partition Length = 110161,
{ Offset = 73400832,
Description = null, Sequence = 2,
Size = 56402432, Size = 56402432,
Name = null, Start = 143361,
Type = "LNX", Type = "LNX"
Offset = 73400832, },
Length = 110161, new Partition
Sequence = 2, {
Start = 143361 Length = 84400,
}, Offset = 129803264,
new Partition Sequence = 3,
{ Size = 43212800,
Description = null, Start = 253522,
Size = 43212800, Type = "MAC"
Name = null, },
Type = "MAC", new Partition
Offset = 129803264, {
Length = 84400, Length = 112640,
Sequence = 3, Offset = 173016064,
Start = 253522 Sequence = 4,
}, Size = 57671680,
new Partition Start = 337922,
{ Type = "MIX"
Description = null, },
Size = 57671680, new Partition
Name = null, {
Type = "MIX", Length = 122880,
Offset = 173016064, Offset = 230687744,
Length = 112640, Sequence = 5,
Sequence = 4, Size = 62914560,
Start = 337922 Start = 450562,
}, Type = "MNX"
new Partition },
{ new Partition
Description = null, {
Size = 62914560, Length = 143360,
Name = null, Offset = 293602304,
Type = "MNX", Sequence = 6,
Offset = 230687744, Size = 73400320,
Length = 122880, Start = 573442,
Sequence = 5, Type = "RAW"
Start = 450562 },
}, new Partition
new Partition {
{ Length = 153600,
Description = null, Offset = 367002624,
Size = 73400320, Sequence = 7,
Name = null, Size = 78643200,
Type = "RAW", Start = 716802,
Offset = 293602304, Type = "SWP"
Length = 143360, },
Sequence = 6, new Partition
Start = 573442 {
}, Length = 2048,
new Partition Offset = 445645824,
{ Sequence = 8,
Description = null, Size = 1048576,
Size = 78643200, Start = 870402,
Name = null, Type = "UNX"
Type = "SWP", },
Offset = 367002624, new Partition
Length = 153600, {
Sequence = 7, Length = 151550,
Start = 716802 Offset = 446694400,
}, Sequence = 9,
new Partition Size = 77593600,
{ Start = 872450,
Description = null, Type = "LNX"
Size = 1048576, }
Name = null,
Type = "UNX",
Offset = 445645824,
Length = 2048,
Sequence = 8,
Start = 870402
},
new Partition
{
Description = null,
Size = 77593600,
Name = null,
Type = "LNX",
Offset = 446694400,
Length = 151550,
Sequence = 9,
Start = 872450
} }
}, },
new PartitionTest
// Linux (ICD)
new[]
{ {
new Partition TestFile = "linux_icd.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 15728640, {
Name = null, Length = 30720,
Type = "GEM", Offset = 512,
Offset = 512, Sequence = 0,
Length = 30720, Size = 15728640,
Sequence = 0, Start = 1,
Start = 1 Type = "GEM"
}, },
new Partition new Partition
{ {
Description = null, Length = 40960,
Size = 20971520, Offset = 15729152,
Name = null, Sequence = 1,
Type = "UNX", Size = 20971520,
Offset = 15729152, Start = 30721,
Length = 40960, Type = "UNX"
Sequence = 1, },
Start = 30721 new Partition
}, {
new Partition Length = 61440,
{ Offset = 36700672,
Description = null, Sequence = 2,
Size = 31457280, Size = 31457280,
Name = null, Start = 71681,
Type = "LNX", Type = "LNX"
Offset = 36700672, },
Length = 61440, new Partition
Sequence = 2, {
Start = 71681 Length = 81920,
}, Offset = 68157952,
new Partition Sequence = 3,
{ Size = 41943040,
Description = null, Start = 133121,
Size = 41943040, Type = "BGM"
Name = null, },
Type = "BGM", new Partition
Offset = 68157952, {
Length = 81920, Length = 102400,
Sequence = 3, Offset = 110100992,
Start = 133121 Sequence = 4,
}, Size = 52428800,
new Partition Start = 215041,
{ Type = "MAC"
Description = null, },
Size = 52428800, new Partition
Name = null, {
Type = "MAC", Length = 122880,
Offset = 110100992, Offset = 162529792,
Length = 102400, Sequence = 5,
Sequence = 4, Size = 62914560,
Start = 215041 Start = 317441,
}, Type = "MIX"
new Partition },
{ new Partition
Description = null, {
Size = 62914560, Length = 163840,
Name = null, Offset = 225444352,
Type = "MIX", Sequence = 6,
Offset = 162529792, Size = 83886080,
Length = 122880, Start = 440321,
Sequence = 5, Type = "SWP"
Start = 317441 },
}, new Partition
new Partition {
{ Length = 202752,
Description = null, Offset = 309330432,
Size = 83886080, Sequence = 7,
Name = null, Size = 103809024,
Type = "SWP", Start = 604161,
Offset = 225444352, Type = "MNX"
Length = 163840, },
Sequence = 6, new Partition
Start = 440321 {
}, Length = 204800,
new Partition Offset = 413139456,
{ Sequence = 8,
Description = null, Size = 104857600,
Size = 103809024, Start = 806913,
Name = null, Type = "LNX"
Type = "MNX", }
Offset = 309330432,
Length = 202752,
Sequence = 7,
Start = 604161
},
new Partition
{
Description = null,
Size = 104857600,
Name = null,
Type = "LNX",
Offset = 413139456,
Length = 204800,
Sequence = 8,
Start = 806913
} }
}, },
new PartitionTest
// TOS 1.04
new[]
{ {
new Partition TestFile = "tos_1.04.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 7340032, {
Name = null, Length = 14336,
Type = "GEM", Offset = 1024,
Offset = 1024, Sequence = 0,
Length = 14336, Size = 7340032,
Sequence = 0, Start = 2,
Start = 2 Type = "GEM"
}, },
new Partition new Partition
{ {
Description = null, Length = 14336,
Size = 7340032, Offset = 7341056,
Name = null, Sequence = 1,
Type = "GEM", Size = 7340032,
Offset = 7341056, Start = 14338,
Length = 14336, Type = "GEM"
Sequence = 1, },
Start = 14338 new Partition
}, {
new Partition Length = 14336,
{ Offset = 14681088,
Description = null, Sequence = 2,
Size = 7340032, Size = 7340032,
Name = null, Start = 28674,
Type = "GEM", Type = "GEM"
Offset = 14681088, },
Length = 14336, new Partition
Sequence = 2, {
Start = 28674 Length = 14334,
}, Offset = 22021120,
new Partition Sequence = 3,
{ Size = 7339008,
Description = null, Start = 43010,
Size = 7339008, Type = "GEM"
Name = null, }
Type = "GEM",
Offset = 22021120,
Length = 14334,
Sequence = 3,
Start = 43010
} }
} }
}; };

View File

@@ -37,357 +37,295 @@ namespace Aaru.Tests.Partitions
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "BSD slices"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "BSD slices");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"parted.aif", "netbsd_1.6.aif", "netbsd_6.1.5.aif", "netbsd_7.1.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// Parted
new[]
{ {
new Partition TestFile = "parted.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 38797312, {
Name = null, Length = 75776,
Type = "FAT", Offset = 1048576,
Offset = 1048576, Sequence = 0,
Length = 75776, Size = 38797312,
Sequence = 0, Start = 2048,
Start = 2048 Type = "FAT"
}, },
new Partition new Partition
{ {
Description = null, Length = 38912,
Size = 19922944, Offset = 40894464,
Name = null, Sequence = 1,
Type = "FAT", Size = 19922944,
Offset = 40894464, Start = 79872,
Length = 38912, Type = "FAT"
Sequence = 1, },
Start = 79872 new Partition
}, {
new Partition Length = 94208,
{ Offset = 61865984,
Description = null, Sequence = 2,
Size = 48234496, Size = 48234496,
Name = null, Start = 120832,
Type = "FAT", Type = "FAT"
Offset = 61865984, }
Length = 94208,
Sequence = 2,
Start = 120832
} }
}, },
new PartitionTest
// NetBSD 1.6
new[]
{ {
new Partition TestFile = "netbsd_1.6.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 10453504, {
Name = null, Length = 20417,
Type = "FAT", Offset = 516096,
Offset = 516096, Sequence = 0,
Length = 20417, Size = 10453504,
Sequence = 0, Start = 1008,
Start = 1008 Type = "FAT"
}, },
new Partition new Partition
{ {
Description = null, Length = 409600,
Size = 209715200, Offset = 11354112,
Name = null, Sequence = 1,
Type = "FAT", Size = 209715200,
Offset = 11354112, Start = 22176,
Length = 409600, Type = "FAT"
Sequence = 1, },
Start = 22176 new Partition
}, {
new Partition Length = 1572864,
{ Offset = 221405184,
Description = null, Sequence = 2,
Size = 805306368, Size = 805306368,
Name = null, Start = 432432,
Type = "FAT", Type = "FAT"
Offset = 221405184, },
Length = 1572864, new Partition
Sequence = 2, {
Start = 432432 Length = 1460266,
}, Offset = 1027031040,
new Partition Sequence = 3,
{ Size = 747656192,
Description = null, Start = 2005920,
Size = 747656192, Type = "4.2BSD Fast File System"
Name = null, },
Type = "4.2BSD Fast File System", new Partition
Offset = 1027031040, {
Length = 1460266, Length = 524288,
Sequence = 3, Offset = 1774854144,
Start = 2005920 Sequence = 4,
}, Size = 268435456,
new Partition Start = 3466512,
{ Type = "4.4LFS"
Description = null, },
Size = 268435456, new Partition
Name = null, {
Type = "4.4LFS", Length = 202624,
Offset = 1774854144, Offset = 2043740160,
Length = 524288, Sequence = 5,
Sequence = 4, Size = 103743488,
Start = 3466512 Start = 3991680,
}, Type = "4.2BSD Fast File System"
new Partition }
{
Description = null,
Size = 103743488,
Name = null,
Type = "4.2BSD Fast File System",
Offset = 2043740160,
Length = 202624,
Sequence = 5,
Start = 3991680
} }
}, },
new PartitionTest
// NetBSD 6.1.5
new[]
{ {
new Partition TestFile = "netbsd_6.1.5.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 10485760, {
Name = null, Length = 20480,
Type = "FAT", Offset = 516096,
Offset = 516096, Sequence = 0,
Length = 20480, Size = 10485760,
Sequence = 0, Start = 1008,
Start = 1008 Type = "FAT"
}, },
new Partition new Partition
{ {
Description = null, Length = 204800,
Size = 104857600, Offset = 11354112,
Name = null, Sequence = 1,
Type = "FAT", Size = 104857600,
Offset = 11354112, Start = 22176,
Length = 204800, Type = "FAT"
Sequence = 1, },
Start = 22176 new Partition
}, {
new Partition Length = 409600,
{ Offset = 116637696,
Description = null, Sequence = 2,
Size = 209715200, Size = 209715200,
Name = null, Start = 227808,
Type = "FAT", Type = "FAT"
Offset = 116637696, },
Length = 409600, new Partition
Sequence = 2, {
Start = 227808 Length = 79632,
}, Offset = 326688768,
new Partition Sequence = 3,
{ Size = 40771584,
Description = null, Start = 638064,
Size = 40771584, Type = "4.2BSD Fast File System"
Name = null, },
Type = "4.2BSD Fast File System", new Partition
Offset = 326688768, {
Length = 79632, Length = 819200,
Sequence = 3, Offset = 367460352,
Start = 638064 Sequence = 4,
}, Size = 419430400,
new Partition Start = 717696,
{ Type = "4.2BSD Fast File System"
Description = null, },
Size = 419430400, new Partition
Name = null, {
Type = "4.2BSD Fast File System", Length = 921600,
Offset = 367460352, Offset = 787562496,
Length = 819200, Sequence = 5,
Sequence = 4, Size = 471859200,
Start = 717696 Start = 1538208,
}, Type = "4.2BSD Fast File System"
new Partition },
{ new Partition
Description = null, {
Size = 471859200, Length = 153600,
Name = null, Offset = 1259790336,
Type = "4.2BSD Fast File System", Sequence = 6,
Offset = 787562496, Size = 78643200,
Length = 921600, Start = 2460528,
Sequence = 5, Type = "Hammer"
Start = 1538208 },
}, new Partition
{
// Type conflicts between DragonFly and NetBSD, really is Apple UFS Length = 194560,
new Partition Offset = 1338753024,
{ Sequence = 7,
Description = null, Size = 99614720,
Size = 78643200, Start = 2614752,
Name = null, Type = "UNIX 7th Edition"
Type = "Hammer", },
Offset = 1259790336, new Partition
Length = 153600, {
Sequence = 6, Length = 477184,
Start = 2460528 Offset = 1438875648,
}, Sequence = 8,
new Partition Size = 244318208,
{ Start = 2810304,
Description = null, Type = "4.4LFS"
Size = 99614720, },
Name = null, new Partition
Type = "UNIX 7th Edition", {
Offset = 1338753024, Length = 906208,
Length = 194560, Offset = 1683505152,
Sequence = 7, Sequence = 9,
Start = 2614752 Size = 463978496,
}, Start = 3288096,
new Partition Type = "Digital LSM Public Region"
{ }
Description = null,
Size = 244318208,
Name = null,
Type = "4.4LFS",
Offset = 1438875648,
Length = 477184,
Sequence = 8,
Start = 2810304
},
// Type conflicts, really is Linux ext2
new Partition
{
Description = null,
Size = 463978496,
Name = null,
Type = "Digital LSM Public Region",
Offset = 1683505152,
Length = 906208,
Sequence = 9,
Start = 3288096
} }
}, },
new PartitionTest
// NetBSD 7.1
new[]
{ {
new Partition TestFile = "netbsd_7.1.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 10321920, {
Name = null, Length = 20160,
Type = "FAT", Offset = 516096,
Offset = 516096, Sequence = 0,
Length = 20160, Size = 10321920,
Sequence = 0, Start = 1008,
Start = 1008 Type = "FAT"
}, },
new Partition new Partition
{ {
Description = null, Length = 204624,
Size = 104767488, Offset = 11354112,
Name = null, Sequence = 1,
Type = "FAT", Size = 104767488,
Offset = 11354112, Start = 22176,
Length = 204624, Type = "FAT"
Sequence = 1, },
Start = 22176 new Partition
}, {
new Partition Length = 409248,
{ Offset = 116637696,
Description = null, Sequence = 2,
Size = 209534976, Size = 209534976,
Name = null, Start = 227808,
Type = "FAT", Type = "FAT"
Offset = 116637696, },
Length = 409248, new Partition
Sequence = 2, {
Start = 227808 Length = 78624,
}, Offset = 326688768,
new Partition Sequence = 3,
{ Size = 40255488,
Description = null, Start = 638064,
Size = 40255488, Type = "4.2BSD Fast File System"
Name = null, },
Type = "4.2BSD Fast File System", new Partition
Offset = 326688768, {
Length = 78624, Length = 818496,
Sequence = 3, Offset = 367460352,
Start = 638064 Sequence = 4,
}, Size = 419069952,
new Partition Start = 717696,
{ Type = "4.2BSD Fast File System"
Description = null, },
Size = 419069952, new Partition
Name = null, {
Type = "4.2BSD Fast File System", Length = 921312,
Offset = 367460352, Offset = 787562496,
Length = 818496, Sequence = 5,
Sequence = 4, Size = 471711744,
Start = 717696 Start = 1538208,
}, Type = "4.2BSD Fast File System"
new Partition },
{ new Partition
Description = null, {
Size = 471711744, Length = 153216,
Name = null, Offset = 1259790336,
Type = "4.2BSD Fast File System", Sequence = 6,
Offset = 787562496, Size = 78446592,
Length = 921312, Start = 2460528,
Sequence = 5, Type = "Hammer"
Start = 1538208 },
}, new Partition
{
// Type conflicts between DragonFly and NetBSD, really is Apple UFS Length = 194544,
new Partition Offset = 1338753024,
{ Sequence = 7,
Description = null, Size = 99606528,
Size = 78446592, Start = 2614752,
Name = null, Type = "UNIX 7th Edition"
Type = "Hammer", },
Offset = 1259790336, new Partition
Length = 153216, {
Sequence = 6, Length = 475776,
Start = 2460528 Offset = 1438875648,
}, Sequence = 8,
new Partition Size = 243597312,
{ Start = 2810304,
Description = null, Type = "4.4LFS"
Size = 99606528, },
Name = null, new Partition
Type = "UNIX 7th Edition", {
Offset = 1338753024, Length = 906192,
Length = 194544, Offset = 1683505152,
Sequence = 7, Sequence = 9,
Start = 2614752 Size = 463970304,
}, Start = 3288096,
new Partition Type = "Digital LSM Public Region"
{ }
Description = null,
Size = 243597312,
Name = null,
Type = "4.4LFS",
Offset = 1438875648,
Length = 475776,
Sequence = 8,
Start = 2810304
},
// Type conflicts, really is Linux ext2
new Partition
{
Description = null,
Size = 463970304,
Name = null,
Type = "Digital LSM Public Region",
Offset = 1683505152,
Length = 906192,
Sequence = 9,
Start = 3288096
} }
} }
}; };

View File

@@ -38,119 +38,110 @@ namespace Aaru.Tests.Partitions
public override string DataFolder => public override string DataFolder =>
Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "GUID Partition Table"); Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "GUID Partition Table");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"linux.aif", "parted.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// Linux
new[]
{ {
new Partition TestFile = "linux.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 10485760, {
Name = "EFI System", Length = 20480,
Type = "EFI System", Name = "EFI System",
Offset = 1048576, Offset = 1048576,
Length = 20480, Sequence = 0,
Sequence = 0, Size = 10485760,
Start = 2048 Start = 2048,
}, Type = "EFI System"
new Partition },
{ new Partition
Description = null, {
Size = 15728640, Length = 30720,
Name = "Microsoft basic data", Name = "Microsoft basic data",
Type = "Microsoft Basic data", Offset = 11534336,
Offset = 11534336, Sequence = 1,
Length = 30720, Size = 15728640,
Sequence = 1, Start = 22528,
Start = 22528 Type = "Microsoft Basic data"
}, },
new Partition new Partition
{ {
Description = null, Length = 40960,
Size = 20971520, Name = "Apple label",
Name = "Apple label", Offset = 27262976,
Type = "Apple Label", Sequence = 2,
Offset = 27262976, Size = 20971520,
Length = 40960, Start = 53248,
Sequence = 2, Type = "Apple Label"
Start = 53248 },
}, new Partition
new Partition {
{ Length = 51200,
Description = null, Name = "Solaris /usr & Mac ZFS",
Size = 26214400, Offset = 48234496,
Name = "Solaris /usr & Mac ZFS", Sequence = 3,
Type = "Solaris /usr or Apple ZFS", Size = 26214400,
Offset = 48234496, Start = 94208,
Length = 51200, Type = "Solaris /usr or Apple ZFS"
Sequence = 3, },
Start = 94208 new Partition
}, {
new Partition Length = 61440,
{ Name = "FreeBSD ZFS",
Description = null, Offset = 74448896,
Size = 31457280, Sequence = 4,
Name = "FreeBSD ZFS", Size = 31457280,
Type = "FreeBSD ZFS", Start = 145408,
Offset = 74448896, Type = "FreeBSD ZFS"
Length = 61440, },
Sequence = 4, new Partition
Start = 145408 {
}, Length = 55263,
new Partition Name = "HP-UX data",
{ Offset = 105906176,
Description = null, Sequence = 5,
Size = 28294656, Size = 28294656,
Name = "HP-UX data", Start = 206848,
Type = "HP-UX Data", Type = "HP-UX Data"
Offset = 105906176, }
Length = 55263,
Sequence = 5,
Start = 206848
} }
}, },
new PartitionTest
// Parted
new[]
{ {
new Partition TestFile = "parted.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 42991616, {
Name = "", Length = 83968,
Type = "Apple HFS", Name = "",
Offset = 1048576, Offset = 1048576,
Length = 83968, Sequence = 0,
Sequence = 0, Size = 42991616,
Start = 2048 Start = 2048,
}, Type = "Apple HFS"
new Partition },
{ new Partition
Description = null, {
Size = 52428800, Length = 102400,
Name = "", Name = "",
Type = "Linux filesystem", Offset = 44040192,
Offset = 44040192, Sequence = 1,
Length = 102400, Size = 52428800,
Sequence = 1, Start = 86016,
Start = 86016 Type = "Linux filesystem"
}, },
new Partition new Partition
{ {
Description = null, Length = 71680,
Size = 36700160, Name = "",
Name = "", Offset = 96468992,
Type = "Microsoft Basic data", Sequence = 2,
Offset = 96468992, Size = 36700160,
Length = 71680, Start = 188416,
Sequence = 2, Type = "Microsoft Basic data"
Start = 188416 }
} }
} }
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -37,59 +37,53 @@ namespace Aaru.Tests.Partitions
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "MINIX"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "MINIX");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"minix_3.1.2a.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// Parted
new[]
{ {
new Partition TestFile = "minix_3.1.2a.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 268369408, {
Name = "MINIX", Length = 524159,
Type = "MINIX", Name = "MINIX",
Offset = 2064896, Offset = 2064896,
Length = 524159, Sequence = 0,
Sequence = 0, Size = 268369408,
Start = 4033 Start = 4033,
}, Type = "MINIX"
new Partition },
{ new Partition
Description = null, {
Size = 270434304, Length = 528192,
Name = "MINIX", Name = "MINIX",
Type = "MINIX", Offset = 270434304,
Offset = 270434304, Sequence = 1,
Length = 528192, Size = 270434304,
Sequence = 1, Start = 528192,
Start = 528192 Type = "MINIX"
}, },
new Partition new Partition
{ {
Description = null, Length = 528192,
Size = 270434304, Name = "MINIX",
Name = "MINIX", Offset = 540868608,
Type = "MINIX", Sequence = 2,
Offset = 540868608, Size = 270434304,
Length = 528192, Start = 1056384,
Sequence = 2, Type = "MINIX"
Start = 1056384 },
}, new Partition
new Partition {
{ Length = 512064,
Description = null, Name = "MINIX",
Size = 262176768, Offset = 811302912,
Name = "MINIX", Sequence = 3,
Type = "MINIX", Size = 262176768,
Offset = 811302912, Start = 1584576,
Length = 512064, Type = "MINIX"
Sequence = 3, }
Start = 1584576
} }
} }
}; };

View File

@@ -37,341 +37,381 @@ namespace Aaru.Tests.Partitions
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "PC-98"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "PC-98");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"msdos330.aif", "msdos330_alt.aif", "msdos500_epson.aif", "msdos500.aif", "msdos620.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// NEC MS-DOS 3.30 (256Mb HDD)
new[]
{ {
new Partition TestFile = "msdos330.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = "MS-DOS 3.30", {
Type = "FAT12", Length = 19536,
Length = 19536, Name = "MS-DOS 3.30",
Sequence = 0, Offset = 0,
Start = 264 Sequence = 0,
}, Size = 0,
new Partition Start = 264,
{ Type = "FAT12"
Description = null, },
Name = "MS-DOS 3.30", new Partition
Type = "FAT12", {
Length = 39336, Length = 39336,
Sequence = 1, Name = "MS-DOS 3.30",
Start = 20064 Offset = 0,
}, Sequence = 1,
new Partition Size = 0,
{ Start = 20064,
Description = null, Type = "FAT12"
Name = "MS-DOS 3.30", },
Type = "FAT16", new Partition
Length = 59136, {
Sequence = 2, Length = 59136,
Start = 59664 Name = "MS-DOS 3.30",
}, Offset = 0,
new Partition Sequence = 2,
{ Size = 0,
Description = null, Start = 59664,
Name = "MS-DOS 3.30", Type = "FAT16"
Type = "FAT16", },
Length = 78936, new Partition
Sequence = 3, {
Start = 119064 Length = 78936,
}, Name = "MS-DOS 3.30",
new Partition Offset = 0,
{ Sequence = 3,
Description = null, Size = 0,
Name = "MS-DOS 3.30", Start = 119064,
Type = "FAT16", Type = "FAT16"
Length = 118536, },
Sequence = 4, new Partition
Start = 198264 {
}, Length = 118536,
new Partition Name = "MS-DOS 3.30",
{ Offset = 0,
Description = null, Sequence = 4,
Name = "MS-DOS 3.30", Size = 0,
Type = "FAT16", Start = 198264,
Length = 197736, Type = "FAT16"
Sequence = 5, },
Start = 317064 new Partition
}, {
new Partition Length = 197736,
{ Name = "MS-DOS 3.30",
Description = null, Offset = 0,
Name = "MS-DOS 3.30", Sequence = 5,
Type = "FAT16", Size = 0,
Length = 237336, Start = 317064,
Sequence = 6, Type = "FAT16"
Start = 515064 },
}, new Partition
new Partition {
{ Length = 237336,
Description = null, Name = "MS-DOS 3.30",
Name = "MS-DOS 3.30", Offset = 0,
Type = "FAT16", Sequence = 6,
Length = 245256, Size = 0,
Sequence = 7, Start = 515064,
Start = 752664 Type = "FAT16"
},
new Partition
{
Length = 245256,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 7,
Size = 0,
Start = 752664,
Type = "FAT16"
}
} }
}, },
new PartitionTest
// NEC MS-DOS 3.30 (80Mb HDD)
new[]
{ {
new Partition TestFile = "msdos330_alt.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = "MS-DOS 3.30", {
Type = "FAT16", Length = 59136,
Length = 59136, Name = "MS-DOS 3.30",
Sequence = 0, Offset = 0,
Start = 264 Sequence = 0,
}, Size = 0,
new Partition Start = 264,
{ Type = "FAT16"
Description = null, },
Name = "MS-DOS 3.30", new Partition
Type = "FAT16", {
Length = 158136, Length = 158136,
Sequence = 1, Name = "MS-DOS 3.30",
Start = 59664 Offset = 0,
}, Sequence = 1,
new Partition Size = 0,
{ Start = 59664,
Description = null, Type = "FAT16"
Name = "MS-DOS 3.30", },
Type = "FAT16", new Partition
Length = 94776, {
Sequence = 2, Length = 94776,
Start = 218064 Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 2,
Size = 0,
Start = 218064,
Type = "FAT16"
}
} }
}, },
new PartitionTest
// Epson MS-DOS 3.30
new[]
{ {
new Partition TestFile = "msdos500_epson.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = "NamenameName", {
Type = "FAT12", Length = 35639,
Length = 35639, Name = "NamenameName",
Sequence = 0, Offset = 0,
Start = 264 Sequence = 0,
}, Size = 0,
new Partition Start = 264,
{ Type = "FAT12"
Description = null, },
Name = "12BitFAT", new Partition
Type = "FAT12", {
Length = 59399, Length = 59399,
Sequence = 1, Name = "12BitFAT",
Start = 35904 Offset = 0,
}, Sequence = 1,
new Partition Size = 0,
{ Start = 35904,
Description = null, Type = "FAT12"
Name = "16BitFAT", },
Type = "FAT16", new Partition
Length = 79199, {
Sequence = 2, Length = 79199,
Start = 95304 Name = "16BitFAT",
}, Offset = 0,
new Partition Sequence = 2,
{ Size = 0,
Description = null, Start = 95304,
Name = "PartLblMaxNameXX", Type = "FAT16"
Type = "FAT16", },
Length = 118799, new Partition
Sequence = 3, {
Start = 174504 Length = 118799,
}, Name = "PartLblMaxNameXX",
new Partition Offset = 0,
{ Sequence = 3,
Description = null, Size = 0,
Name = "BigFAT12", Start = 174504,
Type = "FAT12", Type = "FAT16"
Length = 158399, },
Sequence = 4, new Partition
Start = 293304 {
}, Length = 158399,
new Partition Name = "BigFAT12",
{ Offset = 0,
Description = null, Sequence = 4,
Name = "Lalalalalalalala", Size = 0,
Type = "FAT16", Start = 293304,
Length = 197999, Type = "FAT12"
Sequence = 5, },
Start = 451704 new Partition
}, {
new Partition Length = 197999,
{ Name = "Lalalalalalalala",
Description = null, Offset = 0,
Name = "MS-DOS Ver 5.0", Sequence = 5,
Type = "FAT16", Size = 0,
Length = 237599, Start = 451704,
Sequence = 6, Type = "FAT16"
Start = 649704 },
}, new Partition
new Partition {
{ Length = 237599,
Description = null, Name = "MS-DOS Ver 5.0",
Name = "MS-DOS Ver 5.0", Offset = 0,
Type = "FAT16", Sequence = 6,
Length = 118799, Size = 0,
Sequence = 7, Start = 649704,
Start = 887304 Type = "FAT16"
},
new Partition
{
Length = 118799,
Name = "MS-DOS Ver 5.0",
Offset = 0,
Sequence = 7,
Size = 0,
Start = 887304,
Type = "FAT16"
}
} }
}, },
new PartitionTest
// NEC MS-DOS 5.00
new[]
{ {
new Partition TestFile = "msdos500.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = "MS-DOS 5.00", {
Type = "FAT12", Length = 28512,
Length = 28512, Name = "MS-DOS 5.00",
Sequence = 0, Offset = 0,
Start = 264 Sequence = 0,
}, Size = 0,
new Partition Start = 264,
{ Type = "FAT12"
Description = null, },
Name = "MS-DOS 5.00", new Partition
Type = "FAT16", {
Length = 49104, Length = 49104,
Sequence = 1, Name = "MS-DOS 5.00",
Start = 29040 Offset = 0,
}, Sequence = 1,
new Partition Size = 0,
{ Start = 29040,
Description = null, Type = "FAT16"
Name = "MS-DOS 5.00", },
Type = "FAT16", new Partition
Length = 93984, {
Sequence = 2, Length = 93984,
Start = 78408 Name = "MS-DOS 5.00",
}, Offset = 0,
new Partition Sequence = 2,
{ Size = 0,
Description = null, Start = 78408,
Name = "MS-DOS 5.00", Type = "FAT16"
Type = "FAT16", },
Length = 122760, new Partition
Sequence = 3, {
Start = 172656 Length = 122760,
}, Name = "MS-DOS 5.00",
new Partition Offset = 0,
{ Sequence = 3,
Description = null, Size = 0,
Name = "MS-DOS 5.00", Start = 172656,
Type = "FAT16", Type = "FAT16"
Length = 163680, },
Sequence = 4, new Partition
Start = 295680 {
}, Length = 163680,
new Partition Name = "MS-DOS 5.00",
{ Offset = 0,
Description = null, Sequence = 4,
Name = "MS-DOS 5.00", Size = 0,
Type = "FAT16", Start = 295680,
Length = 204600, Type = "FAT16"
Sequence = 5, },
Start = 459624 new Partition
}, {
new Partition Length = 204600,
{ Name = "MS-DOS 5.00",
Description = null, Offset = 0,
Name = "MS-DOS 5.00", Sequence = 5,
Type = "FAT16", Size = 0,
Length = 204600, Start = 459624,
Sequence = 6, Type = "FAT16"
Start = 664488 },
}, new Partition
new Partition {
{ Length = 204600,
Description = null, Name = "MS-DOS 5.00",
Name = "MS-DOS 5.00", Offset = 0,
Type = "FAT16", Sequence = 6,
Length = 139128, Size = 0,
Sequence = 7, Start = 664488,
Start = 869352 Type = "FAT16"
},
new Partition
{
Length = 139128,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 7,
Size = 0,
Start = 869352,
Type = "FAT16"
}
} }
}, },
new PartitionTest
// NEC MS-DOS 6.20
new[]
{ {
new Partition TestFile = "msdos620.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = "MS-DOS 6.20", {
Type = "FAT16", Length = 61248,
Length = 61248, Name = "MS-DOS 6.20",
Sequence = 0, Offset = 0,
Start = 264 Sequence = 0,
}, Size = 0,
new Partition Start = 264,
{ Type = "FAT16"
Description = null, },
Name = "MS-DOS 6.20", new Partition
Type = "FAT16", {
Length = 81840, Length = 81840,
Sequence = 1, Name = "MS-DOS 6.20",
Start = 61776 Offset = 0,
}, Sequence = 1,
new Partition Size = 0,
{ Start = 61776,
Description = null, Type = "FAT16"
Name = "MS-DOS 6.20", },
Type = "FAT16", new Partition
Length = 122760, {
Sequence = 2, Length = 122760,
Start = 143880 Name = "MS-DOS 6.20",
}, Offset = 0,
new Partition Sequence = 2,
{ Size = 0,
Description = null, Start = 143880,
Name = "MS-DOS 6.20", Type = "FAT16"
Type = "FAT16", },
Length = 163680, new Partition
Sequence = 3, {
Start = 266904 Length = 163680,
}, Name = "MS-DOS 6.20",
new Partition Offset = 0,
{ Sequence = 3,
Description = null, Size = 0,
Name = "MS-DOS 6.20", Start = 266904,
Type = "FAT12", Type = "FAT16"
Length = 20328, },
Sequence = 4, new Partition
Start = 430848 {
}, Length = 20328,
new Partition Name = "MS-DOS 6.20",
{ Offset = 0,
Description = null, Sequence = 4,
Name = "MS-DOS 6.20", Size = 0,
Type = "FAT16", Start = 430848,
Length = 245520, Type = "FAT12"
Sequence = 5, },
Start = 451440 new Partition
}, {
new Partition Length = 245520,
{ Name = "MS-DOS 6.20",
Description = null, Offset = 0,
Name = "MS-DOS 6.20", Sequence = 5,
Type = "FAT16", Size = 0,
Length = 315216, Start = 451440,
Sequence = 6, Type = "FAT16"
Start = 697224 },
new Partition
{
Length = 315216,
Name = "MS-DOS 6.20",
Offset = 0,
Sequence = 6,
Size = 0,
Start = 697224,
Type = "FAT16"
}
} }
} }
}; };

View File

@@ -10,32 +10,31 @@ namespace Aaru.Tests.Partitions
{ {
public abstract class PartitionSchemeTest public abstract class PartitionSchemeTest
{ {
public abstract string[] TestFiles { get; } public abstract string DataFolder { get; }
public abstract Partition[][] Wanted { get; } public abstract PartitionTest[] Tests { get; }
public abstract string DataFolder { get; }
[Test] [Test]
public void Test() public void Test2()
{ {
for(int i = 0; i < TestFiles.Length; i++) foreach(PartitionTest test in Tests)
{ {
string test = TestFiles[i]; string testFile = test.TestFile;
Environment.CurrentDirectory = DataFolder; Environment.CurrentDirectory = DataFolder;
var filtersList = new FiltersList(); var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(test); IFilter inputFilter = filtersList.GetFilter(testFile);
Assert.IsNotNull(inputFilter, $"Filter: {test}"); Assert.IsNotNull(inputFilter, $"Filter: {testFile}");
IMediaImage image = ImageFormat.Detect(inputFilter); IMediaImage image = ImageFormat.Detect(inputFilter);
Assert.IsNotNull(image, $"Image format: {test}"); Assert.IsNotNull(image, $"Image format: {testFile}");
Assert.AreEqual(true, image.Open(inputFilter), $"Cannot open image for {test}"); Assert.AreEqual(true, image.Open(inputFilter), $"Cannot open image for {testFile}");
List<Partition> partitions = Core.Partitions.GetAll(image); List<Partition> partitions = Core.Partitions.GetAll(image);
partitions.Should().BeEquivalentTo(Wanted[i], $"Partitions: {test}"); partitions.Should().BeEquivalentTo(test.Partitions, $"Partitions: {testFile}");
} }
} }
} }

View File

@@ -38,190 +38,177 @@ namespace Aaru.Tests.Partitions
public override string DataFolder => public override string DataFolder =>
Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Rigid Disk Block"); Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Rigid Disk Block");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"amigaos_3.9.aif", "amigaos_4.0.aif", "parted.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// AmigaOS 3.9
new[]
{ {
new Partition TestFile = "amigaos_3.9.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 87392256, {
Name = "UDH0", Length = 170688,
Type = "\"DOS\\0\"", Name = "UDH0",
Offset = 2080768, Offset = 2080768,
Length = 170688, Sequence = 0,
Sequence = 0, Size = 87392256,
Start = 4064 Start = 4064,
}, Type = "\"DOS\\0\""
new Partition },
{ new Partition
Description = null, {
Size = 87392256, Length = 170688,
Name = "UDH1", Name = "UDH1",
Type = "\"DOS\\2\"", Offset = 89473024,
Offset = 89473024, Sequence = 1,
Length = 170688, Size = 87392256,
Sequence = 1, Start = 174752,
Start = 174752 Type = "\"DOS\\2\""
}, },
new Partition new Partition
{ {
Description = null, Length = 170688,
Size = 87392256, Name = "UDH2",
Name = "UDH2", Offset = 176865280,
Type = "\"DOS\\1\"", Sequence = 2,
Offset = 176865280, Size = 87392256,
Length = 170688, Start = 345440,
Sequence = 2, Type = "\"DOS\\1\""
Start = 345440 },
}, new Partition
new Partition {
{ Length = 170688,
Description = null, Name = "UDH3",
Size = 87392256, Offset = 264257536,
Name = "UDH3", Sequence = 3,
Type = "\"DOS\\3\"", Size = 87392256,
Offset = 264257536, Start = 516128,
Length = 170688, Type = "\"DOS\\3\""
Sequence = 3, },
Start = 516128 new Partition
}, {
new Partition Length = 170508,
{ Name = "FAT16",
Description = null, Offset = 351663104,
Size = 87300096, Sequence = 4,
Name = "FAT16", Size = 87300096,
Type = "0x06", Start = 686842,
Offset = 351663104, Type = "0x06"
Length = 170508, },
Sequence = 4, new Partition
Start = 686842 {
}, Length = 166624,
new Partition Name = "UDH5",
{ Offset = 439042048,
Description = null, Sequence = 5,
Size = 85311488, Size = 85311488,
Name = "UDH5", Start = 857504,
Type = "\"RES\\86\"", Type = "\"RES\\86\""
Offset = 439042048, }
Length = 166624,
Sequence = 5,
Start = 857504
} }
}, },
new PartitionTest
// AmigaOS 4.0
new[]
{ {
new Partition TestFile = "amigaos_4.0.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 91455488, {
Name = "DH1", Length = 178624,
Type = "\"DOS\\1\"", Name = "DH1",
Offset = 1048576, Offset = 1048576,
Length = 178624, Sequence = 0,
Sequence = 0, Size = 91455488,
Start = 2048 Start = 2048,
}, Type = "\"DOS\\1\""
new Partition },
{ new Partition
Description = null, {
Size = 76546048, Length = 149504,
Name = "DH2", Name = "DH2",
Type = "\"DOS\\3\"", Offset = 92504064,
Offset = 92504064, Sequence = 1,
Length = 149504, Size = 76546048,
Sequence = 1, Start = 180672,
Start = 180672 Type = "\"DOS\\3\""
}, },
new Partition new Partition
{ {
Description = null, Length = 153792,
Size = 78741504, Name = "DH3",
Name = "DH3", Offset = 169050112,
Type = "\"DOS\\3\"", Sequence = 2,
Offset = 169050112, Size = 78741504,
Length = 153792, Start = 330176,
Sequence = 2, Type = "\"DOS\\3\""
Start = 330176 },
}, new Partition
new Partition {
{ Length = 152384,
Description = null, Name = "DH4",
Size = 78020608, Offset = 247791616,
Name = "DH4", Sequence = 3,
Type = "\"DOS\\7\"", Size = 78020608,
Offset = 247791616, Start = 483968,
Length = 152384, Type = "\"DOS\\7\""
Sequence = 3, },
Start = 483968 new Partition
}, {
new Partition Length = 166016,
{ Name = "DH5",
Description = null, Offset = 325812224,
Size = 85000192, Sequence = 4,
Name = "DH5", Size = 85000192,
Type = "\"SFS\\0\"", Start = 636352,
Offset = 325812224, Type = "\"SFS\\0\""
Length = 166016, },
Sequence = 4, new Partition
Start = 636352 {
}, Length = 221760,
new Partition Name = "DH6",
{ Offset = 410812416,
Description = null, Sequence = 5,
Size = 113541120, Size = 113541120,
Name = "DH6", Start = 802368,
Type = "\"SFS\\2\"", Type = "\"SFS\\2\""
Offset = 410812416, }
Length = 221760,
Sequence = 5,
Start = 802368
} }
}, },
new PartitionTest
// Parted
new[]
{ {
new Partition TestFile = "parted.aif",
Partitions = new[]
{ {
Description = null, new Partition
Size = 8225280, {
Name = "primary", Length = 16065,
Type = "\"\0\0\0\\0\"", Name = "primary",
Offset = 8225280, Offset = 8225280,
Length = 16065, Sequence = 0,
Sequence = 0, Size = 8225280,
Start = 16065 Start = 16065,
}, Type = "\"\0\0\0\\0\""
new Partition },
{ new Partition
Description = null, {
Size = 24675840, Length = 48195,
Name = "name", Name = "name",
Type = "\"FAT\\1\"", Offset = 16450560,
Offset = 16450560, Sequence = 1,
Length = 48195, Size = 24675840,
Sequence = 1, Start = 32130,
Start = 32130 Type = "\"FAT\\1\""
}, },
new Partition new Partition
{ {
Description = null, Length = 176715,
Size = 90478080, Name = "partition",
Name = "partition", Offset = 41126400,
Type = "\"\0\0\0\\0\"", Sequence = 2,
Offset = 41126400, Size = 90478080,
Length = 176715, Start = 80325,
Sequence = 2, Type = "\"\0\0\0\\0\""
Start = 80325 }
} }
} }
}; };

View File

@@ -37,182 +37,182 @@ namespace Aaru.Tests.Partitions
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "SGI"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "SGI");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"linux.aif", "parted.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// Linux's fdisk
new[]
{ {
new Partition TestFile = "linux.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = null, {
Type = "XFS", Length = 40961,
Length = 40961, Offset = 0,
Sequence = 0, Sequence = 0,
Start = 16065 Size = 0,
}, Start = 16065,
new Partition Type = "XFS"
{ },
Description = null, new Partition
Name = null, {
Type = "Linux RAID", Length = 61441,
Length = 61441, Offset = 0,
Sequence = 1, Sequence = 1,
Start = 64260 Size = 0,
}, Start = 64260,
new Partition Type = "Linux RAID"
{ },
Description = null, new Partition
Name = null, {
Type = "Track replacements", Length = 81921,
Length = 81921, Offset = 0,
Sequence = 2, Sequence = 2,
Start = 128520 Size = 0,
}, Start = 128520,
new Partition Type = "Track replacements"
{ },
Description = null, new Partition
Name = null, {
Type = "Sector replacements", Length = 92161,
Length = 92161, Offset = 0,
Sequence = 3, Sequence = 3,
Start = 224910 Size = 0,
}, Start = 224910,
new Partition Type = "Sector replacements"
{ },
Description = null, new Partition
Name = null, {
Type = "Raw data (swap)", Length = 102401,
Length = 102401, Offset = 0,
Sequence = 4, Sequence = 4,
Start = 321300 Size = 0,
}, Start = 321300,
new Partition Type = "Raw data (swap)"
{ },
Description = null, new Partition
Name = null, {
Type = "4.2BSD Fast File System", Length = 30721,
Length = 30721, Offset = 0,
Sequence = 5, Sequence = 5,
Start = 433755 Size = 0,
}, Start = 433755,
new Partition Type = "4.2BSD Fast File System"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX System V", Length = 71681,
Length = 71681, Offset = 0,
Sequence = 6, Sequence = 6,
Start = 465885 Size = 0,
}, Start = 465885,
new Partition Type = "UNIX System V"
{ },
Description = null, new Partition
Name = null, {
Type = "EFS", Length = 10241,
Length = 10241, Offset = 0,
Sequence = 7, Sequence = 7,
Start = 546210 Size = 0,
}, Start = 546210,
new Partition Type = "EFS"
{ },
Description = null, new Partition
Name = null, {
Type = "Logical volume", Length = 122881,
Length = 122881, Offset = 0,
Sequence = 8, Sequence = 8,
Start = 562275 Size = 0,
}, Start = 562275,
new Partition Type = "Logical volume"
{ },
Description = null, new Partition
Name = null, {
Type = "Raw logical volume", Length = 133121,
Length = 133121, Offset = 0,
Sequence = 9, Sequence = 9,
Start = 690795 Size = 0,
}, Start = 690795,
new Partition Type = "Raw logical volume"
{ },
Description = null, new Partition
Name = null, {
Type = "XFS log device", Length = 51201,
Length = 51201, Offset = 0,
Sequence = 10, Sequence = 10,
Start = 835380 Size = 0,
}, Start = 835380,
new Partition Type = "XFS log device"
{ },
Description = null, new Partition
Name = null, {
Type = "Linux swap", Length = 30721,
Length = 30721, Offset = 0,
Sequence = 11, Sequence = 11,
Start = 899640 Size = 0,
}, Start = 899640,
new Partition Type = "Linux swap"
{ },
Description = null, new Partition
Name = null, {
Type = "SGI XVM", Length = 6145,
Length = 6145, Offset = 0,
Sequence = 12, Sequence = 12,
Start = 931770 Size = 0,
}, Start = 931770,
new Partition Type = "SGI XVM"
{ },
Description = null, new Partition
Name = null, {
Type = "Linux", Length = 64260,
Length = 64260, Offset = 0,
Sequence = 13, Sequence = 13,
Start = 947835 Size = 0,
Start = 947835,
Type = "Linux"
}
} }
}, },
new PartitionTest
// GNU Parted
new[]
{ {
new Partition TestFile = "parted.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = null, {
Type = "Raw data (swap)", Length = 22528,
Length = 22528, Offset = 0,
Sequence = 0, Sequence = 0,
Start = 6144 Size = 0,
}, Start = 6144,
new Partition Type = "Raw data (swap)"
{ },
Description = null, new Partition
Name = null, {
Type = "Raw data (swap)", Length = 67584,
Length = 67584, Offset = 0,
Sequence = 1, Sequence = 1,
Start = 30720 Size = 0,
}, Start = 30720,
new Partition Type = "Raw data (swap)"
{ },
Description = null, new Partition
Name = null, {
Type = "Raw data (swap)", Length = 94208,
Length = 94208, Offset = 0,
Sequence = 2, Sequence = 2,
Start = 100352 Size = 0,
}, Start = 100352,
new Partition Type = "Raw data (swap)"
{ },
Description = null, new Partition
Name = null, {
Type = "XFS", Length = 36864,
Length = 36864, Offset = 0,
Sequence = 3, Sequence = 3,
Start = 196608 Size = 0,
Start = 196608,
Type = "XFS"
}
} }
} }
}; };

View File

@@ -38,110 +38,110 @@ namespace Aaru.Tests.Partitions
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Sun"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Sun");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"linux.aif", "parted.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// Linux's fdisk
new[]
{ {
new Partition TestFile = "linux.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = null, {
Type = "Linux", Length = 204800,
Length = 204800, Offset = 0,
Sequence = 0, Sequence = 0,
Start = 0 Size = 0,
}, Start = 0,
new Partition Type = "Linux"
{ },
Description = null, new Partition
Name = null, {
Type = "Sun boot", Length = 102400,
Length = 102400, Offset = 0,
Sequence = 1, Sequence = 1,
Start = 208845 Size = 0,
}, Start = 208845,
new Partition Type = "Sun boot"
{ },
Description = null, new Partition
Name = null, {
Type = "Sun /", Length = 102400,
Length = 102400, Offset = 0,
Sequence = 2, Sequence = 2,
Start = 321300 Size = 0,
}, Start = 321300,
new Partition Type = "Sun /"
{ },
Description = null, new Partition
Name = null, {
Type = "Sun /home", Length = 102400,
Length = 102400, Offset = 0,
Sequence = 3, Sequence = 3,
Start = 433755 Size = 0,
}, Start = 433755,
new Partition Type = "Sun /home"
{ },
Description = null, new Partition
Name = null, {
Type = "Sun swap", Length = 153600,
Length = 153600, Offset = 0,
Sequence = 4, Sequence = 4,
Start = 546210 Size = 0,
}, Start = 546210,
new Partition Type = "Sun swap"
{ },
Description = null, new Partition
Name = null, {
Type = "Sun /usr", Length = 208845,
Length = 208845, Offset = 0,
Sequence = 5, Sequence = 5,
Start = 706860 Size = 0,
}, Start = 706860,
new Partition Type = "Sun /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "Linux swap", Length = 96390,
Length = 96390, Offset = 0,
Sequence = 6, Sequence = 6,
Start = 915705 Size = 0,
Start = 915705,
Type = "Linux swap"
}
} }
}, },
new PartitionTest
// GNU Parted
new[]
{ {
new Partition TestFile = "parted.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = null, {
Type = "Linux", Length = 49152,
Length = 49152, Offset = 0,
Sequence = 0, Sequence = 0,
Start = 0 Size = 0,
}, Start = 0,
new Partition Type = "Linux"
{ },
Description = null, new Partition
Name = null, {
Type = "Linux", Length = 80325,
Length = 80325, Offset = 0,
Sequence = 1, Sequence = 1,
Start = 64260 Size = 0,
}, Start = 64260,
new Partition Type = "Linux"
{ },
Description = null, new Partition
Name = null, {
Type = "Linux", Length = 96390,
Length = 96390, Offset = 0,
Sequence = 2, Sequence = 2,
Start = 144585 Size = 0,
Start = 144585,
Type = "Linux"
}
} }
} }
}; };

View File

@@ -37,159 +37,157 @@ namespace Aaru.Tests.Partitions
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "UNIX VTOC"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "UNIX VTOC");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"att_unix_vtoc.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
// AT&T UNIX System V Release 4 Version 2.1 for 386
new[]
{ {
new Partition TestFile = "att_unix_vtoc.aif",
Partitions = new[]
{ {
Description = null, new Partition
Name = null, {
Type = "UNIX: Boot", Length = 34,
Length = 34, Offset = 0,
Sequence = 0, Sequence = 0,
Start = 1 Size = 0,
}, Start = 1,
new Partition Type = "UNIX: Boot"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: Whole disk", Length = 1023119,
Length = 1023119, Offset = 0,
Sequence = 1, Sequence = 1,
Start = 1 Size = 0,
}, Start = 1,
new Partition Type = "UNIX: Whole disk"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: Stand", Length = 253,
Length = 253, Offset = 0,
Sequence = 2, Sequence = 2,
Start = 63 Size = 0,
}, Start = 63,
new Partition Type = "UNIX: Stand"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 3, Sequence = 3,
Start = 378 Size = 0,
}, Start = 378,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 4, Sequence = 4,
Start = 79002 Size = 0,
}, Start = 79002,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 5, Sequence = 5,
Start = 157626 Size = 0,
}, Start = 157626,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 6, Sequence = 6,
Start = 236250 Size = 0,
}, Start = 236250,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 7, Sequence = 7,
Start = 314874 Size = 0,
}, Start = 314874,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 8, Sequence = 8,
Start = 393498 Size = 0,
}, Start = 393498,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 9, Sequence = 9,
Start = 472122 Size = 0,
}, Start = 472122,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 10, Sequence = 10,
Start = 550746 Size = 0,
}, Start = 550746,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 78624,
Length = 78624, Offset = 0,
Sequence = 11, Sequence = 11,
Start = 629370 Size = 0,
}, Start = 629370,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 76608,
Length = 76608, Offset = 0,
Sequence = 12, Sequence = 12,
Start = 707994 Size = 0,
}, Start = 707994,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 77616,
Length = 77616, Offset = 0,
Sequence = 13, Sequence = 13,
Start = 784602 Size = 0,
}, Start = 784602,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 75600,
Length = 75600, Offset = 0,
Sequence = 14, Sequence = 14,
Start = 862218 Size = 0,
}, Start = 862218,
new Partition Type = "UNIX: /usr"
{ },
Description = null, new Partition
Name = null, {
Type = "UNIX: /usr", Length = 84672,
Length = 84672, Offset = 0,
Sequence = 15, Sequence = 15,
Start = 937818 Size = 0,
Start = 937818,
Type = "UNIX: /usr"
}
} }
} }
}; };

View File

@@ -37,32 +37,31 @@ namespace Aaru.Tests.Partitions
{ {
public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Xbox"); public override string DataFolder => Path.Combine(Consts.TEST_FILES_ROOT, "Partitioning schemes", "Xbox");
public override string[] TestFiles => new[] public override PartitionTest[] Tests => new[]
{ {
"microsoft256mb.aif" new PartitionTest
};
public override Partition[][] Wanted => new[]
{
new[]
{ {
new Partition TestFile = "microsoft256mb.aif",
Partitions = new[]
{ {
Description = "System cache", new Partition
Name = null, {
Type = null, Description = "System cache",
Length = 16376, Length = 16376,
Sequence = 0, Offset = 0,
Start = 0 Sequence = 0,
}, Size = 0,
new Partition Start = 0
{ },
Description = "Data volume", new Partition
Name = null, {
Type = null, Description = "Data volume",
Length = 475144, Length = 475144,
Sequence = 1, Offset = 0,
Start = 16376 Sequence = 1,
Size = 0,
Start = 16376
}
} }
} }
}; };

View File

@@ -65,4 +65,11 @@ namespace Aaru.Tests
public TapeFile[] Files; public TapeFile[] Files;
public TapePartition[] Partitions; public TapePartition[] Partitions;
} }
public class PartitionTest
{
public Partition[] Partitions;
/// <summary>File that contains the partition scheme to test</summary>
public string TestFile;
}
} }