diff --git a/DiscImageChef.Tests/DiscImageChef.Tests.csproj b/DiscImageChef.Tests/DiscImageChef.Tests.csproj index 91f90413f..907931135 100644 --- a/DiscImageChef.Tests/DiscImageChef.Tests.csproj +++ b/DiscImageChef.Tests/DiscImageChef.Tests.csproj @@ -98,7 +98,7 @@ - + @@ -142,6 +142,17 @@ + + + + + + + + + + + diff --git a/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs b/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs new file mode 100644 index 000000000..87cca270b --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs @@ -0,0 +1,119 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Atheros_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 Atheos_MBR + { + readonly string[] testfiles = { + "syllable_0.6.7.vdi.lz", + }; + + readonly ulong[] sectors = { + 1572864, + }; + + readonly uint[] sectorsize = { + 512, + }; + + readonly long[] clusters = { + 786400, + }; + + readonly int[] clustersize = { + 1024, + }; + + readonly string[] volumename = { + "Volume label", + }; + + readonly string[] volumeserial = { + null, + }; + + [Test] + public void Test() + { + throw new System.NotImplementedException("Atheos filesystem is not yet implemented"); + /* + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "atheos_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]); + PartPlugin parts = new MBR(); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.Atheros(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].PartitionType == "0x2A") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]); + fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); + Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); + Assert.AreEqual("Atheros", 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/BeFS_APM.cs b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs index 1fc45d68f..dead3f499 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs @@ -63,7 +63,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly long[] clusters = { - 786400, 785232, + 786336, 786336, }; readonly int[] clustersize = { diff --git a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs index 5a441c311..cbab2dee1 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs @@ -51,35 +51,31 @@ namespace DiscImageChef.Tests.Filesystems public class BeFS_MBR { readonly string[] testfiles = { - "beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", "haiku_hrev51259.vdi.lz", + "beos_r3.1.vdi.lz", "beos_r4.5.vdi.lz", "haiku_hrev51259.vdi.lz","syllable_0.6.7.vdi.lz" }; readonly ulong[] sectors = { - 1572864, 1572864,8388608, + 1572864, 1572864, 8388608, 2097152, }; readonly uint[] sectorsize = { - 512, 512, 512, + 512, 512, 512, 512, }; readonly long[] clusters = { - 786400, 785232, 2096640, + 786400, 785232, 2096640, 524272, }; readonly int[] clustersize = { - 1024, 1024, 2048, + 1024, 1024, 2048, 2048, }; readonly string[] volumename = { - "Volume label","Volume label","Volume label", + "Volume label","Volume label","Volume label","Volume label", }; readonly string[] volumeserial = { - null,null,null, - }; - - readonly string[] oemid = { - null,null,null, + null,null,null,null, }; [Test] @@ -114,7 +110,6 @@ namespace DiscImageChef.Tests.Filesystems 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]); } } } diff --git a/DiscImageChef.Tests/Filesystems/FAT12.cs b/DiscImageChef.Tests/Filesystems/FAT12.cs index 8c9c4e8be..6f15f3aeb 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12.cs @@ -251,6 +251,10 @@ namespace DiscImageChef.Tests.Filesystems "openstep_4.2_mf2dd.img.lz","openstep_4.2_mf2hd.img.lz", // Solaris 2.4 "solaris_2.4_mf2dd.img.lz","solaris_2.4_mf2hd.img.lz", + // COHERENT UNIX 4.2.10 + "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", + // SCO OpenServer 5.0.7Hw + "scoopenserver_5.0.7hw_dshd.img.lz","scoopenserver_5.0.7hw_mf2dd.img.lz","scoopenserver_5.0.7hw_mf2hd.img.lz", }; readonly MediaType[] mediatypes = { @@ -436,7 +440,6 @@ namespace DiscImageChef.Tests.Filesystems // BeOS R4.5 MediaType.DOS_35_HD, // Hatari - // TODO: Incorrect media types MediaType.DOS_35_SS_DD_9,MediaType.ATARI_35_SS_DD,MediaType.ATARI_35_SS_DD_11, MediaType.DOS_35_DS_DD_9,MediaType.ATARI_35_DS_DD,MediaType.ATARI_35_DS_DD_11, MediaType.DOS_35_ED,MediaType.DOS_35_HD, @@ -452,6 +455,10 @@ namespace DiscImageChef.Tests.Filesystems MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, // Solaris 2.4 MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + // COHERENT UNIX 4.2.10 + MediaType.DOS_525_DS_DD_9,MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, + // SCO OpenServer 5.0.7Hw + MediaType.DOS_525_HD,MediaType.DOS_35_DS_DD_9,MediaType.DOS_35_HD, }; readonly ulong[] sectors = { @@ -611,6 +618,10 @@ namespace DiscImageChef.Tests.Filesystems 1440,2880, // Solaris 2.4 1440,2880, + // COHERENT UNIX 4.2.10 + 720,2400,1440,2880, + // SCO OpenServer 5.0.7Hw + 2400,1440,2880, }; readonly uint[] sectorsize = { @@ -770,6 +781,10 @@ namespace DiscImageChef.Tests.Filesystems 512,512, // Solaris 2.4 512,512, + // COHERENT UNIX 4.2.10 + 512,512,512,512, + // SCO OpenServer 5.0.7Hw + 512,512,512, }; readonly long[] clusters = { @@ -929,6 +944,10 @@ namespace DiscImageChef.Tests.Filesystems 720,2880, // Solaris 2.4 720,2880, + // COHERENT UNIX 4.2.10 + 360,2400,720,2880, + // SCO OpenServer 5.0.7Hw + 2400,1440,2880, }; readonly int[] clustersize = { @@ -1088,6 +1107,10 @@ namespace DiscImageChef.Tests.Filesystems 1024,512, // Solaris 2.4 1024,512, + // COHERENT UNIX 4.2.10 + 1024,512,1024,512, + // SCO OpenServer 5.0.7Hw + 512,512,512, }; readonly string[] volumename = { @@ -1256,6 +1279,10 @@ namespace DiscImageChef.Tests.Filesystems null,null, // Solaris 2.4 null,null, + // COHERENT UNIX 4.2.10 + "VOLUMELABEL","VOLUMELABEL","VOLUMELABEL","VOLUMELABEL", + // SCO OpenServer 5.0.7Hw + null,null,null, }; readonly string[] volumeserial = { @@ -1424,6 +1451,10 @@ namespace DiscImageChef.Tests.Filesystems null,null, // Solaris 2.4 null,null, + // COHERENT UNIX 4.2.10 + null,null,null,null, + // SCO OpenServer 5.0.7Hw + null,null,null, }; readonly string[] oemid = { @@ -1592,6 +1623,10 @@ namespace DiscImageChef.Tests.Filesystems "NEXT ","NEXT ", // Solaris 2.4 "MSDOS3.3","MSDOS3.3", + // COHERENT UNIX 4.2.10 + "COHERENT","COHERENT","COHERENT","COHERENT", + // SCO OpenServer 5.0.7Hw + "SCO BOOT","SCO BOOT","SCO BOOT", }; [Test] diff --git a/DiscImageChef.Tests/Filesystems/FAT16.cs b/DiscImageChef.Tests/Filesystems/FAT16.cs new file mode 100644 index 000000000..ae5c545f8 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/FAT16.cs @@ -0,0 +1,138 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : FAT16.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 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.TestFilesRoot, "filesystems", "fat16", 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 FAT(); + Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]); + fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/HFS_APM.cs b/DiscImageChef.Tests/Filesystems/HFS_APM.cs index 816e7b0f7..741c0994a 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_APM.cs @@ -56,7 +56,11 @@ namespace DiscImageChef.Tests.Filesystems "macos_7.5.3.vdi.lz","macos_7.5.vdi.lz","macos_7.6.vdi.lz","macos_8.0.vdi.lz", "macos_8.1.vdi.lz","macos_9.0.4.vdi.lz","macos_9.1.vdi.lz","macos_9.2.1.vdi.lz", "macos_9.2.2.vdi.lz","macosx_10.2.vdi.lz","macosx_10.3.vdi.lz","macosx_10.4.vdi.lz", - "rhapsody_dr1.vdi.lz", + "rhapsody_dr1.vdi.lz","d2_driver.vdi.lz","hdt_1.8.vdi.lz","macos_4.2.vdi.lz", + "macos_4.3.vdi.lz","macos_6.0.2.vdi.lz","macos_6.0.3.vdi.lz","macos_6.0.4.vdi.lz", + "macos_6.0.5.vdi.lz","macos_6.0.8.vdi.lz","macos_6.0.vdi.lz","macos_7.0.vdi.lz", + "macos_7.1.1.vdi.lz","parted.vdi.lz","silverlining_2.2.1.vdi.lz","speedtools_3.6.vdi.lz", + "vcpformatter_2.1.1.vdi.lz", }; readonly ulong[] sectors = { @@ -65,10 +69,18 @@ namespace DiscImageChef.Tests.Filesystems 1024000,1024000,1024000,1024000, 1024000,1024000,1024000,1024000, 1024000,1024000,1024000,1024000, - 409600, + 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, @@ -79,20 +91,28 @@ namespace DiscImageChef.Tests.Filesystems readonly long[] clusters = { 64003,51189,51189,58502, - 58502,39991,39991,39991, + 58502,41788,38950,39991, 63954,63990,63954,63954, 63954,63922,63922,63922, 63922,63884,63883,63883, - 58506, + 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,1024,1024,1024, + 3584,512,512,1024, 8192,8192,8192,8192, 8192,8192,8192,8192, 8192,8192,8192,8192, - 3584, + 3584,512,512,512, + 512,512,512,512, + 512,512,512,512, + 512,1024,512,512, + 512, }; readonly string[] volumename = { @@ -101,7 +121,11 @@ namespace DiscImageChef.Tests.Filesystems "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 = { @@ -110,6 +134,10 @@ namespace DiscImageChef.Tests.Filesystems 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, }; diff --git a/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs new file mode 100644 index 000000000..e07f6588d --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs @@ -0,0 +1,129 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : HFS_CDROM.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 HFS_CDROM + { + readonly string[] testfiles = { + "toast_3.5.7_hfs_from_volume.iso.lz","toast_3.5.7_iso9660_hfs.iso.lz", + "toast_4.1.3_hfs_from_volume.iso.lz","toast_4.1.3_iso9660_hfs.iso.lz", + // TODO: These two expect the CD-ROM to return 512 bytes sectors, that is something DIC doesn't if the extension is .iso + "toast_3.5.7_hfs_from_files.bin.lz","toast_4.1.3_hfs_from_files.bin.lz", + }; + + readonly ulong[] sectors = { + 942,1880, + 943,1882, + 6036,6116, + }; + + readonly uint[] sectorsize = { + 2048,2048, + 2048,2048, + 512,512, + }; + + 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.TestFilesRoot, "filesystems", "hfs_cdrom", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new ZZZRawImage(); + 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]); + PartPlugin parts = new AppleMap(); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.AppleHFS(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].PartitionType == "Apple_HFS") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]); + fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/MINIXv1.cs b/DiscImageChef.Tests/Filesystems/MINIXv1.cs new file mode 100644 index 000000000..07fe8eed4 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/MINIXv1.cs @@ -0,0 +1,96 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : FAT16.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 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, + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1", 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 MinixFS(); + Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]); + fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information); + Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); + Assert.AreEqual("Minix v1", fs.XmlFSType.Type, testfiles[i]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs new file mode 100644 index 000000000..5421d8261 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs @@ -0,0 +1,106 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : MINIX.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 MINIXv1_MBR + { + readonly string[] testfiles = { + "linux.vdi.lz","minix_3.1.2a.vdi.lz", + }; + + readonly ulong[] sectors = { + 262144,262144, + }; + + readonly uint[] sectorsize = { + 512,512, + }; + + readonly long[] clusters = { + 130048,130048, + }; + + readonly int[] clustersize = { + 1024,1024, + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv1_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]); + PartPlugin parts = new MBR(); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.MinixFS(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].PartitionType == "0x81") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]); + fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); + Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); + Assert.AreEqual("Minix V1", fs.XmlFSType.Type, testfiles[i]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/MINIXv2.cs b/DiscImageChef.Tests/Filesystems/MINIXv2.cs new file mode 100644 index 000000000..b6fc324c1 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/MINIXv2.cs @@ -0,0 +1,96 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : FAT16.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 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, + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2", 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 MinixFS(); + Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]); + fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information); + Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); + Assert.AreEqual("Minix v2", fs.XmlFSType.Type, testfiles[i]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/MINIX.cs b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs similarity index 94% rename from DiscImageChef.Tests/Filesystems/MINIX.cs rename to DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs index 0f304143b..9f7083a4c 100644 --- a/DiscImageChef.Tests/Filesystems/MINIX.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs @@ -48,14 +48,14 @@ using NUnit.Framework; namespace DiscImageChef.Tests.Filesystems { [TestFixture] - public class MINIX + public class MINIXv2_MBR { readonly string[] testfiles = { - "linux_v1.vdi.lz", + "minix_3.1.2a.vdi.lz", }; readonly ulong[] sectors = { - 262144, + 1024000, }; readonly uint[] sectorsize = { @@ -63,7 +63,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly long[] clusters = { - 130048, + 1000, }; readonly int[] clustersize = { @@ -75,7 +75,7 @@ namespace DiscImageChef.Tests.Filesystems { for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minix", testfiles[i]); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv2_mbr", testfiles[i]); Filter filter = new LZip(); filter.Open(location); ImagePlugin image = new VDI(); @@ -99,7 +99,7 @@ namespace DiscImageChef.Tests.Filesystems fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); - Assert.AreEqual("Minix V1", fs.XmlFSType.Type, testfiles[i]); + Assert.AreEqual("Minix V2", fs.XmlFSType.Type, testfiles[i]); } } } diff --git a/DiscImageChef.Tests/Filesystems/MINIXv3.cs b/DiscImageChef.Tests/Filesystems/MINIXv3.cs new file mode 100644 index 000000000..27d946564 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/MINIXv3.cs @@ -0,0 +1,96 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : FAT16.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 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 = { + 360, 1200, 720, 1440, + }; + + readonly int[] clustersize = { + 1024, 1024, 1024, 1024, + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3", 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 MinixFS(); + Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]); + fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information); + Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); + Assert.AreEqual("Minix v3", fs.XmlFSType.Type, testfiles[i]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs new file mode 100644 index 000000000..9adc4f4d9 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs @@ -0,0 +1,106 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : MINIX.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 MINIXv3_MBR + { + readonly string[] testfiles = { + "minix_3.1.2a.vdi.lz", + }; + + readonly ulong[] sectors = { + 4194304, + }; + + readonly uint[] sectorsize = { + 512, + }; + + readonly long[] clusters = { + 4096, + }; + + readonly int[] clustersize = { + 1024, + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "minixv3_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]); + PartPlugin parts = new MBR(); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.MinixFS(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].PartitionType == "0x81") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]); + fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); + Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); + Assert.AreEqual("Minix V3", fs.XmlFSType.Type, testfiles[i]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/QNX4.cs b/DiscImageChef.Tests/Filesystems/QNX4.cs new file mode 100644 index 000000000..9e8b6f733 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/QNX4.cs @@ -0,0 +1,96 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : FAT16.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 QNX4 + { + readonly string[] testfiles = { + "qnx_4.24_dsdd.img.lz","qnx_4.24_dshd.img.lz","qnx_4.24_mf2dd.img.lz","qnx_4.24_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, + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4", 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.QNX4(); + Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]); + fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs new file mode 100644 index 000000000..5014e24e2 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs @@ -0,0 +1,106 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : MINIX.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 QNX4_MBR + { + readonly string[] testfiles = { + "qnx_4.24.vdi.lz", + }; + + readonly ulong[] sectors = { + 1024000, + }; + + readonly uint[] sectorsize = { + 512, + }; + + readonly long[] clusters = { + 1022976, + }; + + readonly int[] clustersize = { + 512, + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "qnx4_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]); + PartPlugin parts = new MBR(); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.QNX4(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].PartitionType == "0x4D") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]); + fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); + 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]); + } + } + } +} diff --git a/DiscImageChef.Tests/Filesystems/UFS.cs b/DiscImageChef.Tests/Filesystems/UFS.cs index 68aac976e..84806970f 100644 --- a/DiscImageChef.Tests/Filesystems/UFS.cs +++ b/DiscImageChef.Tests/Filesystems/UFS.cs @@ -48,38 +48,47 @@ namespace DiscImageChef.Tests.Filesystems public class UFS { readonly string[] testfiles = { - "amix_mf2dd.adf.lz","netbsd_1.6_mf2hd.img.lz", + "amix_mf2dd.adf.lz","netbsd_1.6_mf2hd.img.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_35_HD, + MediaType.CBM_AMIGA_35_DD, MediaType.DOS_35_HD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, + MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, }; readonly ulong[] sectors = { - 1760, 2880, + 1760, 2880, 720, 2400, + 1440, 2880, }; readonly uint[] sectorsize = { + 512, 512, 512, 512, 512, 512, }; readonly long[] clusters = { - 1760, 2880, + 1760, 2880, 720, 2400, + 1440, 2880, }; readonly int[] clustersize = { + 512, 512, 512, 512, 512, 512, }; readonly string[] volumename = { - null, null, + null, null, null, null, + null, null, }; readonly string[] volumeserial = { + null, null, null, null, null, null, }; readonly string[] type = { + "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", }; diff --git a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs index 4f8a978b9..cf70a60e1 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs @@ -58,7 +58,7 @@ namespace DiscImageChef.Tests.Filesystems "ufs1/dflybsd_3.6.1.vdi.lz", "ufs1/dflybsd_4.0.5.vdi.lz", "ufs1/freebsd_6.1.vdi.lz", "ufs1/freebsd_7.0.vdi.lz", "ufs1/freebsd_8.2.vdi.lz", "ufs1/netbsd_1.6.vdi.lz", "ufs1/netbsd_7.1.vdi.lz", "ufs1/solaris_7.vdi.lz", "ufs1/solaris_7.vdi.lz", "ufs2/freebsd_6.1.vdi.lz", "ufs2/freebsd_7.0.vdi.lz", "ufs2/freebsd_8.2.vdi.lz", - "ufs2/netbsd_7.1.vdi.lz", + "ufs2/netbsd_7.1.vdi.lz", "ffs43/att_unix_svr4v2.1.vdi", }; readonly ulong[] sectors = { @@ -69,7 +69,7 @@ namespace DiscImageChef.Tests.Filesystems 262144, 262144, 262144, 262144, 262144, 262144, 262144, 262144, 262144, 262144, 262144, 262144, - 262144, + 262144, 262144, }; readonly uint[] sectorsize = { @@ -80,7 +80,7 @@ namespace DiscImageChef.Tests.Filesystems 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, + 512, 512, }; readonly long[] clusters = { @@ -91,7 +91,7 @@ namespace DiscImageChef.Tests.Filesystems 65024, 65018, 65024, 65018, 65024, 65018, 65024, 65018, 65024, 65018, 65024, 65018, - 65024, + 65024, 65024, }; readonly int[] clustersize = { @@ -102,7 +102,7 @@ namespace DiscImageChef.Tests.Filesystems 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, - 2048, + 2048, 2048, }; readonly string[] volumename = { @@ -113,7 +113,7 @@ namespace DiscImageChef.Tests.Filesystems "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", null, }; readonly string[] volumeserial = { @@ -124,7 +124,7 @@ namespace DiscImageChef.Tests.Filesystems "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", - "UNKNOWN", + "UNKNOWN", null, }; readonly string[] type = { @@ -135,7 +135,7 @@ namespace DiscImageChef.Tests.Filesystems "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS", "UFS2", "UFS2", "UFS2", - "UFS2", + "UFS2", "UFS", }; [Test] @@ -156,7 +156,7 @@ namespace DiscImageChef.Tests.Filesystems int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].PartitionType == "0x83") + if(partitions[j].PartitionType == "0x63" || partitions[j].PartitionType == "0xA8" || partitions[j].PartitionType == "0xA5" || partitions[j].PartitionType == "0xA9") { part = j; break; diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS.cs index 84e672bef..9b65b0180 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS.cs @@ -51,31 +51,38 @@ namespace DiscImageChef.Tests.Filesystems public class unixbfs { readonly string[] testfiles = { - "amix.adf.lz", + "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.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, + 1760, 720, 2400, 1440, + 2880, }; readonly uint[] sectorsize = { + 512, 512, 512, 512, 512, }; readonly long[] clusters = { - 1760, + 1760, 720, 2400, 1440, + 2880, }; readonly int[] clustersize = { + 512, 512, 512, 512, 512, }; readonly string[] volumename = { - "Label", + "Label",null,null,null, + null, }; [Test] @@ -91,7 +98,7 @@ namespace DiscImageChef.Tests.Filesystems 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.FFSPlugin(); + Filesystem fs = new DiscImageChef.Filesystems.BFS(); Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]); fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information); Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs index 69f64300a..381a4413b 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs @@ -55,7 +55,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly ulong[] sectors = { - 262144, + 1024128, }; readonly uint[] sectorsize = { diff --git a/DiscImageChef.Tests/Filesystems/XFS_MBR.cs b/DiscImageChef.Tests/Filesystems/XFS_MBR.cs new file mode 100644 index 000000000..69e9f9365 --- /dev/null +++ b/DiscImageChef.Tests/Filesystems/XFS_MBR.cs @@ -0,0 +1,116 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : btrfs.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 XFS_MBR + { + readonly string[] testfiles = { + "linux.vdi.lz", + }; + + readonly ulong[] sectors = { + 191176, + }; + + readonly uint[] sectorsize = { + 512, + }; + + readonly long[] clusters = { + 32512, + }; + + readonly int[] clustersize = { + 4096, + }; + + readonly string[] volumename = { + "VolumeLabel", + }; + + readonly string[] volumeserial = { + "unknown", + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "xfs_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]); + PartPlugin parts = new MBR(); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Filesystem fs = new DiscImageChef.Filesystems.XFS(); + int part = -1; + for(int j = 0; j < partitions.Count; j++) + { + if(partitions[j].PartitionType == "0x83") + { + part = j; + break; + } + } + Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]); + fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information); + Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]); + Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]); + Assert.AreEqual("XFS filesystem", fs.XmlFSType.Type, testfiles[i]); + Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); + Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); + } + } + } +}