Split filesystem tests by partitioning type.

This commit is contained in:
2021-03-01 00:52:03 +00:00
parent 58345a08d4
commit f8ff3ab519
96 changed files with 8605 additions and 5700 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />

View File

@@ -1,351 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AFFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class Affs
{
readonly string[] _testFiles =
{
"amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD
};
readonly ulong[] _sectors =
{
1760, 1760
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
1760, 1760
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A5D9FAE2", "A5DA0CC9"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new AmigaDOSPlugin();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class AffsMbr
{
readonly string[] _testFiles =
{
"aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
408240, 408240
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A582DCA4", "A582BC91"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x2D" ||
partitions[j].Type == "0x2E")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class AffsMbrRdb
{
readonly string[] _testFiles =
{
"aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
406224, 406224
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A58348CE", "A5833CD0"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems",
"Amiga Fast File System (MBR+RDB)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"DOS\\1\"" ||
partitions[j].Type == "\"DOS\\3\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class AffsRdb
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif", "amigaos_3.9_intl.aif", "aros.aif", "aros_intl.aif", "amigaos_4.0.aif",
"amigaos_4.0_intl.aif", "amigaos_4.0_cache.aif"
};
readonly ulong[] _sectors =
{
1024128, 1024128, 409600, 409600, 1024128, 1024128, 1024128
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
510032, 510032, 407232, 407232, 511040, 511040, 511040
};
readonly int[] _clusterSize =
{
1024, 1024, 512, 512, 1024, 1024, 1024
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label"
};
readonly string[] _volumeSerial =
{
"A56D0F5C", "A56D049C", "A58307A9", "A58304BE", "A56CC7EE", "A56CDDC4", "A56CC133"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"DOS\\1\"" ||
partitions[j].Type == "\"DOS\\3\"" ||
partitions[j].Type == "\"DOS\\5\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,116 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AFFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.AFFS
{
[TestFixture]
public class MBR_RDB
{
readonly string[] _testFiles =
{
"aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
406224, 406224
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A58348CE", "A5833CD0"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems",
"Amiga Fast File System (MBR+RDB)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"DOS\\1\"" ||
partitions[j].Type == "\"DOS\\3\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,116 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AFFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.AFFS
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
408240, 408240
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A582DCA4", "A582BC91"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x2D" ||
partitions[j].Type == "0x2E")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AFFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.AFFS
{
[TestFixture]
public class RDB
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif", "amigaos_3.9_intl.aif", "aros.aif", "aros_intl.aif", "amigaos_4.0.aif",
"amigaos_4.0_intl.aif", "amigaos_4.0_cache.aif"
};
readonly ulong[] _sectors =
{
1024128, 1024128, 409600, 409600, 1024128, 1024128, 1024128
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
510032, 510032, 407232, 407232, 511040, 511040, 511040
};
readonly int[] _clusterSize =
{
1024, 1024, 512, 512, 1024, 1024, 1024
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label"
};
readonly string[] _volumeSerial =
{
"A56D0F5C", "A56D049C", "A58307A9", "A58304BE", "A56CC7EE", "A56CDDC4", "A56CC133"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"DOS\\1\"" ||
partitions[j].Type == "\"DOS\\3\"" ||
partitions[j].Type == "\"DOS\\5\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,116 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AFFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.AFFS
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD
};
readonly ulong[] _sectors =
{
1760, 1760
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
1760, 1760
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A5D9FAE2", "A5DA0CC9"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Fast File System",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new AmigaDOSPlugin();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -35,10 +35,10 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.AFFS2
{
[TestFixture]
public class Affs2Rdb
public class RDB
{
readonly string[] _testFiles =
{

View File

@@ -1,347 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AOFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class Aofs
{
readonly string[] _testFiles =
{
"amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD
};
readonly ulong[] _sectors =
{
1760, 1760
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
1760, 1760
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A5D9FE71", "A5D9F14F"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new AmigaDOSPlugin();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class AofsMbr
{
readonly string[] _testFiles =
{
"aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
408240, 408240
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A582C90C", "A582CE0D"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x2C")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class AofsMbrRdb
{
readonly string[] _testFiles =
{
"aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
406224, 406224
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A5833C5B", "A5833085"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (MBR+RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"DOS\\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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class AofsRdb
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif", "amigaos_3.9_intl.aif", "aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
1024128, 1024128, 409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
510032, 510032, 407232, 407232
};
readonly int[] _clusterSize =
{
1024, 1024, 512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A56D13BB", "A56D0415", "A582F3A0", "A5830B06"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"DOS\\0\"" ||
partitions[j].Type == "\"DOS\\2\"" ||
partitions[j].Type == "\"DOS\\4\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,115 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AOFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.AOFS
{
[TestFixture]
public class MBR_RDB
{
readonly string[] _testFiles =
{
"aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
406224, 406224
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A5833C5B", "A5833085"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (MBR+RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"DOS\\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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,115 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AOFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.AOFS
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
408240, 408240
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A582C90C", "A582CE0D"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x2C")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,117 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AOFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.AOFS
{
[TestFixture]
public class RDB
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif", "amigaos_3.9_intl.aif", "aros.aif", "aros_intl.aif"
};
readonly ulong[] _sectors =
{
1024128, 1024128, 409600, 409600
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
510032, 510032, 407232, 407232
};
readonly int[] _clusterSize =
{
1024, 1024, 512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A56D13BB", "A56D0415", "A582F3A0", "A5830B06"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AmigaDOSPlugin();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"DOS\\0\"" ||
partitions[j].Type == "\"DOS\\2\"" ||
partitions[j].Type == "\"DOS\\4\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,116 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AOFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.AOFS
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"amigaos_3.9.adf.lz", "amigaos_3.9_intl.adf.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.CBM_AMIGA_35_DD, MediaType.CBM_AMIGA_35_DD
};
readonly ulong[] _sectors =
{
1760, 1760
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
1760, 1760
};
readonly int[] _clusterSize =
{
512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
"A5D9FE71", "A5D9F14F"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Amiga Old File System",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new AmigaDOSPlugin();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BeFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.BeFS
{
[TestFixture]
public class APM
{
readonly string[] _testFiles =
{
"beos_r3.1.aif", "beos_r4.5.aif"
};
readonly ulong[] _sectors =
{
1572864, 1572864
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
786336, 786336
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null
};
readonly string[] _oemId =
{
null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (APM)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.BeFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Be_BFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -1,355 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BeFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class BeFs
{
readonly string[] _testFiles =
{
"beos_r3.1.img.lz", "beos_r4.5.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.DOS_35_HD, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
2880, 2880
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
1440, 1440
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null
};
readonly string[] _oemId =
{
null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System", _testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new BeFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class BeFsApm
{
readonly string[] _testFiles =
{
"beos_r3.1.aif", "beos_r4.5.aif"
};
readonly ulong[] _sectors =
{
1572864, 1572864
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
786336, 786336
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null
};
readonly string[] _oemId =
{
null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (APM)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new BeFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Be_BFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class BeFsGpt
{
readonly string[] _testFiles =
{
"haiku_hrev51259.aif"
};
readonly ulong[] _sectors =
{
8388608
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
2096640
};
readonly int[] _clusterSize =
{
2048
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (GPT)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new BeFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Haiku BFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class BeFsMbr
{
readonly string[] _testFiles =
{
"beos_r3.1.aif", "beos_r4.5.aif", "haiku_hrev51259.aif", "syllable_0.6.7.aif"
};
readonly ulong[] _sectors =
{
1572864, 1572864, 8388608, 2097152
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
786400, 785232, 2096640, 524272
};
readonly int[] _clusterSize =
{
1024, 1024, 2048, 2048
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new BeFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0xEB")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,114 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BeFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.BeFS
{
[TestFixture]
public class GPT
{
readonly string[] _testFiles =
{
"haiku_hrev51259.aif"
};
readonly ulong[] _sectors =
{
8388608
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
2096640
};
readonly int[] _clusterSize =
{
2048
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (GPT)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.BeFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Haiku BFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,114 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BeFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.BeFS
{
[TestFixture]
public class BeFsMbr
{
readonly string[] _testFiles =
{
"beos_r3.1.aif", "beos_r4.5.aif", "haiku_hrev51259.aif", "syllable_0.6.7.aif"
};
readonly ulong[] _sectors =
{
1572864, 1572864, 8388608, 2097152
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
786400, 785232, 2096640, 524272
};
readonly int[] _clusterSize =
{
1024, 1024, 2048, 2048
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.BeFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0xEB")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BeFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.BeFS
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"beos_r3.1.img.lz", "beos_r4.5.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.DOS_35_HD, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
2880, 2880
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
1440, 1440
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _volumeName =
{
"Volume label", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null
};
readonly string[] _oemId =
{
null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Be File System", _testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.BeFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("BeFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : COHERENT.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.COHERENT
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"coherentunix_4.2.10.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
510048
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"Coherent fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "COHERENT filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x09")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -26,7 +26,6 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
@@ -35,7 +34,7 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.COHERENT
{
[TestFixture]
public class Coherent
@@ -120,85 +119,4 @@ namespace Aaru.Tests.Filesystems
}
}
}
[TestFixture]
public class CoherentMbr
{
readonly string[] _testFiles =
{
"coherentunix_4.2.10.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
510048
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"Coherent fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "COHERENT filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x09")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,118 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : DTFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.DTFS
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
510048
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"DTFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -26,7 +26,6 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
@@ -35,10 +34,10 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.DTFS
{
[TestFixture]
public class Dtfs
public class Whole
{
readonly string[] _testFiles =
{
@@ -119,83 +118,4 @@ namespace Aaru.Tests.Filesystems
}
}
}
[TestFixture]
public class DtfsMbr
{
readonly string[] _testFiles =
{
"scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
510048
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"DTFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "DTFS (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,118 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : EAFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.EAFS
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
510048
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"Extended Acer Fast Filesystem"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -26,7 +26,6 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
@@ -35,10 +34,10 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.EAFS
{
[TestFixture]
public class Eafs
public class Whole
{
readonly string[] _testFiles =
{
@@ -120,83 +119,4 @@ namespace Aaru.Tests.Filesystems
}
}
}
[TestFixture]
public class EafsMbr
{
readonly string[] _testFiles =
{
"scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
510048
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"Extended Acer Fast Filesystem"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "EAFS (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT12.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT12
{
[TestFixture]
public class APM
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
16384
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
4076
};
readonly int[] _clusterSize =
{
2048
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"32181F09"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "DOS_FAT_12")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT12.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT12
{
[TestFixture]
public class GPT
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
16384
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
4076
};
readonly int[] _clusterSize =
{
2048
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"66901F1B"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,122 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT12.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT12
{
[TestFixture]
public class Human
{
readonly string[] _testFiles =
{
"diska.aif", "diskb.aif"
};
readonly MediaType[] _mediaTypes =
{
MediaType.SHARP_525, MediaType.SHARP_525
};
readonly ulong[] _sectors =
{
1232, 1232
};
readonly uint[] _sectorSize =
{
1024, 1024
};
readonly long[] _clusters =
{
1232, 1232
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
null, null
};
readonly string[] _oemId =
{
"Hudson soft 2.00", "Hudson soft 2.00"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (Human68K)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new FAT();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,150 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT12.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT12
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"compaqmsdos331.aif", "drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif",
"drdos_7.02.aif", "drdos_7.03.aif", "drdos_8.00.aif", "msdos331.aif", "msdos401.aif", "msdos500.aif",
"msdos600.aif", "msdos620rc1.aif", "msdos620.aif", "msdos621.aif", "msdos622.aif", "msdos710.aif",
"novelldos_7.00.aif", "opendos_7.01.aif", "pcdos2000.aif", "pcdos200.aif", "pcdos210.aif", "pcdos300.aif",
"pcdos310.aif", "pcdos330.aif", "pcdos400.aif", "pcdos500.aif", "pcdos502.aif", "pcdos610.aif",
"pcdos630.aif", "toshibamsdos330.aif", "toshibamsdos401.aif", "msos2_1.21.aif", "msos2_1.30.1.aif",
"multiuserdos_7.22r4.aif", "os2_1.20.aif", "os2_1.30.aif", "os2_6.307.aif", "os2_6.514.aif",
"os2_6.617.aif", "os2_8.162.aif", "os2_9.023.aif", "ecs.aif", "macosx_10.11.aif", "win10.aif",
"win2000.aif", "win95.aif", "win95osr2.1.aif", "win95osr2.5.aif", "win95osr2.aif", "win98.aif",
"win98se.aif", "winme.aif", "winnt_3.10.aif", "winnt_3.50.aif", "winnt_3.51.aif", "winnt_4.00.aif",
"winvista.aif", "beos_r4.5.aif", "linux.aif", "freebsd_6.1.aif", "freebsd_7.0.aif", "freebsd_8.2.aif"
};
readonly ulong[] _sectors =
{
8192, 30720, 28672, 28672, 28672, 28672, 28672, 28672, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
16384, 28672, 28672, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 8192,
8192, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1000, 3654, 3520, 3520, 3520, 3520, 3520, 3520, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 2008, 3520,
3520, 4024, 4031, 4031, 4024, 4024, 4024, 4024, 4024, 4024, 4024, 4024, 1000, 1000, 2008, 2008, 2008, 2008,
2008, 2008, 2008, 2008, 2008, 2008, 1890, 4079, 3552, 4088, 2008, 2008, 2008, 2008, 2044, 2044, 2044, 4016,
2044, 2044, 4016, 3072, 2040, 3584, 2044, 2044, 2044
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 2048, 2048, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048,
4096, 4096, 2048, 2048, 4096, 2048, 4096, 4096, 4096
};
readonly string[] _volumeName =
{
null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, null, null,
null, null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null, null, "1BFB1273", null, "407D1907", "345D18FB", "332518F4", "395718E9",
"076718EF", "1371181B", "23281816", "2F781809", null, null, "294F100F", null, null, null, null, null,
"0F340FE4", "1A5E0FF9", "1D2F0FFE", "076C1004", "2C481009", null, "3C2319E8", "66CC3C15", "66A54C15", null,
"5C578015", "5B845015", "5C4BF015", "E6B5F414", "E6B15414", "E6A41414", "E6A39414", "E6B0B814", "26A21EF4",
"74F4921D", "C4B64D11", "29200D0C", "234F0DE4", "074C0DFC", "33640D18", "0E121460", "094C0EED", "38310F02",
"50489A1B", "2CE52101", "94313E7E", "BC184FE6", "BAD08A1E", "00000000", "8D418102", "8FC80E0A", "34FA0E0B",
"02140E0B"
};
readonly string[] _oemId =
{
"IBM 3.3", "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3",
"MSDOS4.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3",
"IBM 3.3", "IBM 7.0", "IBM 2.0", "IBM 2.0", "IBM 3.0", "IBM 3.1", "IBM 3.3", "IBM 4.0", "IBM 5.0",
"IBM 5.0", "IBM 6.0", "IBM 6.0", "T V3.30 ", "T V4.00 ", "IBM 10.2", "IBM 10.2", "IBM 3.2", "IBM 10.2",
"IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", "MSDOS5.0",
"MSDOS5.0", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0",
"MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "BSD 4.4", "BSD 4.4", "BSD4.4 "
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]);
fs.GetInformation(image, partitions[0], out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -26,7 +26,6 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
@@ -35,10 +34,10 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.FAT12
{
[TestFixture]
public class Fat12
public class Whole
{
readonly string[] _testFiles =
{
@@ -2622,359 +2621,4 @@ namespace Aaru.Tests.Filesystems
}
}
}
[TestFixture]
public class Fat12Apm
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
16384
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
4076
};
readonly int[] _clusterSize =
{
2048
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"32181F09"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "DOS_FAT_12")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat12Gpt
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
16384
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
4076
};
readonly int[] _clusterSize =
{
2048
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"66901F1B"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat12Mbr
{
readonly string[] _testFiles =
{
"compaqmsdos331.aif", "drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif",
"drdos_7.02.aif", "drdos_7.03.aif", "drdos_8.00.aif", "msdos331.aif", "msdos401.aif", "msdos500.aif",
"msdos600.aif", "msdos620rc1.aif", "msdos620.aif", "msdos621.aif", "msdos622.aif", "msdos710.aif",
"novelldos_7.00.aif", "opendos_7.01.aif", "pcdos2000.aif", "pcdos200.aif", "pcdos210.aif", "pcdos300.aif",
"pcdos310.aif", "pcdos330.aif", "pcdos400.aif", "pcdos500.aif", "pcdos502.aif", "pcdos610.aif",
"pcdos630.aif", "toshibamsdos330.aif", "toshibamsdos401.aif", "msos2_1.21.aif", "msos2_1.30.1.aif",
"multiuserdos_7.22r4.aif", "os2_1.20.aif", "os2_1.30.aif", "os2_6.307.aif", "os2_6.514.aif",
"os2_6.617.aif", "os2_8.162.aif", "os2_9.023.aif", "ecs.aif", "macosx_10.11.aif", "win10.aif",
"win2000.aif", "win95.aif", "win95osr2.1.aif", "win95osr2.5.aif", "win95osr2.aif", "win98.aif",
"win98se.aif", "winme.aif", "winnt_3.10.aif", "winnt_3.50.aif", "winnt_3.51.aif", "winnt_4.00.aif",
"winvista.aif", "beos_r4.5.aif", "linux.aif", "freebsd_6.1.aif", "freebsd_7.0.aif", "freebsd_8.2.aif"
};
readonly ulong[] _sectors =
{
8192, 30720, 28672, 28672, 28672, 28672, 28672, 28672, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
16384, 28672, 28672, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 8192,
8192, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384, 16384,
16384, 16384
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1000, 3654, 3520, 3520, 3520, 3520, 3520, 3520, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 2008, 3520,
3520, 4024, 4031, 4031, 4024, 4024, 4024, 4024, 4024, 4024, 4024, 4024, 1000, 1000, 2008, 2008, 2008, 2008,
2008, 2008, 2008, 2008, 2008, 2008, 1890, 4079, 3552, 4088, 2008, 2008, 2008, 2008, 2044, 2044, 2044, 4016,
2044, 2044, 4016, 3072, 2040, 3584, 2044, 2044, 2044
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048, 2048, 2048, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 2048,
4096, 4096, 2048, 2048, 4096, 2048, 4096, 4096, 4096
};
readonly string[] _volumeName =
{
null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", null, null, null,
null, null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null, null, "1BFB1273", null, "407D1907", "345D18FB", "332518F4", "395718E9",
"076718EF", "1371181B", "23281816", "2F781809", null, null, "294F100F", null, null, null, null, null,
"0F340FE4", "1A5E0FF9", "1D2F0FFE", "076C1004", "2C481009", null, "3C2319E8", "66CC3C15", "66A54C15", null,
"5C578015", "5B845015", "5C4BF015", "E6B5F414", "E6B15414", "E6A41414", "E6A39414", "E6B0B814", "26A21EF4",
"74F4921D", "C4B64D11", "29200D0C", "234F0DE4", "074C0DFC", "33640D18", "0E121460", "094C0EED", "38310F02",
"50489A1B", "2CE52101", "94313E7E", "BC184FE6", "BAD08A1E", "00000000", "8D418102", "8FC80E0A", "34FA0E0B",
"02140E0B"
};
readonly string[] _oemId =
{
"IBM 3.3", "IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3",
"MSDOS4.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3",
"IBM 3.3", "IBM 7.0", "IBM 2.0", "IBM 2.0", "IBM 3.0", "IBM 3.1", "IBM 3.3", "IBM 4.0", "IBM 5.0",
"IBM 5.0", "IBM 6.0", "IBM 6.0", "T V3.30 ", "T V4.00 ", "IBM 10.2", "IBM 10.2", "IBM 3.2", "IBM 10.2",
"IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4", "MSDOS5.0",
"MSDOS5.0", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSDOS5.0",
"MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "BSD 4.4", "BSD 4.4", "BSD4.4 "
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]);
fs.GetInformation(image, partitions[0], out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat12Human
{
readonly string[] _testFiles =
{
"diska.aif", "diskb.aif"
};
readonly MediaType[] _mediaTypes =
{
MediaType.SHARP_525, MediaType.SHARP_525
};
readonly ulong[] _sectors =
{
1232, 1232
};
readonly uint[] _sectorSize =
{
1024, 1024
};
readonly long[] _clusters =
{
1232, 1232
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
null, null
};
readonly string[] _oemId =
{
"Hudson soft 2.00", "Hudson soft 2.00"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT12 (Human68K)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new FAT();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT12", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT16.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT16
{
[TestFixture]
public class APM
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
63995
};
readonly int[] _clusterSize =
{
8192
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"063D1F09"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "DOS_FAT_16")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT16.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT16
{
[TestFixture]
public class Atari
{
readonly string[] _testFiles =
{
"tos_1.04.aif", "tos_1.04_small.aif"
};
readonly ulong[] _sectors =
{
81920, 16384
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
10239, 8191
};
readonly int[] _clusterSize =
{
4096, 1024
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
"BA9831", "2019E1"
};
readonly string[] _oemId =
{
null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Atari)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "GEM" ||
partitions[j].Type == "BGM")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -1,677 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT16.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class Fat16
{
readonly string[] _testFiles =
{
// MS-DOS 3.30A
"msdos_3.30A_mf2ed.img.lz",
// MS-DOS 3.31
"msdos_3.31_mf2ed.img.lz"
};
readonly MediaType[] _mediaTypes =
{
// MS-DOS 3.30A
MediaType.DOS_35_ED,
// MS-DOS 3.31
MediaType.DOS_35_ED
};
readonly ulong[] _sectors =
{
// MS-DOS 3.30A
5760,
// MS-DOS 3.31
5760
};
readonly uint[] _sectorSize =
{
// MS-DOS 3.30A
512,
// MS-DOS 3.31
512
};
readonly long[] _clusters =
{
// MS-DOS 3.30A
5760,
// MS-DOS 3.31
5760
};
readonly int[] _clusterSize =
{
// MS-DOS 3.30A
512,
// MS-DOS 3.31
512
};
readonly string[] _volumeName =
{
// MS-DOS 3.30A
null,
// MS-DOS 3.31
null
};
readonly string[] _volumeSerial =
{
// MS-DOS 3.30A
null,
// MS-DOS 3.31
null
};
readonly string[] _oemId =
{
// MS-DOS 3.30A
"MSDOS3.3",
// MS-DOS 3.31
"IBM 3.3"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16", _testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new FAT();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat16Apm
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
63995
};
readonly int[] _clusterSize =
{
8192
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"063D1F09"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "DOS_FAT_16")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat16Atari
{
readonly string[] _testFiles =
{
"tos_1.04.aif", "tos_1.04_small.aif"
};
readonly ulong[] _sectors =
{
81920, 16384
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
10239, 8191
};
readonly int[] _clusterSize =
{
4096, 1024
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
"BA9831", "2019E1"
};
readonly string[] _oemId =
{
null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Atari)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "GEM" ||
partitions[j].Type == "BGM")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat16Gpt
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
63995
};
readonly int[] _clusterSize =
{
8192
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"2E8A1F1B"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat16Mbr
{
readonly string[] _testFiles =
{
"drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif", "drdos_7.02.aif", "drdos_7.03.aif",
"drdos_8.00.aif", "msdos331.aif", "msdos401.aif", "msdos500.aif", "msdos600.aif", "msdos620rc1.aif",
"msdos620.aif", "msdos621.aif", "msdos622.aif", "msdos710.aif", "novelldos_7.00.aif", "opendos_7.01.aif",
"pcdos2000.aif", "pcdos400.aif", "pcdos500.aif", "pcdos502.aif", "pcdos610.aif", "pcdos630.aif",
"msos2_1.21.aif", "msos2_1.30.1.aif", "multiuserdos_7.22r4.aif", "os2_1.20.aif", "os2_1.30.aif",
"os2_6.307.aif", "os2_6.514.aif", "os2_6.617.aif", "os2_8.162.aif", "os2_9.023.aif", "ecs.aif",
"macosx_10.11.aif", "win10.aif", "win2000.aif", "win95osr2.1.aif", "win95osr2.5.aif", "win95osr2.aif",
"win95.aif", "win98se.aif", "win98.aif", "winme.aif", "winnt_3.10.aif", "winnt_3.50.aif", "winnt_3.51.aif",
"winnt_4.00.aif", "winvista.aif", "beos_r4.5.aif", "linux.aif", "amigaos_3.9.aif", "aros.aif",
"freebsd_6.1.aif", "freebsd_7.0.aif", "freebsd_8.2.aif", "macos_7.5.3.aif", "macos_7.5.aif",
"macos_7.6.aif", "macos_8.0.aif", "ecs20_fstester.aif", "linux_2.2_umsdos16_flashdrive.aif",
"linux_4.19_fat16_msdos_flashdrive.aif", "linux_4.19_vfat16_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 262144, 1024128, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512
};
readonly long[] _clusters =
{
63882, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941,
63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941,
63941, 63941, 63941, 63941, 63882, 63992, 63864, 63252, 63941, 63941, 63941, 63941, 63998, 63998, 63998,
63941, 63998, 63998, 63941, 63616, 63996, 65024, 63941, 63882, 63998, 63998, 31999, 63941, 63941, 63941,
63941, 63882, 63941, 63872, 63872
};
readonly int[] _clusterSize =
{
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 2048, 8192, 8192,
8192, 8192, 16384, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192
};
readonly string[] _volumeName =
{
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "NO NAME", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUME LABE", "DICSETTER",
"DICSETTER", "DICSETTER"
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null, "1BFB0748", null, "217B1909", "0C6D18FC", "382B18F4", "3E2018E9",
"0D2418EF", "195A181B", "27761816", "356B1809", null, null, "2272100F", "07280FE1", "1F630FF9", "18340FFE",
"3F3F1003", "273D1009", "9C162C15", "9C1E2C15", null, "5BE66015", "5BE43015", "5BEAC015", "E6B18414",
"E6C63414", "1C069414", "1C059414", "1BE5B814", "3EF71EF4", "DAF97911", "305637BD", "275B0DE4", "09650DFC",
"38270D18", "2E620D0C", "0B4F0EED", "0E122464", "3B5F0F02", "C84CB6F2", "D0E9AD4E", "C039A2EC", "501F9FA6",
"9AAA4216", "00000000", "A132D985", "374D3BD1", "52BEA34A", "3CF10E0D", "C6C30E0D", "44770E0D", "27761816",
"27761816", "27761816", "27761816", "66AAF014", "5CC78D47", "A552A493", "FCC308A7"
};
readonly string[] _oemId =
{
"IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", "MSDOS4.0",
"MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", "IBM 3.3",
"IBM 7.0", "IBM 4.0", "IBM 5.0", "IBM 5.0", "IBM 6.0", "IBM 6.0", "IBM 10.2", "IBM 10.2", "IBM 3.2",
"IBM 10.2", "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4",
"MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1",
"MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "CDP 5.0", "MSWIN4.1",
"BSD 4.4", "BSD 4.4", "BSD4.4 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "IBM 4.50", null,
"mkfs.fat", "mkfs.fat"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]);
fs.GetInformation(image, partitions[0], out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat16Rdb
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif"
};
readonly ulong[] _sectors =
{
1024128
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
63689
};
readonly int[] _clusterSize =
{
8192
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"374D40D1"
};
readonly string[] _oemId =
{
"CDP 5.0"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (RDB)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x06")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat16Human
{
readonly string[] _testFiles =
{
"sasidisk.aif", "scsidisk.aif"
};
readonly ulong[] _sectors =
{
162096, 204800
};
readonly uint[] _sectorSize =
{
256, 512
};
readonly long[] _clusters =
{
40510, 102367
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
null, null
};
readonly string[] _oemId =
{
"Hudson soft 2.00", " Hero Soft V1.10"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Human68K)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Human68k")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT16.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT16
{
[TestFixture]
public class GPT
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
63995
};
readonly int[] _clusterSize =
{
8192
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"2E8A1F1B"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,121 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT16.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT16
{
[TestFixture]
public class Human
{
readonly string[] _testFiles =
{
"sasidisk.aif", "scsidisk.aif"
};
readonly ulong[] _sectors =
{
162096, 204800
};
readonly uint[] _sectorSize =
{
256, 512
};
readonly long[] _clusters =
{
40510, 102367
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
null, null
};
readonly string[] _oemId =
{
"Hudson soft 2.00", " Hero Soft V1.10"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (Human68K)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Human68k")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,156 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT16.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT16
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"drdos_3.40.aif", "drdos_3.41.aif", "drdos_5.00.aif", "drdos_6.00.aif", "drdos_7.02.aif", "drdos_7.03.aif",
"drdos_8.00.aif", "msdos331.aif", "msdos401.aif", "msdos500.aif", "msdos600.aif", "msdos620rc1.aif",
"msdos620.aif", "msdos621.aif", "msdos622.aif", "msdos710.aif", "novelldos_7.00.aif", "opendos_7.01.aif",
"pcdos2000.aif", "pcdos400.aif", "pcdos500.aif", "pcdos502.aif", "pcdos610.aif", "pcdos630.aif",
"msos2_1.21.aif", "msos2_1.30.1.aif", "multiuserdos_7.22r4.aif", "os2_1.20.aif", "os2_1.30.aif",
"os2_6.307.aif", "os2_6.514.aif", "os2_6.617.aif", "os2_8.162.aif", "os2_9.023.aif", "ecs.aif",
"macosx_10.11.aif", "win10.aif", "win2000.aif", "win95osr2.1.aif", "win95osr2.5.aif", "win95osr2.aif",
"win95.aif", "win98se.aif", "win98.aif", "winme.aif", "winnt_3.10.aif", "winnt_3.50.aif", "winnt_3.51.aif",
"winnt_4.00.aif", "winvista.aif", "beos_r4.5.aif", "linux.aif", "amigaos_3.9.aif", "aros.aif",
"freebsd_6.1.aif", "freebsd_7.0.aif", "freebsd_8.2.aif", "macos_7.5.3.aif", "macos_7.5.aif",
"macos_7.6.aif", "macos_8.0.aif", "ecs20_fstester.aif", "linux_2.2_umsdos16_flashdrive.aif",
"linux_4.19_fat16_msdos_flashdrive.aif", "linux_4.19_vfat16_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 262144, 1024128, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512
};
readonly long[] _clusters =
{
63882, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941,
63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941, 63941,
63941, 63941, 63941, 63941, 63882, 63992, 63864, 63252, 63941, 63941, 63941, 63941, 63998, 63998, 63998,
63941, 63998, 63998, 63941, 63616, 63996, 65024, 63941, 63882, 63998, 63998, 31999, 63941, 63941, 63941,
63941, 63882, 63941, 63872, 63872
};
readonly int[] _clusterSize =
{
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 2048, 8192, 8192,
8192, 8192, 16384, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192
};
readonly string[] _volumeName =
{
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
null, "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "NO NAME", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VolumeLabel", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL",
"VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUMELABEL", "VOLUME LABE", "DICSETTER",
"DICSETTER", "DICSETTER"
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null, "1BFB0748", null, "217B1909", "0C6D18FC", "382B18F4", "3E2018E9",
"0D2418EF", "195A181B", "27761816", "356B1809", null, null, "2272100F", "07280FE1", "1F630FF9", "18340FFE",
"3F3F1003", "273D1009", "9C162C15", "9C1E2C15", null, "5BE66015", "5BE43015", "5BEAC015", "E6B18414",
"E6C63414", "1C069414", "1C059414", "1BE5B814", "3EF71EF4", "DAF97911", "305637BD", "275B0DE4", "09650DFC",
"38270D18", "2E620D0C", "0B4F0EED", "0E122464", "3B5F0F02", "C84CB6F2", "D0E9AD4E", "C039A2EC", "501F9FA6",
"9AAA4216", "00000000", "A132D985", "374D3BD1", "52BEA34A", "3CF10E0D", "C6C30E0D", "44770E0D", "27761816",
"27761816", "27761816", "27761816", "66AAF014", "5CC78D47", "A552A493", "FCC308A7"
};
readonly string[] _oemId =
{
"IBM 3.2", "IBM 3.2", "IBM 3.3", "IBM 3.3", "IBM 3.3", "DRDOS 7", "IBM 5.0", "IBM 3.3", "MSDOS4.0",
"MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "IBM 3.3", "IBM 3.3",
"IBM 7.0", "IBM 4.0", "IBM 5.0", "IBM 5.0", "IBM 6.0", "IBM 6.0", "IBM 10.2", "IBM 10.2", "IBM 3.2",
"IBM 10.2", "IBM 10.2", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 20.0", "IBM 4.50", "BSD 4.4",
"MSDOS5.0", "MSDOS5.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1", "MSWIN4.0", "MSWIN4.1", "MSWIN4.1", "MSWIN4.1",
"MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "MSDOS5.0", "BeOS ", "mkfs.fat", "CDP 5.0", "MSWIN4.1",
"BSD 4.4", "BSD 4.4", "BSD4.4 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "PCX 2.0 ", "IBM 4.50", null,
"mkfs.fat", "mkfs.fat"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, partitions[0]), _testFiles[i]);
fs.GetInformation(image, partitions[0], out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT16.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT16
{
[TestFixture]
public class RDB
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif"
};
readonly ulong[] _sectors =
{
1024128
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
63689
};
readonly int[] _clusterSize =
{
8192
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"374D40D1"
};
readonly string[] _oemId =
{
"CDP 5.0"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16 (RDB)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x06")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,156 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT16.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT16
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
// MS-DOS 3.30A
"msdos_3.30A_mf2ed.img.lz",
// MS-DOS 3.31
"msdos_3.31_mf2ed.img.lz"
};
readonly MediaType[] _mediaTypes =
{
// MS-DOS 3.30A
MediaType.DOS_35_ED,
// MS-DOS 3.31
MediaType.DOS_35_ED
};
readonly ulong[] _sectors =
{
// MS-DOS 3.30A
5760,
// MS-DOS 3.31
5760
};
readonly uint[] _sectorSize =
{
// MS-DOS 3.30A
512,
// MS-DOS 3.31
512
};
readonly long[] _clusters =
{
// MS-DOS 3.30A
5760,
// MS-DOS 3.31
5760
};
readonly int[] _clusterSize =
{
// MS-DOS 3.30A
512,
// MS-DOS 3.31
512
};
readonly string[] _volumeName =
{
// MS-DOS 3.30A
null,
// MS-DOS 3.31
null
};
readonly string[] _volumeSerial =
{
// MS-DOS 3.30A
null,
// MS-DOS 3.31
null
};
readonly string[] _oemId =
{
// MS-DOS 3.30A
"MSDOS3.3",
// MS-DOS 3.31
"IBM 3.3"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT16", _testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new FAT();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT16", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT32.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT32
{
[TestFixture]
public class APM
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
4194304
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
524278
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"35BD1F0A"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "DOS_FAT_32")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,119 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FAT32.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.FAT32
{
[TestFixture]
public class GPT
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
4194304
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
523775
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"7ABE1F1B"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -35,170 +35,10 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.FAT32
{
[TestFixture]
public class Fat32Apm
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
4194304
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
524278
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"35BD1F0A"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "DOS_FAT_32")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat32Gpt
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
4194304
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
523775
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
"VOLUMELABEL"
};
readonly string[] _volumeSerial =
{
"7ABE1F1B"
};
readonly string[] _oemId =
{
"BSD 4.4"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "FAT32 (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new FAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("FAT32", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class Fat32Mbr
public class MBR
{
readonly string[] _testFiles =
{

View File

@@ -0,0 +1,254 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FATX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.IO;
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
namespace Aaru.Tests.Filesystems.FATX
{
[TestFixture]
public class Xbox
{
[SetUp]
public void Init()
{
_location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Xbox FAT16", "le", "fatx.img.lz");
_filter = new LZip();
_filter.Open(_location);
_image = new ZZZRawImage();
Assert.AreEqual(true, _image.Open(_filter));
_fs = new XboxFatPlugin();
_wholePart = new Partition
{
Name = "Whole device",
Length = _image.Info.Sectors,
Size = _image.Info.Sectors * _image.Info.SectorSize
};
Errno error = _fs.Mount(_image, _wholePart, null, null, null);
Assert.AreEqual(Errno.NoError, error);
}
[TearDown]
public void Destroy()
{
_fs?.Unmount();
_fs = null;
}
string _location;
IFilter _filter;
IMediaImage _image;
IReadOnlyFilesystem _fs;
Partition _wholePart;
[Test]
public void Information()
{
Assert.AreEqual(62720, _image.Info.Sectors);
Assert.AreEqual(1960, _fs.XmlFsType.Clusters);
Assert.AreEqual(16384, _fs.XmlFsType.ClusterSize);
Assert.AreEqual("FATX filesystem", _fs.XmlFsType.Type);
Assert.AreEqual("Volume láb€l", _fs.XmlFsType.VolumeName);
Assert.AreEqual("4639B7D0", _fs.XmlFsType.VolumeSerial);
}
[Test]
public void MapBlock()
{
Errno error = _fs.MapBlock("49470015", 0, out long block);
Assert.AreEqual(Errno.IsDirectory, error);
error = _fs.MapBlock("49470015/TitleImage", 0, out block);
Assert.AreEqual(Errno.NoSuchFile, error);
error = _fs.MapBlock("49470015/TitleImage.xbx", 0, out block);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(80, block);
error = _fs.MapBlock("49470015/7AC2FE88C908/savedata.dat", 2, out block);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(272, block);
error = _fs.MapBlock("49470015/7AC2FE88C908/savedata.dat", 200, out block);
Assert.AreEqual(Errno.InvalidArgument, error);
}
[Test]
public void Read()
{
byte[] buffer = new byte[0];
Errno error = _fs.Read("49470015", 0, 0, ref buffer);
Assert.AreEqual(Errno.IsDirectory, error);
error = _fs.Read("49470015/TitleImage", 0, 0, ref buffer);
Assert.AreEqual(Errno.NoSuchFile, error);
error = _fs.Read("49470015/7AC2FE88C908/savedata.dat", 0, 0, ref buffer);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(0, buffer.Length);
Assert.AreEqual("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
Sha256Context.Data(buffer, out _));
error = _fs.Read("49470015/7AC2FE88C908/savedata.dat", 1, 16, ref buffer);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(16, buffer.Length);
Assert.AreEqual("ff82559d2d0c610ac25b78dcb53a8312e32b56192044deb1f01540581bd54e80",
Sha256Context.Data(buffer, out _));
error = _fs.Read("49470015/7AC2FE88C908/savedata.dat", 248, 131072, ref buffer);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(61996, buffer.Length);
Assert.AreEqual("2eb0d62a96ad28473ce0dd67052efdfae31f371992e1d8309beeeff6f2b46a59",
Sha256Context.Data(buffer, out _));
error = _fs.Read("49470015/7AC2FE88C908/savedata.dat", 131072, 0, ref buffer);
Assert.AreEqual(Errno.InvalidArgument, error);
}
[Test]
public void RootDirectory()
{
Errno error = _fs.ReadDir("", out List<string> directory);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(6, directory.Count);
Assert.AreEqual(true, directory.Contains("49470015"));
Assert.AreEqual(true, directory.Contains("4d5300d1"));
Assert.AreEqual(true, directory.Contains("4d53006e"));
Assert.AreEqual(true, directory.Contains("4d530004"));
Assert.AreEqual(true, directory.Contains("4947007c"));
Assert.AreEqual(true, directory.Contains("4541003e"));
Assert.AreEqual(false, directory.Contains("d530004"));
Assert.AreEqual(false, directory.Contains("4947007"));
}
[Test]
public void Stat()
{
Errno error = _fs.Stat("49470015", out FileEntryInfo stat);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(new DateTime(2007, 3, 6, 15, 8, 44, DateTimeKind.Utc), stat.AccessTimeUtc);
Assert.AreEqual(FileAttributes.Directory, stat.Attributes);
Assert.AreEqual(null, stat.BackupTimeUtc);
Assert.AreEqual(1, stat.Blocks);
Assert.AreEqual(16384, stat.BlockSize);
Assert.AreEqual(new DateTime(2007, 3, 6, 15, 8, 44, DateTimeKind.Utc), stat.CreationTimeUtc);
Assert.AreEqual(null, stat.DeviceNo);
Assert.AreEqual(null, stat.GID);
Assert.AreEqual(2, stat.Inode);
Assert.AreEqual(new DateTime(2007, 3, 6, 15, 8, 44, DateTimeKind.Utc), stat.LastWriteTimeUtc);
Assert.AreEqual(16384, stat.Length);
Assert.AreEqual(1, stat.Links);
Assert.AreEqual(null, stat.Mode);
Assert.AreEqual(null, stat.StatusChangeTimeUtc);
Assert.AreEqual(null, stat.UID);
error = _fs.Stat("49470015/TitleImage", out stat);
Assert.AreEqual(Errno.NoSuchFile, error);
error = _fs.Stat("49470015/TitleImage.xbx", out stat);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(new DateTime(2013, 5, 14, 12, 50, 8, DateTimeKind.Utc), stat.AccessTimeUtc);
Assert.AreEqual(FileAttributes.None, stat.Attributes);
Assert.AreEqual(null, stat.BackupTimeUtc);
Assert.AreEqual(1, stat.Blocks);
Assert.AreEqual(16384, stat.BlockSize);
Assert.AreEqual(new DateTime(2013, 5, 14, 12, 50, 8, DateTimeKind.Utc), stat.CreationTimeUtc);
Assert.AreEqual(null, stat.DeviceNo);
Assert.AreEqual(null, stat.GID);
Assert.AreEqual(3, stat.Inode);
Assert.AreEqual(new DateTime(2013, 5, 14, 12, 50, 8, DateTimeKind.Utc), stat.LastWriteTimeUtc);
Assert.AreEqual(10240, stat.Length);
Assert.AreEqual(1, stat.Links);
Assert.AreEqual(null, stat.Mode);
Assert.AreEqual(null, stat.StatusChangeTimeUtc);
Assert.AreEqual(null, stat.UID);
}
[Test]
public void Statfs()
{
Errno error = _fs.StatFs(out FileSystemInfo stat);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(1960, stat.Blocks);
Assert.AreEqual(42, stat.FilenameLength);
Assert.AreEqual(0, stat.Files);
Assert.AreEqual(0, stat.FreeBlocks);
Assert.AreEqual(0, stat.FreeFiles);
Assert.AreEqual(0x58544146, stat.Id.Serial32);
Assert.AreEqual("Xbox FAT", stat.Type);
}
[Test]
public void SubDirectory()
{
Errno error = _fs.ReadDir("49470015", out List<string> directory);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(4, directory.Count);
Assert.AreEqual(true, directory.Contains("TitleImage.xbx"));
Assert.AreEqual(true, directory.Contains("SaveImage.xbx"));
Assert.AreEqual(true, directory.Contains("7AC2FE88C908"));
Assert.AreEqual(true, directory.Contains("TitleMeta.xbx"));
Assert.AreEqual(false, directory.Contains("TitleImage"));
Assert.AreEqual(false, directory.Contains(".xbx"));
Assert.AreEqual(false, directory.Contains("7ac2fe88c908"));
Assert.AreEqual(false, directory.Contains("xbx"));
error = _fs.ReadDir("49470015/7AC2FE88C908", out directory);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(3, directory.Count);
Assert.AreEqual(true, directory.Contains("SaveMeta.xbx"));
Assert.AreEqual(true, directory.Contains("savedata.dat"));
Assert.AreEqual(true, directory.Contains("saveimage.xbx"));
Assert.AreEqual(false, directory.Contains("savemeta.xbx"));
Assert.AreEqual(false, directory.Contains("SaveData.dat"));
Assert.AreEqual(false, directory.Contains("SaveImage.xbx"));
}
}
}

View File

@@ -40,220 +40,10 @@ using NUnit.Framework;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.FATX
{
[TestFixture]
public class XboxFat
{
[SetUp]
public void Init()
{
_location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Xbox FAT16", "le", "fatx.img.lz");
_filter = new LZip();
_filter.Open(_location);
_image = new ZZZRawImage();
Assert.AreEqual(true, _image.Open(_filter));
_fs = new XboxFatPlugin();
_wholePart = new Partition
{
Name = "Whole device",
Length = _image.Info.Sectors,
Size = _image.Info.Sectors * _image.Info.SectorSize
};
Errno error = _fs.Mount(_image, _wholePart, null, null, null);
Assert.AreEqual(Errno.NoError, error);
}
[TearDown]
public void Destroy()
{
_fs?.Unmount();
_fs = null;
}
string _location;
IFilter _filter;
IMediaImage _image;
IReadOnlyFilesystem _fs;
Partition _wholePart;
[Test]
public void Information()
{
Assert.AreEqual(62720, _image.Info.Sectors);
Assert.AreEqual(1960, _fs.XmlFsType.Clusters);
Assert.AreEqual(16384, _fs.XmlFsType.ClusterSize);
Assert.AreEqual("FATX filesystem", _fs.XmlFsType.Type);
Assert.AreEqual("Volume láb€l", _fs.XmlFsType.VolumeName);
Assert.AreEqual("4639B7D0", _fs.XmlFsType.VolumeSerial);
}
[Test]
public void MapBlock()
{
Errno error = _fs.MapBlock("49470015", 0, out long block);
Assert.AreEqual(Errno.IsDirectory, error);
error = _fs.MapBlock("49470015/TitleImage", 0, out block);
Assert.AreEqual(Errno.NoSuchFile, error);
error = _fs.MapBlock("49470015/TitleImage.xbx", 0, out block);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(80, block);
error = _fs.MapBlock("49470015/7AC2FE88C908/savedata.dat", 2, out block);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(272, block);
error = _fs.MapBlock("49470015/7AC2FE88C908/savedata.dat", 200, out block);
Assert.AreEqual(Errno.InvalidArgument, error);
}
[Test]
public void Read()
{
byte[] buffer = new byte[0];
Errno error = _fs.Read("49470015", 0, 0, ref buffer);
Assert.AreEqual(Errno.IsDirectory, error);
error = _fs.Read("49470015/TitleImage", 0, 0, ref buffer);
Assert.AreEqual(Errno.NoSuchFile, error);
error = _fs.Read("49470015/7AC2FE88C908/savedata.dat", 0, 0, ref buffer);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(0, buffer.Length);
Assert.AreEqual("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
Sha256Context.Data(buffer, out _));
error = _fs.Read("49470015/7AC2FE88C908/savedata.dat", 1, 16, ref buffer);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(16, buffer.Length);
Assert.AreEqual("ff82559d2d0c610ac25b78dcb53a8312e32b56192044deb1f01540581bd54e80",
Sha256Context.Data(buffer, out _));
error = _fs.Read("49470015/7AC2FE88C908/savedata.dat", 248, 131072, ref buffer);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(61996, buffer.Length);
Assert.AreEqual("2eb0d62a96ad28473ce0dd67052efdfae31f371992e1d8309beeeff6f2b46a59",
Sha256Context.Data(buffer, out _));
error = _fs.Read("49470015/7AC2FE88C908/savedata.dat", 131072, 0, ref buffer);
Assert.AreEqual(Errno.InvalidArgument, error);
}
[Test]
public void RootDirectory()
{
Errno error = _fs.ReadDir("", out List<string> directory);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(6, directory.Count);
Assert.AreEqual(true, directory.Contains("49470015"));
Assert.AreEqual(true, directory.Contains("4d5300d1"));
Assert.AreEqual(true, directory.Contains("4d53006e"));
Assert.AreEqual(true, directory.Contains("4d530004"));
Assert.AreEqual(true, directory.Contains("4947007c"));
Assert.AreEqual(true, directory.Contains("4541003e"));
Assert.AreEqual(false, directory.Contains("d530004"));
Assert.AreEqual(false, directory.Contains("4947007"));
}
[Test]
public void Stat()
{
Errno error = _fs.Stat("49470015", out FileEntryInfo stat);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(new DateTime(2007, 3, 6, 15, 8, 44, DateTimeKind.Utc), stat.AccessTimeUtc);
Assert.AreEqual(FileAttributes.Directory, stat.Attributes);
Assert.AreEqual(null, stat.BackupTimeUtc);
Assert.AreEqual(1, stat.Blocks);
Assert.AreEqual(16384, stat.BlockSize);
Assert.AreEqual(new DateTime(2007, 3, 6, 15, 8, 44, DateTimeKind.Utc), stat.CreationTimeUtc);
Assert.AreEqual(null, stat.DeviceNo);
Assert.AreEqual(null, stat.GID);
Assert.AreEqual(2, stat.Inode);
Assert.AreEqual(new DateTime(2007, 3, 6, 15, 8, 44, DateTimeKind.Utc), stat.LastWriteTimeUtc);
Assert.AreEqual(16384, stat.Length);
Assert.AreEqual(1, stat.Links);
Assert.AreEqual(null, stat.Mode);
Assert.AreEqual(null, stat.StatusChangeTimeUtc);
Assert.AreEqual(null, stat.UID);
error = _fs.Stat("49470015/TitleImage", out stat);
Assert.AreEqual(Errno.NoSuchFile, error);
error = _fs.Stat("49470015/TitleImage.xbx", out stat);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(new DateTime(2013, 5, 14, 12, 50, 8, DateTimeKind.Utc), stat.AccessTimeUtc);
Assert.AreEqual(FileAttributes.None, stat.Attributes);
Assert.AreEqual(null, stat.BackupTimeUtc);
Assert.AreEqual(1, stat.Blocks);
Assert.AreEqual(16384, stat.BlockSize);
Assert.AreEqual(new DateTime(2013, 5, 14, 12, 50, 8, DateTimeKind.Utc), stat.CreationTimeUtc);
Assert.AreEqual(null, stat.DeviceNo);
Assert.AreEqual(null, stat.GID);
Assert.AreEqual(3, stat.Inode);
Assert.AreEqual(new DateTime(2013, 5, 14, 12, 50, 8, DateTimeKind.Utc), stat.LastWriteTimeUtc);
Assert.AreEqual(10240, stat.Length);
Assert.AreEqual(1, stat.Links);
Assert.AreEqual(null, stat.Mode);
Assert.AreEqual(null, stat.StatusChangeTimeUtc);
Assert.AreEqual(null, stat.UID);
}
[Test]
public void Statfs()
{
Errno error = _fs.StatFs(out FileSystemInfo stat);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(1960, stat.Blocks);
Assert.AreEqual(42, stat.FilenameLength);
Assert.AreEqual(0, stat.Files);
Assert.AreEqual(0, stat.FreeBlocks);
Assert.AreEqual(0, stat.FreeFiles);
Assert.AreEqual(0x58544146, stat.Id.Serial32);
Assert.AreEqual("Xbox FAT", stat.Type);
}
[Test]
public void SubDirectory()
{
Errno error = _fs.ReadDir("49470015", out List<string> directory);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(4, directory.Count);
Assert.AreEqual(true, directory.Contains("TitleImage.xbx"));
Assert.AreEqual(true, directory.Contains("SaveImage.xbx"));
Assert.AreEqual(true, directory.Contains("7AC2FE88C908"));
Assert.AreEqual(true, directory.Contains("TitleMeta.xbx"));
Assert.AreEqual(false, directory.Contains("TitleImage"));
Assert.AreEqual(false, directory.Contains(".xbx"));
Assert.AreEqual(false, directory.Contains("7ac2fe88c908"));
Assert.AreEqual(false, directory.Contains("xbx"));
error = _fs.ReadDir("49470015/7AC2FE88C908", out directory);
Assert.AreEqual(Errno.NoError, error);
Assert.AreEqual(3, directory.Count);
Assert.AreEqual(true, directory.Contains("SaveMeta.xbx"));
Assert.AreEqual(true, directory.Contains("savedata.dat"));
Assert.AreEqual(true, directory.Contains("saveimage.xbx"));
Assert.AreEqual(false, directory.Contains("savemeta.xbx"));
Assert.AreEqual(false, directory.Contains("SaveData.dat"));
Assert.AreEqual(false, directory.Contains("SaveImage.xbx"));
}
}
[TestFixture]
public class Xbox360Fat
public class Xbox360
{
[SetUp]
public void Init()

View File

@@ -0,0 +1,135 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFSPlus.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
// ReSharper disable CheckNamespace
namespace Aaru.Tests.Filesystems.HfsPlus
{
[TestFixture]
public class APM
{
// Missing Darwin 1.4.1
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif", "darwin_1.3.1.aif", "darwin_1.3.1_wrapped.aif",
"darwin_1.4.1_wrapped.aif", "darwin_6.0.2.aif", "darwin_6.0.2_wrapped.aif", "darwin_8.0.1_journal.aif",
"darwin_8.0.1.aif", "darwin_8.0.1_wrapped.aif", "macos_8.1.aif", "macos_9.0.4.aif", "macos_9.1.aif",
"macos_9.2.1.aif", "macos_9.2.2.aif", "macosx_10.2.aif", "macosx_10.3_journal.aif", "macosx_10.3.aif",
"macosx_10.4_journal.aif", "macosx_10.4.aif"
};
readonly ulong[] _sectors =
{
409600, 614400, 819200, 614400, 614400, 819200, 614400, 1228800, 819200, 614400, 4194304, 4194304, 4194304,
4194304, 4194304, 4194304, 2097152, 4194304, 2097152, 4194304
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
51190, 76790, 102392, 76774, 76774, 102392, 76774, 153592, 102392, 76774, 524152, 524088, 524088, 524088,
524088, 524008, 261884, 491240, 261884, 491240
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
4096, 4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null
};
readonly string[] _volumeSerial =
{
"FA94762D086A18A9", "33D4A309C8E7BD10", null, null, null, null, null, "4D5140EB8F14A385",
"0D592249833E2DC4", "AA616146576BD9BC", null, null, null, null, null, "EFA132FFFAC1ADA6",
"009D570FFCF8F20B", "17F6F33AB313EE32", "AD5690C093F66FCF", "A7D63854DF76DDE6"
};
readonly string[] _oemId =
{
"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "8.10", "8.10", "8.10",
"8.10", "8.10", "10.0", "HFSJ", "10.0", "HFSJ", "10.0"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (APM)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple_HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,123 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFSPlus.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
// ReSharper disable CheckNamespace
namespace Aaru.Tests.Filesystems.HfsPlus
{
[TestFixture]
public class GPT
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif"
};
readonly ulong[] _sectors =
{
409600, 614400
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
51190, 76790
};
readonly int[] _clusterSize =
{
4096, 4096
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
"D8C68470046E67BE", "FD3CB598F3C6294A"
};
readonly string[] _oemId =
{
"10.0", "HFSJ"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (GPT)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -1,301 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFSPlus.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class HfsPlusApm
{
// Missing Darwin 1.4.1
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif", "darwin_1.3.1.aif", "darwin_1.3.1_wrapped.aif",
"darwin_1.4.1_wrapped.aif", "darwin_6.0.2.aif", "darwin_6.0.2_wrapped.aif", "darwin_8.0.1_journal.aif",
"darwin_8.0.1.aif", "darwin_8.0.1_wrapped.aif", "macos_8.1.aif", "macos_9.0.4.aif", "macos_9.1.aif",
"macos_9.2.1.aif", "macos_9.2.2.aif", "macosx_10.2.aif", "macosx_10.3_journal.aif", "macosx_10.3.aif",
"macosx_10.4_journal.aif", "macosx_10.4.aif"
};
readonly ulong[] _sectors =
{
409600, 614400, 819200, 614400, 614400, 819200, 614400, 1228800, 819200, 614400, 4194304, 4194304, 4194304,
4194304, 4194304, 4194304, 2097152, 4194304, 2097152, 4194304
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
51190, 76790, 102392, 76774, 76774, 102392, 76774, 153592, 102392, 76774, 524152, 524088, 524088, 524088,
524088, 524008, 261884, 491240, 261884, 491240
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096,
4096, 4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, null
};
readonly string[] _volumeSerial =
{
"FA94762D086A18A9", "33D4A309C8E7BD10", null, null, null, null, null, "4D5140EB8F14A385",
"0D592249833E2DC4", "AA616146576BD9BC", null, null, null, null, null, "EFA132FFFAC1ADA6",
"009D570FFCF8F20B", "17F6F33AB313EE32", "AD5690C093F66FCF", "A7D63854DF76DDE6"
};
readonly string[] _oemId =
{
"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "8.10", "8.10", "8.10",
"8.10", "8.10", "10.0", "HFSJ", "10.0", "HFSJ", "10.0"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (APM)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple_HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class HfsPlusGpt
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif"
};
readonly ulong[] _sectors =
{
409600, 614400
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
51190, 76790
};
readonly int[] _clusterSize =
{
4096, 4096
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
"D8C68470046E67BE", "FD3CB598F3C6294A"
};
readonly string[] _oemId =
{
"10.0", "HFSJ"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (GPT)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
// Mising Darwin 6.0.2 wrapped
[TestFixture]
public class HfsPlusMbr
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif", "linux.aif", "linux_journal.aif", "darwin_1.3.1.aif",
"darwin_1.3.1_wrapped.aif", "darwin_1.4.1.aif", "darwin_1.4.1_wrapped.aif", "darwin_6.0.2.aif",
"darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "darwin_8.0.1_wrapped.aif", "linux_4.19_hfs+_flashdrive.aif"
};
readonly ulong[] _sectors =
{
303104, 352256, 262144, 262144, 819200, 614400, 819200, 614400, 819200, 1228800, 819200, 614400, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
37878, 44021, 32512, 32512, 102178, 76708, 102178, 76708, 102178, 153592, 102392, 76774, 127744
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null, null, null, null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"C84F550907D13F50", "016599F88029F73D", null, null, null, null, null, null, null, "F92964F9B3F64ABB",
"A8FAC484A0A2B177", "D5D5BF1346AD2B8D", "B9BAC6856878A404"
};
readonly string[] _oemId =
{
"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "H+Lx"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0xAF")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,127 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFSPlus.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
// ReSharper disable CheckNamespace
namespace Aaru.Tests.Filesystems.HfsPlus
{
// Mising Darwin 6.0.2 wrapped
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif", "linux.aif", "linux_journal.aif", "darwin_1.3.1.aif",
"darwin_1.3.1_wrapped.aif", "darwin_1.4.1.aif", "darwin_1.4.1_wrapped.aif", "darwin_6.0.2.aif",
"darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "darwin_8.0.1_wrapped.aif", "linux_4.19_hfs+_flashdrive.aif"
};
readonly ulong[] _sectors =
{
303104, 352256, 262144, 262144, 819200, 614400, 819200, 614400, 819200, 1228800, 819200, 614400, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
37878, 44021, 32512, 32512, 102178, 76708, 102178, 76708, 102178, 153592, 102392, 76774, 127744
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096, 4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null, null, null, null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"C84F550907D13F50", "016599F88029F73D", null, null, null, null, null, null, null, "F92964F9B3F64ABB",
"A8FAC484A0A2B177", "D5D5BF1346AD2B8D", "B9BAC6856878A404"
};
readonly string[] _oemId =
{
"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "10.0", "H+Lx"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS+ (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0xAF")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS+", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,132 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HFS
{
[TestFixture]
public class APM
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif", "darwin_1.3.1.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif",
"macos_1.1.aif", "macos_2.0.aif", "macos_6.0.7.aif", "macos_7.5.3.aif", "macos_7.5.aif", "macos_7.6.aif",
"macos_8.0.aif", "macos_8.1.aif", "macos_9.0.4.aif", "macos_9.1.aif", "macos_9.2.1.aif", "macos_9.2.2.aif",
"macosx_10.2.aif", "macosx_10.3.aif", "macosx_10.4.aif", "rhapsody_dr1.aif", "d2_driver.aif", "hdt_1.8.aif",
"macos_4.2.aif", "macos_4.3.aif", "macos_6.0.2.aif", "macos_6.0.3.aif", "macos_6.0.4.aif",
"macos_6.0.5.aif", "macos_6.0.8.aif", "macos_6.0.aif", "macos_7.0.aif", "macos_7.1.1.aif", "parted.aif",
"silverlining_2.2.1.aif", "speedtools_3.6.aif", "vcpformatter_2.1.1.aif"
};
readonly ulong[] _sectors =
{
1024128, 409600, 409600, 409600, 409600, 41820, 41820, 81648, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 409600, 51200, 51200, 41820, 41820, 54840,
54840, 54840, 54840, 54840, 41820, 54840, 54840, 262144, 51200, 51200, 54840
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
64003, 51189, 51189, 58502, 58502, 41788, 38950, 39991, 63954, 63990, 63954, 63954, 63954, 63922, 63922,
63922, 63922, 63884, 63883, 63883, 58506, 50926, 50094, 38950, 38950, 38950, 38950, 7673, 38950, 38950,
38950, 38950, 38950, 46071, 50382, 49135, 54643
};
readonly int[] _clusterSize =
{
8192, 4096, 4096, 3584, 3584, 512, 512, 1024, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 3584, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 1024, 512, 512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Test disk", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Untitled", "Untitled #1", "24 MB Disk", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null, null, null, "AAFE1382AF5AA898", null, null, null, null, null, null, null, null, null, null,
null, null, "5A7C38B0CAF279C4", "FB49083EBD150509", "632C0B1DB46FD188", null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple_HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -1,438 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class Hfs
{
readonly string[] _testFiles =
{
"macos_1.1_mf2dd.img.lz", "macos_2.0_mf2dd.img.lz", "macos_6.0.7_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz",
"openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2hd.img.lz", "rhapsody_dr1_mf2hd.img.lz",
"ecs20_mf2hd_fstester.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.DOS_35_HD,
MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
1600, 1600, 1600, 2880, 2880, 2880, 2880, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1594, 1594, 1594, 2874, 2874, 2874, 2874, 2874
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512, 512, 512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "VOLUME LABEL"
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS", _testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new AppleHFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class HfsApm
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif", "darwin_1.3.1.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif",
"macos_1.1.aif", "macos_2.0.aif", "macos_6.0.7.aif", "macos_7.5.3.aif", "macos_7.5.aif", "macos_7.6.aif",
"macos_8.0.aif", "macos_8.1.aif", "macos_9.0.4.aif", "macos_9.1.aif", "macos_9.2.1.aif", "macos_9.2.2.aif",
"macosx_10.2.aif", "macosx_10.3.aif", "macosx_10.4.aif", "rhapsody_dr1.aif", "d2_driver.aif", "hdt_1.8.aif",
"macos_4.2.aif", "macos_4.3.aif", "macos_6.0.2.aif", "macos_6.0.3.aif", "macos_6.0.4.aif",
"macos_6.0.5.aif", "macos_6.0.8.aif", "macos_6.0.aif", "macos_7.0.aif", "macos_7.1.1.aif", "parted.aif",
"silverlining_2.2.1.aif", "speedtools_3.6.aif", "vcpformatter_2.1.1.aif"
};
readonly ulong[] _sectors =
{
1024128, 409600, 409600, 409600, 409600, 41820, 41820, 81648, 1024000, 1024000, 1024000, 1024000, 1024000,
1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 1024000, 409600, 51200, 51200, 41820, 41820, 54840,
54840, 54840, 54840, 54840, 41820, 54840, 54840, 262144, 51200, 51200, 54840
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512,
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
64003, 51189, 51189, 58502, 58502, 41788, 38950, 39991, 63954, 63990, 63954, 63954, 63954, 63922, 63922,
63922, 63922, 63884, 63883, 63883, 58506, 50926, 50094, 38950, 38950, 38950, 38950, 7673, 38950, 38950,
38950, 38950, 38950, 46071, 50382, 49135, 54643
};
readonly int[] _clusterSize =
{
8192, 4096, 4096, 3584, 3584, 512, 512, 1024, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192,
8192, 8192, 3584, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 1024, 512, 512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Test disk", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Untitled", "Untitled #1", "24 MB Disk", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null, null, null, "AAFE1382AF5AA898", null, null, null, null, null, null, null, null, null, null,
null, null, "5A7C38B0CAF279C4", "FB49083EBD150509", "632C0B1DB46FD188", null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple_HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class HfsCdrom
{
readonly string[] _testFiles =
{
"toast_3.5.7_hfs_from_volume.aif", "toast_3.5.7_iso9660_hfs.aif", "toast_4.1.3_hfs_from_volume.aif",
"toast_4.1.3_iso9660_hfs.aif", "toast_3.5.7_hfs_from_files.aif", "toast_4.1.3_hfs_from_files.aif"
};
readonly ulong[] _sectors =
{
942, 1880, 943, 1882, 1509, 1529
};
readonly uint[] _sectorSize =
{
2048, 2048, 2048, 2048, 2048, 2048
};
readonly long[] _clusters =
{
3724, 931, 931, 931, 249, 249
};
readonly int[] _clusterSize =
{
512, 2048, 2048, 2048, 12288, 12288
};
readonly string[] _volumeName =
{
"Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils"
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (CD-ROM)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple_HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class HfsMbr
{
readonly string[] _testFiles =
{
"linux.aif", "darwin_1.3.1.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif",
"linux_4.19_hfs_flashdrive.aif"
};
readonly ulong[] _sectors =
{
262144, 409600, 409600, 409600, 409600, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
65018, 51145, 51145, 58452, 58502, 63870
};
readonly int[] _clusterSize =
{
2048, 4096, 4096, 3584, 3584, 8192
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "DicSetter"
};
readonly string[] _volumeSerial =
{
null, null, null, null, "81FE805D61458753", null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0xAF")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class HfsRdb
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif"
};
readonly ulong[] _sectors =
{
1024128
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
63752
};
readonly int[] _clusterSize =
{
8192
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (RDB)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"RES\\86\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,114 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HFS
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"linux.aif", "darwin_1.3.1.aif", "darwin_1.4.1.aif", "darwin_6.0.2.aif", "darwin_8.0.1.aif",
"linux_4.19_hfs_flashdrive.aif"
};
readonly ulong[] _sectors =
{
262144, 409600, 409600, 409600, 409600, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
65018, 51145, 51145, 58452, 58502, 63870
};
readonly int[] _clusterSize =
{
2048, 4096, 4096, 3584, 3584, 8192
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "DicSetter"
};
readonly string[] _volumeSerial =
{
null, null, null, null, "81FE805D61458753", null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0xAF")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,116 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HFS
{
[TestFixture]
public class Optical
{
readonly string[] _testFiles =
{
"toast_3.5.7_hfs_from_volume.aif", "toast_3.5.7_iso9660_hfs.aif", "toast_4.1.3_hfs_from_volume.aif",
"toast_4.1.3_iso9660_hfs.aif", "toast_3.5.7_hfs_from_files.aif", "toast_4.1.3_hfs_from_files.aif"
};
readonly ulong[] _sectors =
{
942, 1880, 943, 1882, 1509, 1529
};
readonly uint[] _sectorSize =
{
2048, 2048, 2048, 2048, 2048, 2048
};
readonly long[] _clusters =
{
3724, 931, 931, 931, 249, 249
};
readonly int[] _clusterSize =
{
512, 2048, 2048, 2048, 12288, 12288
};
readonly string[] _volumeName =
{
"Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils", "Disk utils"
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (CD-ROM)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple_HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,113 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HFS
{
[TestFixture]
public class RDB
{
readonly string[] _testFiles =
{
"amigaos_3.9.aif"
};
readonly ulong[] _sectors =
{
1024128
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
63752
};
readonly int[] _clusterSize =
{
8192
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS (RDB)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"RES\\86\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,118 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HFS
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"macos_1.1_mf2dd.img.lz", "macos_2.0_mf2dd.img.lz", "macos_6.0.7_mf2dd.img.lz", "nextstep_3.3_mf2hd.img.lz",
"openstep_4.0_mf2hd.img.lz", "openstep_4.2_mf2hd.img.lz", "rhapsody_dr1_mf2hd.img.lz",
"ecs20_mf2hd_fstester.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.AppleSonyDS, MediaType.DOS_35_HD,
MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
1600, 1600, 1600, 2880, 2880, 2880, 2880, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1594, 1594, 1594, 2874, 2874, 2874, 2874, 2874
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512, 512, 512, 512
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "VOLUME LABEL"
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFS", _testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new AppleHFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,123 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFSX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HFSX
{
[TestFixture]
public class APM
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif", "darwin_8.0.1_journal.aif", "darwin_8.0.1.aif",
"macosx_10.4_journal.aif", "macosx_10.4.aif"
};
readonly ulong[] _sectors =
{
819200, 1228800, 1638400, 1433600, 4194304, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
102390, 153590, 204792, 179192, 491290, 127770
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"CC2D56884950D9AE", "7AF1175D8EA7A072", "BB4ABD7E7E2FF5AF", "E2F212D815EF77B5", "5A8C646A5D77EB16",
"258C51A750F6A485"
};
readonly string[] _oemId =
{
"10.0", "HFSJ", "10.0", "10.0", "HFSJ", "10.0"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (APM)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple_HFSX")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,121 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFSX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HFSX
{
[TestFixture]
public class GPT
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif"
};
readonly ulong[] _sectors =
{
819200, 1228800
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
102390, 153590
};
readonly int[] _clusterSize =
{
4096, 4096
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
"328343989312AE9F", "FB98504073464C5C"
};
readonly string[] _oemId =
{
"10.0", "HFSJ"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (GPT)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -1,289 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFSX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class HfsxApm
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif", "darwin_8.0.1_journal.aif", "darwin_8.0.1.aif",
"macosx_10.4_journal.aif", "macosx_10.4.aif"
};
readonly ulong[] _sectors =
{
819200, 1228800, 1638400, 1433600, 4194304, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
102390, 153590, 204792, 179192, 491290, 127770
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"CC2D56884950D9AE", "7AF1175D8EA7A072", "BB4ABD7E7E2FF5AF", "E2F212D815EF77B5", "5A8C646A5D77EB16",
"258C51A750F6A485"
};
readonly string[] _oemId =
{
"10.0", "HFSJ", "10.0", "10.0", "HFSJ", "10.0"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (APM)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple_HFSX")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class HfsxGpt
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif"
};
readonly ulong[] _sectors =
{
819200, 1228800
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
102390, 153590
};
readonly int[] _clusterSize =
{
4096, 4096
};
readonly string[] _volumeName =
{
null, null
};
readonly string[] _volumeSerial =
{
"328343989312AE9F", "FB98504073464C5C"
};
readonly string[] _oemId =
{
"10.0", "HFSJ"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (GPT)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Apple HFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class HfsxMbr
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif", "linux.aif", "linux_journal.aif",
"darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "linux_4.19_hfsx_flashdrive.aif"
};
readonly ulong[] _sectors =
{
393216, 409600, 262144, 262144, 1638400, 1433600, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
49140, 51187, 32512, 32512, 204792, 179192, 127744
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096, 4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"C2BCCCE6DE5BC98D", "AC54CD78C75CC30F", null, null, "7559DD01BCFADD9A", "AEA39CFBBF14C0FF",
"5E4A8781D3C9286C"
};
readonly string[] _oemId =
{
"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "H+Lx"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0xAF")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,123 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HFSX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HFSX
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"macosx_10.11.aif", "macosx_10.11_journal.aif", "linux.aif", "linux_journal.aif",
"darwin_8.0.1_journal.aif", "darwin_8.0.1.aif", "linux_4.19_hfsx_flashdrive.aif"
};
readonly ulong[] _sectors =
{
393216, 409600, 262144, 262144, 1638400, 1433600, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
49140, 51187, 32512, 32512, 204792, 179192, 127744
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 4096, 4096, 4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"C2BCCCE6DE5BC98D", "AC54CD78C75CC30F", null, null, "7559DD01BCFADD9A", "AEA39CFBBF14C0FF",
"5E4A8781D3C9286C"
};
readonly string[] _oemId =
{
"10.0", "HFSJ", "10.0", "10.0", "10.0", "10.0", "H+Lx"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Apple HFSX (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new AppleHFSPlus();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0xAF")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("HFSX", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : HTFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.HTFS
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
2097152
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
1020096
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"HTFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems",
"High Throughtput File System (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -26,7 +26,6 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
@@ -35,10 +34,10 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.HTFS
{
[TestFixture]
public class Htfs
public class Whole
{
readonly string[] _testFiles =
{
@@ -121,85 +120,4 @@ namespace Aaru.Tests.Filesystems
}
}
}
[TestFixture]
public class HtfsMbr
{
readonly string[] _testFiles =
{
"scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
2097152
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
1020096
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
"Volume label"
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"HTFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems",
"High Throughtput File System (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -1,466 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : MINIX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class MinixV1
{
readonly string[] _testFiles =
{
"minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz",
"minix_3.1.2a_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
720, 2400, 1440, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
360, 1200, 720, 1440
};
readonly int[] _clusterSize =
{
1024, 1024, 1024, 1024
};
readonly string[] _types =
{
"Minix 3 v1", "Minix 3 v1", "Minix 3 v1", "Minix 3 v1"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new MinixFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
[TestFixture]
public class MinixV1Mbr
{
readonly string[] _testFiles =
{
"linux.aif", "minix_3.1.2a.aif", "linux_4.19_minix1_flashdrive.aif"
};
readonly ulong[] _sectors =
{
262144, 102400, 131072
};
readonly uint[] _sectorSize =
{
512, 512, 512
};
readonly long[] _clusters =
{
65535, 50399, 64512
};
readonly int[] _clusterSize =
{
1024, 1024, 1024
};
readonly string[] _types =
{
"Minix v1", "Minix 3 v1", "Minix v1"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new MinixFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x80" ||
partitions[j].Type == "0x81" ||
partitions[j].Type == "MINIX")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
[TestFixture]
public class MinixV2
{
readonly string[] _testFiles =
{
"minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz",
"minix_3.1.2a_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
720, 2400, 1440, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
360, 1200, 720, 1440
};
readonly int[] _clusterSize =
{
1024, 1024, 1024, 1024
};
readonly string[] _types =
{
"Minix 3 v2", "Minix 3 v2", "Minix 3 v2", "Minix 3 v2"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new MinixFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
[TestFixture]
public class MinixV2Mbr
{
readonly string[] _testFiles =
{
"minix_3.1.2a.aif", "linux_4.19_minix2_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
511055, 510976
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _types =
{
"Minix 3 v2", "Minix v2"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new MinixFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x81" ||
partitions[j].Type == "MINIX")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
[TestFixture]
public class MinixV3
{
readonly string[] _testFiles =
{
"minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz",
"minix_3.1.2a_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
720, 2400, 1440, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
90, 300, 180, 360
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096
};
readonly string[] _types =
{
"Minix v3", "Minix v3", "Minix v3", "Minix v3"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new MinixFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
[TestFixture]
public class MinixV3Mbr
{
readonly string[] _testFiles =
{
"minix_3.1.2a.aif", "linux_4.19_minix3_flashdrive.aif"
};
readonly ulong[] _sectors =
{
4194304, 1024000
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
523151, 510976
};
readonly int[] _clusterSize =
{
4096, 1024
};
readonly string[] _types =
{
"Minix v3", "Minix v3"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new MinixFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x81" ||
partitions[j].Type == "MINIX")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,110 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : MINIX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.MINIX.V1
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"linux.aif", "minix_3.1.2a.aif", "linux_4.19_minix1_flashdrive.aif"
};
readonly ulong[] _sectors =
{
262144, 102400, 131072
};
readonly uint[] _sectorSize =
{
512, 512, 512
};
readonly long[] _clusters =
{
65535, 50399, 64512
};
readonly int[] _clusterSize =
{
1024, 1024, 1024
};
readonly string[] _types =
{
"Minix v1", "Minix 3 v1", "Minix v1"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new MinixFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x80" ||
partitions[j].Type == "0x81" ||
partitions[j].Type == "MINIX")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,110 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : MINIX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.MINIX.V1
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz",
"minix_3.1.2a_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
720, 2400, 1440, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
360, 1200, 720, 1440
};
readonly int[] _clusterSize =
{
1024, 1024, 1024, 1024
};
readonly string[] _types =
{
"Minix 3 v1", "Minix 3 v1", "Minix 3 v1", "Minix 3 v1"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v1 filesystem",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new MinixFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,109 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : MINIX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.MINIX.V2
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"minix_3.1.2a.aif", "linux_4.19_minix2_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
511055, 510976
};
readonly int[] _clusterSize =
{
1024, 1024
};
readonly string[] _types =
{
"Minix 3 v2", "Minix v2"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new MinixFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x81" ||
partitions[j].Type == "MINIX")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,110 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : MINIX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.MINIX.V2
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz",
"minix_3.1.2a_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
720, 2400, 1440, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
360, 1200, 720, 1440
};
readonly int[] _clusterSize =
{
1024, 1024, 1024, 1024
};
readonly string[] _types =
{
"Minix 3 v2", "Minix 3 v2", "Minix 3 v2", "Minix 3 v2"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v2 filesystem",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new MinixFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,109 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : MINIX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.MINIX.V3
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"minix_3.1.2a.aif", "linux_4.19_minix3_flashdrive.aif"
};
readonly ulong[] _sectors =
{
4194304, 1024000
};
readonly uint[] _sectorSize =
{
512, 512
};
readonly long[] _clusters =
{
523151, 510976
};
readonly int[] _clusterSize =
{
4096, 1024
};
readonly string[] _types =
{
"Minix v3", "Minix v3"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new MinixFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x81" ||
partitions[j].Type == "MINIX")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,110 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : MINIX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.MINIX.V3
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"minix_3.1.2a_dsdd.img.lz", "minix_3.1.2a_dshd.img.lz", "minix_3.1.2a_mf2dd.img.lz",
"minix_3.1.2a_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
720, 2400, 1440, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
90, 300, 180, 360
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096
};
readonly string[] _types =
{
"Minix v3", "Minix v3", "Minix v3", "Minix v3"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "MINIX v3 filesystem",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new MinixFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_types[i], fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : NTFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.NTFS
{
[TestFixture]
public class GPT
{
readonly string[] _testFiles =
{
"haiku_hrev51259.aif"
};
readonly ulong[] _sectors =
{
2097152
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
261887
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"106DA7693F7F6B3F"
};
readonly string[] _oemId =
{
null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems",
"New Technology File System (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.NTFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("NTFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -31,96 +31,13 @@ using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.NTFS
{
[TestFixture]
public class NtfsGpt
{
readonly string[] _testFiles =
{
"haiku_hrev51259.aif"
};
readonly ulong[] _sectors =
{
2097152
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
261887
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
null, null, null, null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"106DA7693F7F6B3F"
};
readonly string[] _oemId =
{
null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems",
"New Technology File System (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new NTFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("NTFS", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class NtfsMbr
public class MBR
{
readonly string[] _testFiles =
{
@@ -179,7 +96,7 @@ namespace Aaru.Tests.Filesystems
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new NTFS();
IFilesystem fs = new Aaru.Filesystems.NTFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)

View File

@@ -35,10 +35,10 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.ProDOS
{
[TestFixture]
public class ProdosApm
public class APM
{
readonly string[] _testFiles =
{

View File

@@ -0,0 +1,102 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : QNX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.QNX4
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"qnx_4.24.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
1023104
};
readonly int[] _clusterSize =
{
512
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "QNX 4 filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.QNX4();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x4D")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -26,19 +26,17 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.QNX4
{
[TestFixture]
public class Qnx4
public class Whole
{
readonly string[] _testFiles =
{
@@ -85,7 +83,7 @@ namespace Aaru.Tests.Filesystems
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new QNX4();
IFilesystem fs = new Aaru.Filesystems.QNX4();
var wholePart = new Partition
{
@@ -102,68 +100,4 @@ namespace Aaru.Tests.Filesystems
}
}
}
[TestFixture]
public class Qnx4Mbr
{
readonly string[] _testFiles =
{
"qnx_4.24.aif"
};
readonly ulong[] _sectors =
{
1024000
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
1023104
};
readonly int[] _clusterSize =
{
512
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "QNX 4 filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new QNX4();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x4D")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("QNX4 filesystem", fs.XmlFsType.Type, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,114 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SFS_MBR.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.SFS
{
[TestFixture]
public class MBR_RDB
{
readonly string[] _testFiles =
{
"aros.aif"
};
readonly ulong[] _sectors =
{
409600
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
406224
};
readonly int[] _clusterSize =
{
512
};
readonly string[] _volumeName =
{
null
};
readonly string[] _volumeSerial =
{
null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR+RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.SFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"SFS\\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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,114 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SFS_MBR.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.SFS
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"aros.aif"
};
readonly ulong[] _sectors =
{
409600
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
408240
};
readonly int[] _clusterSize =
{
512
};
readonly string[] _volumeName =
{
null
};
readonly string[] _volumeSerial =
{
null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.SFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x2F")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,115 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SFS_MBR.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.SFS
{
[TestFixture]
public class RDB
{
readonly string[] _testFiles =
{
"uae.aif", "aros.aif", "amigaos_4.0.aif", "amigaos_4.0_sfs2.aif"
};
readonly ulong[] _sectors =
{
1024128, 409600, 1024128, 1024128
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
127000, 407232, 511040, 511040
};
readonly int[] _clusterSize =
{
2048, 512, 1024, 1024
};
readonly string[] _volumeName =
{
null, null, null, null
};
readonly string[] _volumeSerial =
{
null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.SFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"SFS\\0\"" ||
partitions[j].Type == "\"SFS\\2\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -1,268 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SFS_MBR.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class SfsMbr
{
readonly string[] _testFiles =
{
"aros.aif"
};
readonly ulong[] _sectors =
{
409600
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
408240
};
readonly int[] _clusterSize =
{
512
};
readonly string[] _volumeName =
{
null
};
readonly string[] _volumeSerial =
{
null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x2F")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class SfsMbrRdb
{
readonly string[] _testFiles =
{
"aros.aif"
};
readonly ulong[] _sectors =
{
409600
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
406224
};
readonly int[] _clusterSize =
{
512
};
readonly string[] _volumeName =
{
null
};
readonly string[] _volumeSerial =
{
null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (MBR+RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"SFS\\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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class SfsRdb
{
readonly string[] _testFiles =
{
"uae.aif", "aros.aif", "amigaos_4.0.aif", "amigaos_4.0_sfs2.aif"
};
readonly ulong[] _sectors =
{
1024128, 409600, 1024128, 1024128
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512
};
readonly long[] _clusters =
{
127000, 407232, 511040, 511040
};
readonly int[] _clusterSize =
{
2048, 512, 1024, 1024
};
readonly string[] _volumeName =
{
null, null, null, null
};
readonly string[] _volumeSerial =
{
null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Smart File System (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SFS();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"SFS\\0\"" ||
partitions[j].Type == "\"SFS\\2\"")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("SmartFileSystem", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,121 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SysV.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.SysV
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"att_unix_svr4v2.1.aif", "att_unix_svr4v2.1_2k.aif", "scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
1024000, 1024000, 2097152
};
readonly uint[] _sectorSize =
{
512, 512, 512
};
readonly long[] _clusters =
{
511056, 255528, 1020096
};
readonly int[] _clusterSize =
{
1024, 2048, 1024
};
readonly string[] _volumeName =
{
"/usr3", "/usr3", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null, null
};
readonly string[] _type =
{
"SVR4 fs", "SVR4 fs", "SVR4 fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "UNIX: /usr" ||
partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SysV.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.SysV
{
[TestFixture]
public class RDB
{
readonly string[] _testFiles =
{
"amix.aif"
};
readonly ulong[] _sectors =
{
1024128
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
511424
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
""
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"SVR4 fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"UNI\\1\"")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -1,289 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SysV.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class SysV
{
readonly string[] _testFiles =
{
"amix.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz",
"att_unix_svr4v2.1_mf2hd.img.lz", "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz",
"scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz",
"scoopenserver_5.0.7hw_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,
MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
1760, 720, 1440, 2880, 3360, 2400, 1440, 5760, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
880, 360, 720, 1440, 1680, 1200, 720, 2880, 1440
};
readonly int[] _clusterSize =
{
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024
};
readonly string[] _volumeName =
{
"", "", "", "", "", "", "", "", ""
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null, null, null, null
};
readonly string[] _type =
{
"SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new SysVfs();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
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]);
}
}
}
[TestFixture]
public class SysVMbr
{
readonly string[] _testFiles =
{
"att_unix_svr4v2.1.aif", "att_unix_svr4v2.1_2k.aif", "scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
1024000, 1024000, 2097152
};
readonly uint[] _sectorSize =
{
512, 512, 512
};
readonly long[] _clusters =
{
511056, 255528, 1020096
};
readonly int[] _clusterSize =
{
1024, 2048, 1024
};
readonly string[] _volumeName =
{
"/usr3", "/usr3", "Volume label"
};
readonly string[] _volumeSerial =
{
null, null, null
};
readonly string[] _type =
{
"SVR4 fs", "SVR4 fs", "SVR4 fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "UNIX: /usr" ||
partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
[TestFixture]
public class SysVRdb
{
readonly string[] _testFiles =
{
"amix.aif"
};
readonly ulong[] _sectors =
{
1024128
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
511424
};
readonly int[] _clusterSize =
{
1024
};
readonly string[] _volumeName =
{
""
};
readonly string[] _volumeSerial =
{
null
};
readonly string[] _type =
{
"SVR4 fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "\"UNI\\1\"")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,125 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : SysV.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.SysV
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"amix.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_mf2dd.img.lz",
"att_unix_svr4v2.1_mf2hd.img.lz", "scoopenserver_5.0.7hw_dmf.img.lz", "scoopenserver_5.0.7hw_dshd.img.lz",
"scoopenserver_5.0.7hw_mf2dd.img.lz", "scoopenserver_5.0.7hw_mf2ed.img.lz",
"scoopenserver_5.0.7hw_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD,
MediaType.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
1760, 720, 1440, 2880, 3360, 2400, 1440, 5760, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
880, 360, 720, 1440, 1680, 1200, 720, 2880, 1440
};
readonly int[] _clusterSize =
{
1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024
};
readonly string[] _volumeName =
{
"", "", "", "", "", "", "", "", ""
};
readonly string[] _volumeSerial =
{
null, null, null, null, null, null, null, null, null
};
readonly string[] _type =
{
"SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "System V filesystem",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new SysVfs();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
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]);
}
}
}
}

View File

@@ -30,14 +30,13 @@ using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.UDF._102
{
[TestFixture]
public class Udf
public class Whole
{
readonly string[] _testFiles =
{
@@ -118,90 +117,7 @@ namespace Aaru.Tests.Filesystems
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
[TestFixture]
public class UdfOptical
{
readonly string[] _testFiles =
{
"1.50/ecs20.aif", "2.00/ecs20.aif", "2.01/ecs20.aif", "2.01/ecs20_cdrw.aif"
};
readonly ulong[] _sectors =
{
2295104, 2295104, 2295104, 295264
};
readonly uint[] _sectorSize =
{
2048, 2048, 2048, 2048
};
readonly long[] _clusters =
{
2295104, 2295104, 2295104, 295264
};
readonly int[] _clusterSize =
{
2048, 2048, 2048, 2048
};
readonly string[] _udfversion =
{
"UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10"
};
readonly string[] _volumeSerial =
{
"Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified"
};
readonly string[] _oemId =
{
"*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new UDF();
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UDF.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UDF._150
{
[TestFixture]
public class Optical
{
readonly string[] _testFiles =
{
"1.50/ecs20.aif", "2.00/ecs20.aif", "2.01/ecs20.aif", "2.01/ecs20_cdrw.aif"
};
readonly ulong[] _sectors =
{
2295104, 2295104, 2295104, 295264
};
readonly uint[] _sectorSize =
{
2048, 2048, 2048, 2048
};
readonly long[] _clusters =
{
2295104, 2295104, 2295104, 295264
};
readonly int[] _clusterSize =
{
2048, 2048, 2048, 2048
};
readonly string[] _udfversion =
{
"UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10"
};
readonly string[] _volumeSerial =
{
"Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified"
};
readonly string[] _oemId =
{
"*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,140 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UDF.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UDF._150
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif",
"2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif",
"2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif",
"2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif",
"2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly string[] _udfversion =
{
"UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01",
"UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01",
"UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*",
"anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter"
};
readonly string[] _volumeSerial =
{
"595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF",
"4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF",
"5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF",
"48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF",
"709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9",
"595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF",
"5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773"
};
readonly string[] _oemId =
{
"*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF",
"*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS",
"*Linux UDFFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UDF.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UDF._200
{
[TestFixture]
public class Optical
{
readonly string[] _testFiles =
{
"1.50/ecs20.aif", "2.00/ecs20.aif", "2.01/ecs20.aif", "2.01/ecs20_cdrw.aif"
};
readonly ulong[] _sectors =
{
2295104, 2295104, 2295104, 295264
};
readonly uint[] _sectorSize =
{
2048, 2048, 2048, 2048
};
readonly long[] _clusters =
{
2295104, 2295104, 2295104, 295264
};
readonly int[] _clusterSize =
{
2048, 2048, 2048, 2048
};
readonly string[] _udfversion =
{
"UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10"
};
readonly string[] _volumeSerial =
{
"Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified"
};
readonly string[] _oemId =
{
"*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,140 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UDF.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UDF._200
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif",
"2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif",
"2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif",
"2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif",
"2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly string[] _udfversion =
{
"UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01",
"UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01",
"UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*",
"anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter"
};
readonly string[] _volumeSerial =
{
"595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF",
"4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF",
"5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF",
"48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF",
"709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9",
"595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF",
"5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773"
};
readonly string[] _oemId =
{
"*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF",
"*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS",
"*Linux UDFFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UDF.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UDF._201
{
[TestFixture]
public class Optical
{
readonly string[] _testFiles =
{
"1.50/ecs20.aif", "2.00/ecs20.aif", "2.01/ecs20.aif", "2.01/ecs20_cdrw.aif"
};
readonly ulong[] _sectors =
{
2295104, 2295104, 2295104, 295264
};
readonly uint[] _sectorSize =
{
2048, 2048, 2048, 2048
};
readonly long[] _clusters =
{
2295104, 2295104, 2295104, 295264
};
readonly int[] _clusterSize =
{
2048, 2048, 2048, 2048
};
readonly string[] _udfversion =
{
"UDF v2.01", "UDF v2.01", "UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "UDF5A5DEF48", "VolLabel", "UDF5A5DFF10"
};
readonly string[] _volumeSerial =
{
"Volume Set ID not specified", "Volume Set ID not specified", "VolumeSetId", "Volume Set ID not specified"
};
readonly string[] _oemId =
{
"*ExpressUDF", "*ExpressUDF", "*ExpressUDF", "*ExpressUDF"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,140 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UDF.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UDF._201
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif",
"2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif",
"2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif",
"2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif",
"2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly string[] _udfversion =
{
"UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01",
"UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01",
"UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*",
"anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter"
};
readonly string[] _volumeSerial =
{
"595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF",
"4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF",
"5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF",
"48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF",
"709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9",
"595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF",
"5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773"
};
readonly string[] _oemId =
{
"*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF",
"*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS",
"*Linux UDFFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,140 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UDF.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UDF._250
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif",
"2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif",
"2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif",
"2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif",
"2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly string[] _udfversion =
{
"UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01",
"UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01",
"UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*",
"anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter"
};
readonly string[] _volumeSerial =
{
"595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF",
"4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF",
"5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF",
"48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF",
"709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9",
"595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF",
"5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773"
};
readonly string[] _oemId =
{
"*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF",
"*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS",
"*Linux UDFFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,140 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UDF.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UDF._260
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"1.02/linux.aif", "1.02/macosx_10.11.aif", "1.50/linux.aif", "1.50/macosx_10.11.aif", "2.00/linux.aif",
"2.00/macosx_10.11.aif", "2.01/linux.aif", "2.01/macosx_10.11.aif", "2.50/linux.aif",
"2.50/macosx_10.11.aif", "2.60/macosx_10.11.aif", "1.50/solaris_7.aif", "1.50/solaris_9.aif",
"2.01/netbsd_7.1.aif", "1.02/linux_4.19_udf_1.02_flashdrive.aif", "1.50/linux_4.19_udf_1.50_flashdrive.aif",
"2.00/linux_4.19_udf_2.00_flashdrive.aif", "2.01/linux_4.19_udf_2.01_flashdrive.aif"
};
readonly ulong[] _sectors =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1024000, 204800, 1024000, 409600, 1024000, 614400, 1024000, 819200, 1024000, 1024000, 1228800, 8388608,
8388608, 8388608, 1024000, 1024000, 1024000, 1024000
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512
};
readonly string[] _udfversion =
{
"UDF v1.02", "UDF v1.02", "UDF v1.50", "UDF v1.50", "UDF v2.00", "UDF v2.00", "UDF v2.01", "UDF v2.01",
"UDF v2.50", "UDF v2.50", "UDF v2.60", "UDF v1.50", "UDF v1.50", "UDF v2.01", "UDF v2.01", "UDF v2.01",
"UDF v2.01", "UDF v2.01"
};
readonly string[] _volumeName =
{
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "Volume label",
"Volume label", "Volume label", "Volume label", "Volume label", "Volume label", "*NoLabel*", "*NoLabel*",
"anonymous", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter", "DicSetter"
};
readonly string[] _volumeSerial =
{
"595c5cfa38ce8b66LinuxUDF", "6D02A231 (Mac OS X newfs_udf) UDF Volume Set", "595c5d00c5b3405aLinuxUDF",
"4DD0458B (Mac OS X newfs_udf) UDF Volume Set", "595c5d07f4fc8e8dLinuxUDF",
"5D91CB4F (Mac OS X newfs_udf) UDF Volume Set", "595c5d0bee60c3bbLinuxUDF",
"48847EB3 (Mac OS X newfs_udf) UDF Volume Set", "595c5d0e4f338552LinuxUDF",
"709E84A1 (Mac OS X newfs_udf) UDF Volume Set", "78CE3237 (Mac OS X newfs_udf) UDF Volume Set", "595EB2A9",
"595EB55A", "7cc94d726669d773", "5cc7882441a86e93LinuxUDF", "5cc78f8bba4dfe00LinuxUDF",
"5cc7f4183e0d5f7aLinuxUDF", "5cc8816fcb3a3b38LinuxUDF", "595EB55A", "7cc94d726669d773"
};
readonly string[] _oemId =
{
"*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Linux UDFFS", "*Apple Mac OS X UDF FS", "*Linux UDFFS",
"*Apple Mac OS X UDF FS", "*Apple Mac OS X UDF FS", "*SUN SOLARIS UDF", "*SUN SOLARIS UDF",
"*NetBSD userland UDF", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS", "*Linux UDFFS",
"*Linux UDFFS"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Universal Disc Format",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new Aaru.Filesystems.UDF();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual(_udfversion[i], fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSetIdentifier, _testFiles[i]);
Assert.AreEqual(_oemId[i], fs.XmlFsType.SystemIdentifier, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,109 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UNIXBFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UNIXBFS
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"linux.aif"
};
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.TEST_FILES_ROOT, "Filesystems", "Boot File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem 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 _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UNIXBFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UNIXBFS
{
[TestFixture]
public class RDB
{
readonly string[] _testFiles =
{
"amix.aif"
};
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.TEST_FILES_ROOT, "Filesystems", "Boot File System (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem 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 _, null);
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]);
}
}
}
}

View File

@@ -1,264 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UNIXBFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class Unixbfs
{
readonly string[] _testFiles =
{
"amix_mf2dd.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_dshd.img.lz",
"att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9,
MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
1760, 720, 2400, 1440, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1760, 720, 2400, 1440, 2880
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512
};
readonly string[] _volumeName =
{
"Label", null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new BFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
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 UnixbfsMbr
{
readonly string[] _testFiles =
{
"linux.aif"
};
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.TEST_FILES_ROOT, "Filesystems", "Boot File System (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem 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 _, null);
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.aif"
};
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.TEST_FILES_ROOT, "Filesystems", "Boot File System (RDB)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem 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 _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,112 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : UNIXBFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.UNIXBFS
{
[TestFixture]
public class Whole
{
readonly string[] _testFiles =
{
"amix_mf2dd.adf.lz", "att_unix_svr4v2.1_dsdd.img.lz", "att_unix_svr4v2.1_dshd.img.lz",
"att_unix_svr4v2.1_mf2dd.img.lz", "att_unix_svr4v2.1_mf2hd.img.lz"
};
readonly MediaType[] _mediaTypes =
{
MediaType.CBM_AMIGA_35_DD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9,
MediaType.DOS_35_HD
};
readonly ulong[] _sectors =
{
1760, 720, 2400, 1440, 2880
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
1760, 720, 2400, 1440, 2880
};
readonly int[] _clusterSize =
{
512, 512, 512, 512, 512
};
readonly string[] _volumeName =
{
"Label", null, null, null, null
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "Boot File System",
_testFiles[i]);
IFilter filter = new LZip();
filter.Open(location);
IMediaImage image = new ZZZRawImage();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_mediaTypes[i], image.Info.MediaType, _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
IFilesystem fs = new BFS();
var wholePart = new Partition
{
Name = "Whole device",
Length = image.Info.Sectors,
Size = image.Info.Sectors * image.Info.SectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), _testFiles[i]);
fs.GetInformation(image, wholePart, out _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,120 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : XENIX.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.XENIX
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"xenix_2.3.2d.aif", "xenix_2.3.4h.aif", "scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
40960, 40960, 2097152
};
readonly uint[] _sectorSize =
{
512, 512, 512
};
readonly long[] _clusters =
{
0, 0, 0, 19624, 19624, 19624
};
readonly int[] _clusterSize =
{
1024, 1024, 1024
};
readonly string[] _volumeName =
{
"", "", ""
};
readonly string[] _volumeSerial =
{
null, null, null
};
readonly string[] _type =
{
"XENIX fs", "XENIX fs", "XENIX fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XENIX filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -26,7 +26,6 @@
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
@@ -35,10 +34,10 @@ using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
namespace Aaru.Tests.Filesystems.XENIX
{
[TestFixture]
public class Xenix
public class Whole
{
readonly string[] _testFiles =
{
@@ -121,85 +120,4 @@ namespace Aaru.Tests.Filesystems
}
}
}
[TestFixture]
public class XenixMbr
{
readonly string[] _testFiles =
{
"xenix_2.3.2d.aif", "xenix_2.3.4h.aif", "scoopenserver_5.0.7hw.aif"
};
readonly ulong[] _sectors =
{
40960, 40960, 2097152
};
readonly uint[] _sectorSize =
{
512, 512, 512
};
readonly long[] _clusters =
{
0, 0, 0, 19624, 19624, 19624
};
readonly int[] _clusterSize =
{
1024, 1024, 1024
};
readonly string[] _volumeName =
{
"", "", ""
};
readonly string[] _volumeSerial =
{
null, null, null
};
readonly string[] _type =
{
"XENIX fs", "XENIX fs", "XENIX fs"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "XENIX filesystem (MBR)",
_testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new SysVfs();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "XENIX")
{
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 _, null);
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]);
}
}
}
}

View File

@@ -0,0 +1,112 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : exFAT.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.exFAT
{
[TestFixture]
public class APM
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
262144
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
32710
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
null
};
readonly string[] _volumeSerial =
{
"595AC82C"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.exFAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Windows_NTFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,112 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : exFAT.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.exFAT
{
[TestFixture]
public class GPT
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
262144
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
32208
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
null
};
readonly string[] _volumeSerial =
{
"595ACC39"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.exFAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -0,0 +1,112 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : exFAT.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems.exFAT
{
[TestFixture]
public class MBR
{
readonly string[] _testFiles =
{
"linux.aif", "macosx_10.11.aif", "win10.aif", "winvista.aif", "linux_4.19_exfat_flashdrive.aif"
};
readonly ulong[] _sectors =
{
262144, 262144, 262144, 262144, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
32464, 32712, 32448, 32208, 15964
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 32768
};
readonly string[] _volumeName =
{
null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"603565AC", "595AC21E", "20126663", "0AC5CA52", "636E083B"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new Aaru.Filesystems.exFAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x07")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}

View File

@@ -1,261 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : exFAT.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Aaru unit testing.
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.DiscImages;
using Aaru.Filesystems;
using Aaru.Filters;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems
{
[TestFixture]
public class ExFatApm
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
262144
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
32710
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
null
};
readonly string[] _volumeSerial =
{
"595AC82C"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (APM)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new exFAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Windows_NTFS")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class ExFatGpt
{
readonly string[] _testFiles =
{
"macosx_10.11.aif"
};
readonly ulong[] _sectors =
{
262144
};
readonly uint[] _sectorSize =
{
512
};
readonly long[] _clusters =
{
32208
};
readonly int[] _clusterSize =
{
4096
};
readonly string[] _volumeName =
{
null
};
readonly string[] _volumeSerial =
{
"595ACC39"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (GPT)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new exFAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "Microsoft Basic data")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
[TestFixture]
public class ExFatMbr
{
readonly string[] _testFiles =
{
"linux.aif", "macosx_10.11.aif", "win10.aif", "winvista.aif", "linux_4.19_exfat_flashdrive.aif"
};
readonly ulong[] _sectors =
{
262144, 262144, 262144, 262144, 1024000
};
readonly uint[] _sectorSize =
{
512, 512, 512, 512, 512
};
readonly long[] _clusters =
{
32464, 32712, 32448, 32208, 15964
};
readonly int[] _clusterSize =
{
4096, 4096, 4096, 4096, 32768
};
readonly string[] _volumeName =
{
null, null, null, null, null
};
readonly string[] _volumeSerial =
{
"603565AC", "595AC21E", "20126663", "0AC5CA52", "636E083B"
};
[Test]
public void Test()
{
for(int i = 0; i < _testFiles.Length; i++)
{
string location = Path.Combine(Consts.TEST_FILES_ROOT, "Filesystems", "exFAT (MBR)", _testFiles[i]);
IFilter filter = new ZZZNoFilter();
filter.Open(location);
IMediaImage image = new AaruFormat();
Assert.AreEqual(true, image.Open(filter), _testFiles[i]);
Assert.AreEqual(_sectors[i], image.Info.Sectors, _testFiles[i]);
Assert.AreEqual(_sectorSize[i], image.Info.SectorSize, _testFiles[i]);
List<Partition> partitions = Core.Partitions.GetAll(image);
IFilesystem fs = new exFAT();
int part = -1;
for(int j = 0; j < partitions.Count; j++)
if(partitions[j].Type == "0x07")
{
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 _, null);
Assert.AreEqual(_clusters[i], fs.XmlFsType.Clusters, _testFiles[i]);
Assert.AreEqual(_clusterSize[i], fs.XmlFsType.ClusterSize, _testFiles[i]);
Assert.AreEqual("exFAT", fs.XmlFsType.Type, _testFiles[i]);
Assert.AreEqual(_volumeName[i], fs.XmlFsType.VolumeName, _testFiles[i]);
Assert.AreEqual(_volumeSerial[i], fs.XmlFsType.VolumeSerial, _testFiles[i]);
}
}
}
}