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) TestFile = "linux_ics.aif",
// TODO: Values are incorrect Partitions = new[]
new[]
{ {
new Partition new Partition
{ {
Description = null,
Size = 31457280,
Name = null,
Type = "GEM",
Offset = 512,
Length = 61440, Length = 61440,
Offset = 512,
Sequence = 0, Sequence = 0,
Start = 1 Size = 31457280,
Start = 1,
Type = "GEM"
}, },
new Partition new Partition
{ {
Description = null,
Size = 41943040,
Name = null,
Type = "BGM",
Offset = 31457792,
Length = 81920, Length = 81920,
Offset = 31457792,
Sequence = 1, Sequence = 1,
Start = 61441 Size = 41943040,
Start = 61441,
Type = "BGM"
}, },
new Partition new Partition
{ {
Description = null,
Size = 56402432,
Name = null,
Type = "LNX",
Offset = 73400832,
Length = 110161, Length = 110161,
Offset = 73400832,
Sequence = 2, Sequence = 2,
Start = 143361 Size = 56402432,
Start = 143361,
Type = "LNX"
}, },
new Partition new Partition
{ {
Description = null,
Size = 43212800,
Name = null,
Type = "MAC",
Offset = 129803264,
Length = 84400, Length = 84400,
Offset = 129803264,
Sequence = 3, Sequence = 3,
Start = 253522 Size = 43212800,
Start = 253522,
Type = "MAC"
}
} }
} }
}; };

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

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

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 TestFile = "linux.aif",
new[] Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Size = 10485760,
Name = "EFI System",
Type = "EFI System",
Offset = 1048576,
Length = 20480, Length = 20480,
Name = "EFI System",
Offset = 1048576,
Sequence = 0, Sequence = 0,
Start = 2048 Size = 10485760,
Start = 2048,
Type = "EFI System"
}, },
new Partition new Partition
{ {
Description = null,
Size = 15728640,
Name = "Microsoft basic data",
Type = "Microsoft Basic data",
Offset = 11534336,
Length = 30720, Length = 30720,
Name = "Microsoft basic data",
Offset = 11534336,
Sequence = 1, Sequence = 1,
Start = 22528 Size = 15728640,
Start = 22528,
Type = "Microsoft Basic data"
}, },
new Partition new Partition
{ {
Description = null,
Size = 20971520,
Name = "Apple label",
Type = "Apple Label",
Offset = 27262976,
Length = 40960, Length = 40960,
Name = "Apple label",
Offset = 27262976,
Sequence = 2, Sequence = 2,
Start = 53248 Size = 20971520,
Start = 53248,
Type = "Apple Label"
}, },
new Partition new Partition
{ {
Description = null,
Size = 26214400,
Name = "Solaris /usr & Mac ZFS",
Type = "Solaris /usr or Apple ZFS",
Offset = 48234496,
Length = 51200, Length = 51200,
Name = "Solaris /usr & Mac ZFS",
Offset = 48234496,
Sequence = 3, Sequence = 3,
Start = 94208 Size = 26214400,
Start = 94208,
Type = "Solaris /usr or Apple ZFS"
}, },
new Partition new Partition
{ {
Description = null,
Size = 31457280,
Name = "FreeBSD ZFS",
Type = "FreeBSD ZFS",
Offset = 74448896,
Length = 61440, Length = 61440,
Name = "FreeBSD ZFS",
Offset = 74448896,
Sequence = 4, Sequence = 4,
Start = 145408 Size = 31457280,
Start = 145408,
Type = "FreeBSD ZFS"
}, },
new Partition new Partition
{ {
Description = null,
Size = 28294656,
Name = "HP-UX data",
Type = "HP-UX Data",
Offset = 105906176,
Length = 55263, Length = 55263,
Name = "HP-UX data",
Offset = 105906176,
Sequence = 5, Sequence = 5,
Start = 206848 Size = 28294656,
Start = 206848,
Type = "HP-UX Data"
}
} }
}, },
new PartitionTest
// Parted {
new[] TestFile = "parted.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Size = 42991616,
Name = "",
Type = "Apple HFS",
Offset = 1048576,
Length = 83968, Length = 83968,
Name = "",
Offset = 1048576,
Sequence = 0, Sequence = 0,
Start = 2048 Size = 42991616,
Start = 2048,
Type = "Apple HFS"
}, },
new Partition new Partition
{ {
Description = null,
Size = 52428800,
Name = "",
Type = "Linux filesystem",
Offset = 44040192,
Length = 102400, Length = 102400,
Name = "",
Offset = 44040192,
Sequence = 1, Sequence = 1,
Start = 86016 Size = 52428800,
Start = 86016,
Type = "Linux filesystem"
}, },
new Partition new Partition
{ {
Description = null,
Size = 36700160,
Name = "",
Type = "Microsoft Basic data",
Offset = 96468992,
Length = 71680, Length = 71680,
Name = "",
Offset = 96468992,
Sequence = 2, Sequence = 2,
Start = 188416 Size = 36700160,
Start = 188416,
Type = "Microsoft Basic data"
}
} }
} }
}; };

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 TestFile = "minix_3.1.2a.aif",
new[] Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Size = 268369408,
Name = "MINIX",
Type = "MINIX",
Offset = 2064896,
Length = 524159, Length = 524159,
Name = "MINIX",
Offset = 2064896,
Sequence = 0, Sequence = 0,
Start = 4033 Size = 268369408,
Start = 4033,
Type = "MINIX"
}, },
new Partition new Partition
{ {
Description = null, Length = 528192,
Size = 270434304,
Name = "MINIX", Name = "MINIX",
Type = "MINIX",
Offset = 270434304, Offset = 270434304,
Length = 528192,
Sequence = 1, Sequence = 1,
Start = 528192
},
new Partition
{
Description = null,
Size = 270434304, Size = 270434304,
Name = "MINIX", Start = 528192,
Type = "MINIX", Type = "MINIX"
Offset = 540868608,
Length = 528192,
Sequence = 2,
Start = 1056384
}, },
new Partition new Partition
{ {
Description = null, Length = 528192,
Size = 262176768,
Name = "MINIX", Name = "MINIX",
Type = "MINIX", Offset = 540868608,
Offset = 811302912, Sequence = 2,
Size = 270434304,
Start = 1056384,
Type = "MINIX"
},
new Partition
{
Length = 512064, Length = 512064,
Name = "MINIX",
Offset = 811302912,
Sequence = 3, Sequence = 3,
Start = 1584576 Size = 262176768,
Start = 1584576,
Type = "MINIX"
}
} }
} }
}; };

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) TestFile = "msdos330.aif",
new[] Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT12",
Length = 19536, Length = 19536,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 264 Size = 0,
Start = 264,
Type = "FAT12"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT12",
Length = 39336, Length = 39336,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 20064 Size = 0,
Start = 20064,
Type = "FAT12"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT16",
Length = 59136, Length = 59136,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 59664 Size = 0,
Start = 59664,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT16",
Length = 78936, Length = 78936,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 3, Sequence = 3,
Start = 119064 Size = 0,
Start = 119064,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT16",
Length = 118536, Length = 118536,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 4, Sequence = 4,
Start = 198264 Size = 0,
Start = 198264,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT16",
Length = 197736, Length = 197736,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 5, Sequence = 5,
Start = 317064 Size = 0,
Start = 317064,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT16",
Length = 237336, Length = 237336,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 6, Sequence = 6,
Start = 515064 Size = 0,
Start = 515064,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT16",
Length = 245256, Length = 245256,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 7, Sequence = 7,
Start = 752664 Size = 0,
Start = 752664,
Type = "FAT16"
}
} }
}, },
new PartitionTest
// NEC MS-DOS 3.30 (80Mb HDD) {
new[] TestFile = "msdos330_alt.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT16",
Length = 59136, Length = 59136,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 264 Size = 0,
Start = 264,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 3.30",
Type = "FAT16",
Length = 158136, Length = 158136,
Sequence = 1,
Start = 59664
},
new Partition
{
Description = null,
Name = "MS-DOS 3.30", Name = "MS-DOS 3.30",
Type = "FAT16", Offset = 0,
Sequence = 1,
Size = 0,
Start = 59664,
Type = "FAT16"
},
new Partition
{
Length = 94776, Length = 94776,
Name = "MS-DOS 3.30",
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 218064 Size = 0,
Start = 218064,
Type = "FAT16"
}
} }
}, },
new PartitionTest
// Epson MS-DOS 3.30 {
new[] TestFile = "msdos500_epson.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = "NamenameName",
Type = "FAT12",
Length = 35639, Length = 35639,
Name = "NamenameName",
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 264 Size = 0,
Start = 264,
Type = "FAT12"
}, },
new Partition new Partition
{ {
Description = null,
Name = "12BitFAT",
Type = "FAT12",
Length = 59399, Length = 59399,
Name = "12BitFAT",
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 35904 Size = 0,
Start = 35904,
Type = "FAT12"
}, },
new Partition new Partition
{ {
Description = null,
Name = "16BitFAT",
Type = "FAT16",
Length = 79199, Length = 79199,
Name = "16BitFAT",
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 95304 Size = 0,
Start = 95304,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null, Length = 118799,
Name = "PartLblMaxNameXX", Name = "PartLblMaxNameXX",
Type = "FAT16", Offset = 0,
Length = 118799,
Sequence = 3, Sequence = 3,
Start = 174504 Size = 0,
Start = 174504,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "BigFAT12",
Type = "FAT12",
Length = 158399, Length = 158399,
Name = "BigFAT12",
Offset = 0,
Sequence = 4, Sequence = 4,
Start = 293304 Size = 0,
Start = 293304,
Type = "FAT12"
}, },
new Partition new Partition
{ {
Description = null,
Name = "Lalalalalalalala",
Type = "FAT16",
Length = 197999, Length = 197999,
Name = "Lalalalalalalala",
Offset = 0,
Sequence = 5, Sequence = 5,
Start = 451704 Size = 0,
Start = 451704,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS Ver 5.0",
Type = "FAT16",
Length = 237599, Length = 237599,
Sequence = 6,
Start = 649704
},
new Partition
{
Description = null,
Name = "MS-DOS Ver 5.0", Name = "MS-DOS Ver 5.0",
Type = "FAT16", Offset = 0,
Sequence = 6,
Size = 0,
Start = 649704,
Type = "FAT16"
},
new Partition
{
Length = 118799, Length = 118799,
Name = "MS-DOS Ver 5.0",
Offset = 0,
Sequence = 7, Sequence = 7,
Start = 887304 Size = 0,
Start = 887304,
Type = "FAT16"
}
} }
}, },
new PartitionTest
// NEC MS-DOS 5.00 {
new[] TestFile = "msdos500.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 5.00",
Type = "FAT12",
Length = 28512, Length = 28512,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 264 Size = 0,
Start = 264,
Type = "FAT12"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 5.00",
Type = "FAT16",
Length = 49104, Length = 49104,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 29040 Size = 0,
Start = 29040,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 5.00",
Type = "FAT16",
Length = 93984, Length = 93984,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 78408 Size = 0,
Start = 78408,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 5.00",
Type = "FAT16",
Length = 122760, Length = 122760,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 3, Sequence = 3,
Start = 172656 Size = 0,
Start = 172656,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 5.00",
Type = "FAT16",
Length = 163680, Length = 163680,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 4, Sequence = 4,
Start = 295680 Size = 0,
Start = 295680,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 5.00",
Type = "FAT16",
Length = 204600, Length = 204600,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 5, Sequence = 5,
Start = 459624 Size = 0,
Start = 459624,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 5.00",
Type = "FAT16",
Length = 204600, Length = 204600,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 6, Sequence = 6,
Start = 664488 Size = 0,
Start = 664488,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 5.00",
Type = "FAT16",
Length = 139128, Length = 139128,
Name = "MS-DOS 5.00",
Offset = 0,
Sequence = 7, Sequence = 7,
Start = 869352 Size = 0,
Start = 869352,
Type = "FAT16"
}
} }
}, },
new PartitionTest
// NEC MS-DOS 6.20 {
new[] TestFile = "msdos620.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 6.20",
Type = "FAT16",
Length = 61248, Length = 61248,
Name = "MS-DOS 6.20",
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 264 Size = 0,
Start = 264,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 6.20",
Type = "FAT16",
Length = 81840, Length = 81840,
Name = "MS-DOS 6.20",
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 61776 Size = 0,
Start = 61776,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 6.20",
Type = "FAT16",
Length = 122760, Length = 122760,
Name = "MS-DOS 6.20",
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 143880 Size = 0,
Start = 143880,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 6.20",
Type = "FAT16",
Length = 163680, Length = 163680,
Name = "MS-DOS 6.20",
Offset = 0,
Sequence = 3, Sequence = 3,
Start = 266904 Size = 0,
Start = 266904,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 6.20",
Type = "FAT12",
Length = 20328, Length = 20328,
Name = "MS-DOS 6.20",
Offset = 0,
Sequence = 4, Sequence = 4,
Start = 430848 Size = 0,
Start = 430848,
Type = "FAT12"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 6.20",
Type = "FAT16",
Length = 245520, Length = 245520,
Name = "MS-DOS 6.20",
Offset = 0,
Sequence = 5, Sequence = 5,
Start = 451440 Size = 0,
Start = 451440,
Type = "FAT16"
}, },
new Partition new Partition
{ {
Description = null,
Name = "MS-DOS 6.20",
Type = "FAT16",
Length = 315216, Length = 315216,
Name = "MS-DOS 6.20",
Offset = 0,
Sequence = 6, Sequence = 6,
Start = 697224 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 Partition[][] Wanted { get; }
public abstract string DataFolder { get; } public abstract string DataFolder { get; }
public abstract PartitionTest[] Tests { 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 TestFile = "amigaos_3.9.aif",
new[] Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null, Length = 170688,
Size = 87392256,
Name = "UDH0", Name = "UDH0",
Type = "\"DOS\\0\"",
Offset = 2080768, Offset = 2080768,
Length = 170688,
Sequence = 0, Sequence = 0,
Start = 4064 Size = 87392256,
Start = 4064,
Type = "\"DOS\\0\""
}, },
new Partition new Partition
{ {
Description = null, Length = 170688,
Size = 87392256,
Name = "UDH1", Name = "UDH1",
Type = "\"DOS\\2\"",
Offset = 89473024, Offset = 89473024,
Length = 170688,
Sequence = 1, Sequence = 1,
Start = 174752 Size = 87392256,
Start = 174752,
Type = "\"DOS\\2\""
}, },
new Partition new Partition
{ {
Description = null, Length = 170688,
Size = 87392256,
Name = "UDH2", Name = "UDH2",
Type = "\"DOS\\1\"",
Offset = 176865280, Offset = 176865280,
Length = 170688,
Sequence = 2, Sequence = 2,
Start = 345440
},
new Partition
{
Description = null,
Size = 87392256, Size = 87392256,
Name = "UDH3", Start = 345440,
Type = "\"DOS\\3\"", Type = "\"DOS\\1\""
Offset = 264257536, },
new Partition
{
Length = 170688, Length = 170688,
Name = "UDH3",
Offset = 264257536,
Sequence = 3, Sequence = 3,
Start = 516128 Size = 87392256,
Start = 516128,
Type = "\"DOS\\3\""
}, },
new Partition new Partition
{ {
Description = null,
Size = 87300096,
Name = "FAT16",
Type = "0x06",
Offset = 351663104,
Length = 170508, Length = 170508,
Name = "FAT16",
Offset = 351663104,
Sequence = 4, Sequence = 4,
Start = 686842 Size = 87300096,
Start = 686842,
Type = "0x06"
}, },
new Partition new Partition
{ {
Description = null,
Size = 85311488,
Name = "UDH5",
Type = "\"RES\\86\"",
Offset = 439042048,
Length = 166624, Length = 166624,
Name = "UDH5",
Offset = 439042048,
Sequence = 5, Sequence = 5,
Start = 857504 Size = 85311488,
Start = 857504,
Type = "\"RES\\86\""
}
} }
}, },
new PartitionTest
// AmigaOS 4.0 {
new[] TestFile = "amigaos_4.0.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Size = 91455488,
Name = "DH1",
Type = "\"DOS\\1\"",
Offset = 1048576,
Length = 178624, Length = 178624,
Name = "DH1",
Offset = 1048576,
Sequence = 0, Sequence = 0,
Start = 2048 Size = 91455488,
Start = 2048,
Type = "\"DOS\\1\""
}, },
new Partition new Partition
{ {
Description = null,
Size = 76546048,
Name = "DH2",
Type = "\"DOS\\3\"",
Offset = 92504064,
Length = 149504, Length = 149504,
Name = "DH2",
Offset = 92504064,
Sequence = 1, Sequence = 1,
Start = 180672 Size = 76546048,
Start = 180672,
Type = "\"DOS\\3\""
}, },
new Partition new Partition
{ {
Description = null,
Size = 78741504,
Name = "DH3",
Type = "\"DOS\\3\"",
Offset = 169050112,
Length = 153792, Length = 153792,
Name = "DH3",
Offset = 169050112,
Sequence = 2, Sequence = 2,
Start = 330176 Size = 78741504,
Start = 330176,
Type = "\"DOS\\3\""
}, },
new Partition new Partition
{ {
Description = null,
Size = 78020608,
Name = "DH4",
Type = "\"DOS\\7\"",
Offset = 247791616,
Length = 152384, Length = 152384,
Name = "DH4",
Offset = 247791616,
Sequence = 3, Sequence = 3,
Start = 483968 Size = 78020608,
Start = 483968,
Type = "\"DOS\\7\""
}, },
new Partition new Partition
{ {
Description = null,
Size = 85000192,
Name = "DH5",
Type = "\"SFS\\0\"",
Offset = 325812224,
Length = 166016, Length = 166016,
Name = "DH5",
Offset = 325812224,
Sequence = 4, Sequence = 4,
Start = 636352 Size = 85000192,
Start = 636352,
Type = "\"SFS\\0\""
}, },
new Partition new Partition
{ {
Description = null,
Size = 113541120,
Name = "DH6",
Type = "\"SFS\\2\"",
Offset = 410812416,
Length = 221760, Length = 221760,
Name = "DH6",
Offset = 410812416,
Sequence = 5, Sequence = 5,
Start = 802368 Size = 113541120,
Start = 802368,
Type = "\"SFS\\2\""
}
} }
}, },
new PartitionTest
// Parted {
new[] TestFile = "parted.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Size = 8225280,
Name = "primary",
Type = "\"\0\0\0\\0\"",
Offset = 8225280,
Length = 16065, Length = 16065,
Name = "primary",
Offset = 8225280,
Sequence = 0, Sequence = 0,
Start = 16065 Size = 8225280,
Start = 16065,
Type = "\"\0\0\0\\0\""
}, },
new Partition new Partition
{ {
Description = null,
Size = 24675840,
Name = "name",
Type = "\"FAT\\1\"",
Offset = 16450560,
Length = 48195, Length = 48195,
Name = "name",
Offset = 16450560,
Sequence = 1, Sequence = 1,
Start = 32130 Size = 24675840,
Start = 32130,
Type = "\"FAT\\1\""
}, },
new Partition new Partition
{ {
Description = null,
Size = 90478080,
Name = "partition",
Type = "\"\0\0\0\\0\"",
Offset = 41126400,
Length = 176715, Length = 176715,
Name = "partition",
Offset = 41126400,
Sequence = 2, Sequence = 2,
Start = 80325 Size = 90478080,
Start = 80325,
Type = "\"\0\0\0\\0\""
}
} }
} }
}; };

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 TestFile = "linux.aif",
new[] Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "XFS",
Length = 40961, Length = 40961,
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 16065 Size = 0,
Start = 16065,
Type = "XFS"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Linux RAID",
Length = 61441, Length = 61441,
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 64260 Size = 0,
Start = 64260,
Type = "Linux RAID"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Track replacements",
Length = 81921, Length = 81921,
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 128520 Size = 0,
Start = 128520,
Type = "Track replacements"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Sector replacements",
Length = 92161, Length = 92161,
Offset = 0,
Sequence = 3, Sequence = 3,
Start = 224910 Size = 0,
Start = 224910,
Type = "Sector replacements"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Raw data (swap)",
Length = 102401, Length = 102401,
Offset = 0,
Sequence = 4, Sequence = 4,
Start = 321300 Size = 0,
Start = 321300,
Type = "Raw data (swap)"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "4.2BSD Fast File System",
Length = 30721, Length = 30721,
Offset = 0,
Sequence = 5, Sequence = 5,
Start = 433755 Size = 0,
Start = 433755,
Type = "4.2BSD Fast File System"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX System V",
Length = 71681, Length = 71681,
Offset = 0,
Sequence = 6, Sequence = 6,
Start = 465885 Size = 0,
Start = 465885,
Type = "UNIX System V"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "EFS",
Length = 10241, Length = 10241,
Offset = 0,
Sequence = 7, Sequence = 7,
Start = 546210 Size = 0,
Start = 546210,
Type = "EFS"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Logical volume",
Length = 122881, Length = 122881,
Offset = 0,
Sequence = 8, Sequence = 8,
Start = 562275 Size = 0,
Start = 562275,
Type = "Logical volume"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Raw logical volume",
Length = 133121, Length = 133121,
Offset = 0,
Sequence = 9, Sequence = 9,
Start = 690795 Size = 0,
Start = 690795,
Type = "Raw logical volume"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "XFS log device",
Length = 51201, Length = 51201,
Offset = 0,
Sequence = 10, Sequence = 10,
Start = 835380 Size = 0,
Start = 835380,
Type = "XFS log device"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Linux swap",
Length = 30721, Length = 30721,
Offset = 0,
Sequence = 11, Sequence = 11,
Start = 899640 Size = 0,
Start = 899640,
Type = "Linux swap"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "SGI XVM",
Length = 6145, Length = 6145,
Offset = 0,
Sequence = 12, Sequence = 12,
Start = 931770 Size = 0,
Start = 931770,
Type = "SGI XVM"
}, },
new Partition new Partition
{ {
Description = null,
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[] TestFile = "parted.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Raw data (swap)",
Length = 22528, Length = 22528,
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 6144 Size = 0,
Start = 6144,
Type = "Raw data (swap)"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Raw data (swap)",
Length = 67584, Length = 67584,
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 30720 Size = 0,
Start = 30720,
Type = "Raw data (swap)"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Raw data (swap)",
Length = 94208, Length = 94208,
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 100352 Size = 0,
Start = 100352,
Type = "Raw data (swap)"
}, },
new Partition new Partition
{ {
Description = null,
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 TestFile = "linux.aif",
new[] Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Linux",
Length = 204800, Length = 204800,
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 0 Size = 0,
Start = 0,
Type = "Linux"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Sun boot",
Length = 102400, Length = 102400,
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 208845 Size = 0,
Start = 208845,
Type = "Sun boot"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Sun /",
Length = 102400, Length = 102400,
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 321300 Size = 0,
Start = 321300,
Type = "Sun /"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Sun /home",
Length = 102400, Length = 102400,
Offset = 0,
Sequence = 3, Sequence = 3,
Start = 433755 Size = 0,
Start = 433755,
Type = "Sun /home"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Sun swap",
Length = 153600, Length = 153600,
Offset = 0,
Sequence = 4, Sequence = 4,
Start = 546210 Size = 0,
Start = 546210,
Type = "Sun swap"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Sun /usr",
Length = 208845, Length = 208845,
Offset = 0,
Sequence = 5, Sequence = 5,
Start = 706860 Size = 0,
Start = 706860,
Type = "Sun /usr"
}, },
new Partition new Partition
{ {
Description = null,
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[] TestFile = "parted.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Linux",
Length = 49152, Length = 49152,
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 0 Size = 0,
Start = 0,
Type = "Linux"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "Linux",
Length = 80325, Length = 80325,
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 64260 Size = 0,
Start = 64260,
Type = "Linux"
}, },
new Partition new Partition
{ {
Description = null,
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 TestFile = "att_unix_vtoc.aif",
new[] Partitions = new[]
{ {
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: Boot",
Length = 34, Length = 34,
Offset = 0,
Sequence = 0, Sequence = 0,
Start = 1 Size = 0,
Start = 1,
Type = "UNIX: Boot"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: Whole disk",
Length = 1023119, Length = 1023119,
Offset = 0,
Sequence = 1, Sequence = 1,
Start = 1 Size = 0,
Start = 1,
Type = "UNIX: Whole disk"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: Stand",
Length = 253, Length = 253,
Offset = 0,
Sequence = 2, Sequence = 2,
Start = 63 Size = 0,
Start = 63,
Type = "UNIX: Stand"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 3, Sequence = 3,
Start = 378 Size = 0,
Start = 378,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 4, Sequence = 4,
Start = 79002 Size = 0,
Start = 79002,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 5, Sequence = 5,
Start = 157626 Size = 0,
Start = 157626,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 6, Sequence = 6,
Start = 236250 Size = 0,
Start = 236250,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 7, Sequence = 7,
Start = 314874 Size = 0,
Start = 314874,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 8, Sequence = 8,
Start = 393498 Size = 0,
Start = 393498,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 9, Sequence = 9,
Start = 472122 Size = 0,
Start = 472122,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 10, Sequence = 10,
Start = 550746 Size = 0,
Start = 550746,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 78624, Length = 78624,
Offset = 0,
Sequence = 11, Sequence = 11,
Start = 629370 Size = 0,
Start = 629370,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 76608, Length = 76608,
Offset = 0,
Sequence = 12, Sequence = 12,
Start = 707994 Size = 0,
Start = 707994,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 77616, Length = 77616,
Offset = 0,
Sequence = 13, Sequence = 13,
Start = 784602 Size = 0,
Start = 784602,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
Name = null,
Type = "UNIX: /usr",
Length = 75600, Length = 75600,
Offset = 0,
Sequence = 14, Sequence = 14,
Start = 862218 Size = 0,
Start = 862218,
Type = "UNIX: /usr"
}, },
new Partition new Partition
{ {
Description = null,
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,34 +37,33 @@ 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[] TestFile = "microsoft256mb.aif",
Partitions = new[]
{ {
new Partition new Partition
{ {
Description = "System cache", Description = "System cache",
Name = null,
Type = null,
Length = 16376, Length = 16376,
Offset = 0,
Sequence = 0, Sequence = 0,
Size = 0,
Start = 0 Start = 0
}, },
new Partition new Partition
{ {
Description = "Data volume", Description = "Data volume",
Name = null,
Type = null,
Length = 475144, Length = 475144,
Offset = 0,
Sequence = 1, Sequence = 1,
Size = 0,
Start = 16376 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;
}
} }