mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Join filesystem tests to a single file per filesystem, instead of per partition.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
// Copyright © 2011-2018 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.DiscImages;
|
||||
@@ -89,4 +90,103 @@ namespace DiscImageChef.Tests.Filesystems
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestFixture]
|
||||
public class UnixbfsMbr
|
||||
{
|
||||
readonly string[] testfiles = {"linux.vdi.lz"};
|
||||
|
||||
readonly ulong[] sectors = {262144};
|
||||
|
||||
readonly uint[] sectorsize = {512};
|
||||
|
||||
readonly long[] clusters = {260096};
|
||||
|
||||
readonly int[] clustersize = {512};
|
||||
|
||||
readonly string[] volumename = {"Label"};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_mbr", testfiles[i]);
|
||||
Filter filter = new LZip();
|
||||
filter.Open(location);
|
||||
ImagePlugin image = new Vdi();
|
||||
Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Filesystem fs = new BFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
if(partitions[j].Type == "0x83")
|
||||
{
|
||||
part = j;
|
||||
break;
|
||||
}
|
||||
|
||||
Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
|
||||
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
|
||||
fs.GetInformation(image, partitions[part], out _);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual("BFS", fs.XmlFSType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
[TestFixture]
|
||||
public class UnixbfsRdb
|
||||
{
|
||||
readonly string[] testfiles = {"amix.vdi.lz"};
|
||||
|
||||
readonly ulong[] sectors = {1024128};
|
||||
|
||||
readonly uint[] sectorsize = {512};
|
||||
|
||||
readonly long[] clusters = {65024};
|
||||
|
||||
readonly int[] clustersize = {2048};
|
||||
|
||||
readonly string[] volumename = {null};
|
||||
|
||||
readonly string[] volumeserial = {"UNKNOWN"};
|
||||
|
||||
readonly string[] type = {"UFS"};
|
||||
|
||||
[Test]
|
||||
public void Test()
|
||||
{
|
||||
for(int i = 0; i < testfiles.Length; i++)
|
||||
{
|
||||
string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "unixbfs_rdb", testfiles[i]);
|
||||
Filter filter = new LZip();
|
||||
filter.Open(location);
|
||||
ImagePlugin image = new Vdi();
|
||||
Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]);
|
||||
Assert.AreEqual(sectors[i], image.ImageInfo.Sectors, testfiles[i]);
|
||||
Assert.AreEqual(sectorsize[i], image.ImageInfo.SectorSize, testfiles[i]);
|
||||
List<Partition> partitions = Core.Partitions.GetAll(image);
|
||||
Filesystem fs = new BFS();
|
||||
int part = -1;
|
||||
for(int j = 0; j < partitions.Count; j++)
|
||||
if(partitions[j].Type == "\"UNI\\0\"")
|
||||
{
|
||||
part = j;
|
||||
break;
|
||||
}
|
||||
|
||||
Assert.AreNotEqual(-1, part, $"Partition not found on {testfiles[i]}");
|
||||
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
|
||||
fs.GetInformation(image, partitions[part], out _);
|
||||
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
|
||||
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
|
||||
Assert.AreEqual(type[i], fs.XmlFSType.Type, testfiles[i]);
|
||||
Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]);
|
||||
Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user