From 1eb53bbd14989c8b87dd3f4b92420d39e5e7205f Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 28 Sep 2017 12:13:19 +0100 Subject: [PATCH] Added tests for System V filesystem variants (AFS, EAFS, HTFS, DTFS, COHERENT, XENIX, SVR2 and SVR4). --- .../DiscImageChef.Tests.csproj | 12 ++ DiscImageChef.Tests/Filesystems/AFS.cs | 125 +++++++++++++++++ DiscImageChef.Tests/Filesystems/AFS_MBR.cs | 119 +++++++++++++++++ DiscImageChef.Tests/Filesystems/COHERENT.cs | 117 ++++++++++++++++ .../Filesystems/COHERENT_MBR.cs | 119 +++++++++++++++++ DiscImageChef.Tests/Filesystems/DTFS.cs | 125 +++++++++++++++++ DiscImageChef.Tests/Filesystems/DTFS_MBR.cs | 119 +++++++++++++++++ DiscImageChef.Tests/Filesystems/EAFS.cs | 125 +++++++++++++++++ DiscImageChef.Tests/Filesystems/EAFS_MBR.cs | 119 +++++++++++++++++ DiscImageChef.Tests/Filesystems/HTFS.cs | 125 +++++++++++++++++ DiscImageChef.Tests/Filesystems/HTFS_MBR.cs | 119 +++++++++++++++++ DiscImageChef.Tests/Filesystems/SysV.cs | 27 ++++ DiscImageChef.Tests/Filesystems/SysV_MBR.cs | 18 +-- DiscImageChef.Tests/Filesystems/SysV_RDB.cs | 4 +- DiscImageChef.Tests/Filesystems/XENIX.cs | 126 ++++++++++++++++++ DiscImageChef.Tests/Filesystems/XENIX_MBR.cs | 120 +++++++++++++++++ 16 files changed, 1508 insertions(+), 11 deletions(-) create mode 100644 DiscImageChef.Tests/Filesystems/AFS.cs create mode 100644 DiscImageChef.Tests/Filesystems/AFS_MBR.cs create mode 100644 DiscImageChef.Tests/Filesystems/COHERENT.cs create mode 100644 DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs create mode 100644 DiscImageChef.Tests/Filesystems/DTFS.cs create mode 100644 DiscImageChef.Tests/Filesystems/DTFS_MBR.cs create mode 100644 DiscImageChef.Tests/Filesystems/EAFS.cs create mode 100644 DiscImageChef.Tests/Filesystems/EAFS_MBR.cs create mode 100644 DiscImageChef.Tests/Filesystems/HTFS.cs create mode 100644 DiscImageChef.Tests/Filesystems/HTFS_MBR.cs create mode 100644 DiscImageChef.Tests/Filesystems/XENIX.cs create mode 100644 DiscImageChef.Tests/Filesystems/XENIX_MBR.cs diff --git a/DiscImageChef.Tests/DiscImageChef.Tests.csproj b/DiscImageChef.Tests/DiscImageChef.Tests.csproj index 2484688a8..687e23eab 100644 --- a/DiscImageChef.Tests/DiscImageChef.Tests.csproj +++ b/DiscImageChef.Tests/DiscImageChef.Tests.csproj @@ -166,6 +166,18 @@ + + + + + + + + + + + + diff --git a/DiscImageChef.Tests/Filesystems/AFS.cs b/DiscImageChef.Tests/Filesystems/AFS.cs new file mode 100644 index 000000000..b3c6ab4ef --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/AFS.cs @@ -0,0 +1,125 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : AFS.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class AFS + { + readonly string[] testfiles = { + "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.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, + }; + + readonly ulong[] sectors = { + 3360, 2400, 1440, 5760, + 2880, + }; + + readonly uint[] sectorsize = { + 512, 512, 512, 512, + 512, + }; + + readonly long[] clusters = { + 1680, 1200, 720, 2880, + 1440, + }; + + readonly int[] clustersize = { + 1024, 1024, 1024, 1024, + 1024, + }; + + readonly string[] volumename = { + "", "", "", "", + "", + }; + + readonly string[] volumeserial = { + null, null, null, null, + null, + }; + + readonly string[] type = { + "Acer Fast Filesystem", "Acer Fast Filesystem", "Acer Fast Filesystem", "Acer Fast Filesystem", + "Acer Fast Filesystem", + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "afs", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.sectors, + Size = image.ImageInfo.sectors * image.ImageInfo.sectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/AFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AFS_MBR.cs new file mode 100644 index 000000000..8b5b781ac --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/AFS_MBR.cs @@ -0,0 +1,119 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SysV_MBR.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class AFS_MBR + { + readonly string[] testfiles = { + "scoopenserver_5.0.7hw.vdi.lz" + }; + + 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, null, + }; + + readonly string[] type = { + "Acer Fast Filesystem", + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "afs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new VDI(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].Type == "XENIX") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); + fs.GetInformation(image, partitions[part], out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/COHERENT.cs b/DiscImageChef.Tests/Filesystems/COHERENT.cs new file mode 100644 index 000000000..ba5253c49 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/COHERENT.cs @@ -0,0 +1,117 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : COHERENT.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class COHERENT + { + readonly string[] testfiles = { + "coherentunix_4.2.10_dsdd.img.lz", "coherentunix_4.2.10_dshd.img.lz", "coherentunix_4.2.10_mf2dd.img.lz", "coherentunix_4.2.10_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 = { + 720, 2400, 1440, 2880, + }; + + readonly int[] clustersize = { + 512, 512, 512, 512, + }; + + readonly string[] volumename = { + "noname", "noname", "noname", "noname", + }; + + readonly string[] volumeserial = { + null, null, null, null, + null, + }; + + readonly string[] type = { + "Coherent fs", "Coherent fs", "Coherent fs", "Coherent fs", + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "coherent", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.sectors, + Size = image.ImageInfo.sectors * image.ImageInfo.sectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs b/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs new file mode 100644 index 000000000..24e33ad22 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/COHERENT_MBR.cs @@ -0,0 +1,119 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SysV_MBR.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class COHERENT_MBR + { + readonly string[] testfiles = { + "coherentunix_4.2.10.vdi.lz" + }; + + 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.TestFilesRoot, "filesystems", "coherent_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new VDI(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].Type == "0x09") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); + fs.GetInformation(image, partitions[part], out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/DTFS.cs b/DiscImageChef.Tests/Filesystems/DTFS.cs new file mode 100644 index 000000000..c9558f114 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/DTFS.cs @@ -0,0 +1,125 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : DTFS.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class DTFS + { + readonly string[] testfiles = { + "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.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, + }; + + readonly ulong[] sectors = { + 3360, 2400, 1440, 5760, + 2880, + }; + + readonly uint[] sectorsize = { + 512, 512, 512, 512, + 512, + }; + + readonly long[] clusters = { + 1680, 1200, 720, 2880, + 1440, + }; + + readonly int[] clustersize = { + 1024, 1024, 1024, 1024, + 1024, + }; + + readonly string[] volumename = { + "", "", "", "", + "", + }; + + readonly string[] volumeserial = { + null, null, null, null, + null, + }; + + readonly string[] type = { + "DTFS", "DTFS", "DTFS", "DTFS", + "DTFS", + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "dtfs", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.sectors, + Size = image.ImageInfo.sectors * image.ImageInfo.sectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs new file mode 100644 index 000000000..7b7d38cb8 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/DTFS_MBR.cs @@ -0,0 +1,119 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SysV_MBR.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class DTFS_MBR + { + readonly string[] testfiles = { + "scoopenserver_5.0.7hw.vdi.lz" + }; + + 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.TestFilesRoot, "filesystems", "dtfs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new VDI(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].Type == "XENIX") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); + fs.GetInformation(image, partitions[part], out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/EAFS.cs b/DiscImageChef.Tests/Filesystems/EAFS.cs new file mode 100644 index 000000000..a557b563e --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/EAFS.cs @@ -0,0 +1,125 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : EAFS.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class EAFS + { + readonly string[] testfiles = { + "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.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, + }; + + readonly ulong[] sectors = { + 3360, 2400, 1440, 5760, + 2880, + }; + + readonly uint[] sectorsize = { + 512, 512, 512, 512, + 512, + }; + + readonly long[] clusters = { + 1680, 1200, 720, 2880, + 1440, + }; + + readonly int[] clustersize = { + 1024, 1024, 1024, 1024, + 1024, + }; + + readonly string[] volumename = { + "", "", "", "", + "", + }; + + readonly string[] volumeserial = { + null, null, null, null, + null, + }; + + readonly string[] type = { + "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", "Extended Acer Fast Filesystem", + "Extended Acer Fast Filesystem", + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "eafs", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.sectors, + Size = image.ImageInfo.sectors * image.ImageInfo.sectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs b/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs new file mode 100644 index 000000000..4a18b0b58 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/EAFS_MBR.cs @@ -0,0 +1,119 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SysV_MBR.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class EAFS_MBR + { + readonly string[] testfiles = { + "scoopenserver_5.0.7hw.vdi.lz" + }; + + 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.TestFilesRoot, "filesystems", "eafs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new VDI(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].Type == "XENIX") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); + fs.GetInformation(image, partitions[part], out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/HTFS.cs b/DiscImageChef.Tests/Filesystems/HTFS.cs new file mode 100644 index 000000000..472dd60d7 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/HTFS.cs @@ -0,0 +1,125 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : HTFS.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class HTFS + { + readonly string[] testfiles = { + "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.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, + }; + + readonly ulong[] sectors = { + 3360, 2400, 1440, 5760, + 2880, + }; + + readonly uint[] sectorsize = { + 512, 512, 512, 512, + 512, + }; + + readonly long[] clusters = { + 1680, 1200, 720, 2880, + 1440, + }; + + readonly int[] clustersize = { + 1024, 1024, 1024, 1024, + 1024, + }; + + readonly string[] volumename = { + "", "", "", "", + "", + }; + + readonly string[] volumeserial = { + null, null, null, null, + null, + }; + + readonly string[] type = { + "HTFS", "HTFS", "HTFS", "HTFS", + "HTFS", + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "htfs", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.sectors, + Size = image.ImageInfo.sectors * image.ImageInfo.sectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs new file mode 100644 index 000000000..a37cb6b91 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/HTFS_MBR.cs @@ -0,0 +1,119 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SysV_MBR.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class HTFS_MBR + { + readonly string[] testfiles = { + "scoopenserver_5.0.7hw.vdi.lz" + }; + + 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.TestFilesRoot, "filesystems", "htfs_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new VDI(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].Type == "XENIX") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); + fs.GetInformation(image, partitions[part], out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/SysV.cs b/DiscImageChef.Tests/Filesystems/SysV.cs index 087a5214d..0c95eba79 100644 --- a/DiscImageChef.Tests/Filesystems/SysV.cs +++ b/DiscImageChef.Tests/Filesystems/SysV.cs @@ -49,38 +49,65 @@ namespace DiscImageChef.Tests.Filesystems { 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 = { "SVR2 fs", + "SVR4 fs", "SVR4 fs", "SVR4 fs", + "SVR4 fs", "SVR4 fs", "SVR4 fs", "SVR4 fs", + "SVR4 fs", }; [Test] diff --git a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs index 7fb8a3cbb..e7c2eaa7d 100644 --- a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs @@ -51,35 +51,35 @@ namespace DiscImageChef.Tests.Filesystems public class SysV_MBR { readonly string[] testfiles = { - "xenix_2.3.2d.vdi.lz", + "att_unix_svr4v2.1.vdi.lz", "att_unix_svr4v2.1_2k.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz" }; readonly ulong[] sectors = { - 40960,40960, + 1024000, 1024000, 2097152, }; readonly uint[] sectorsize = { - 512,512, + 512, 512, 512, }; readonly long[] clusters = { - 19624,19624, + 511056, 255528, 1020096, }; readonly int[] clustersize = { - 1024,1024, + 1024, 2048, 1024, }; readonly string[] volumename = { - "Volume label","Volume label", + "/usr3", "/usr3", "Volume label", }; readonly string[] volumeserial = { - null,null, + null, null, null, }; readonly string[] type = { - "XENIX fs","XENIX fs", + "SVR4 fs", "SVR2 fs", "SVR4 fs", }; [Test] @@ -99,7 +99,7 @@ namespace DiscImageChef.Tests.Filesystems int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].Type == "0x02") + if(partitions[j].Type == "UNIX: /usr" || partitions[j].Type == "XENIX") { part = j; break; diff --git a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs index 12fd3a814..304aee7ae 100644 --- a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs @@ -71,7 +71,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly string[] volumename = { - "Volume label", + "", }; readonly string[] volumeserial = { @@ -79,7 +79,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly string[] type = { - "SVR4 fs", + "SVR2 fs", }; [Test] diff --git a/DiscImageChef.Tests/Filesystems/XENIX.cs b/DiscImageChef.Tests/Filesystems/XENIX.cs new file mode 100644 index 000000000..bd828ec40 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/XENIX.cs @@ -0,0 +1,126 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : XENIX.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class XENIX + { + readonly string[] testfiles = { + "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.DMF, MediaType.DOS_525_HD, MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_ED, + MediaType.DOS_35_HD, + }; + + readonly ulong[] sectors = { + 3360, 2400, 1440, 5760, + 2880, + }; + + readonly uint[] sectorsize = { + 512, 512, 512, 512, + 512, + }; + + readonly long[] clusters = { + 0, 0, 0, 0, 0, + 1680, 1200, 720, 2880, + 1440, + }; + + readonly int[] clustersize = { + 1024, 1024, 1024, 1024, + 1024, + }; + + readonly string[] volumename = { + "", "", "", "", + "", + }; + + readonly string[] volumeserial = { + null, null, null, null, + null, + }; + + readonly string[] type = { + "XENIX fs", "XENIX fs", "XENIX fs", "XENIX fs", + "XENIX fs", + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xenix", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + Partition wholePart = new Partition + { + Name = "Whole device", + Length = image.ImageInfo.sectors, + Size = image.ImageInfo.sectors * image.ImageInfo.sectorSize + }; + Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]); + fs.GetInformation(image, wholePart, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs b/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs new file mode 100644 index 000000000..74b376435 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/XENIX_MBR.cs @@ -0,0 +1,120 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : SysV_MBR.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Filesystems +{ + [TestFixture] + public class XENIX_MBR + { + readonly string[] testfiles = { + "xenix_2.3.2d.vdi.lz", "xenix_2.3.4h.vdi.lz", "scoopenserver_5.0.7hw.vdi.lz", + }; + + 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.TestFilesRoot, "filesystems", "xenix_mbr", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new VDI(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); + Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].Type == "XENIX") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); + Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]); + fs.GetInformation(image, partitions[part], out string information); + 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]); + } + } + } +}