From 562e2a659ea6e3cd2a7da916209134b9ccc1ff34 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 26 Jan 2022 15:26:45 +0000 Subject: [PATCH 01/11] Add a new more complex unit test --- LibZipSharp.UnitTest/ZipTests.cs | 125 ++++++++++++++++++++ LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs | 10 +- 2 files changed, 133 insertions(+), 2 deletions(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index f5b2b2fd..6e46a1a8 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -11,6 +11,61 @@ namespace Tests { public class ZipTests { + public class ZipWrapper : IDisposable { + ZipArchive archive; + string filename; + public ZipArchive Archive => archive; + + public ZipWrapper (string file, FileMode mode = FileMode.CreateNew) { + filename = file; + archive = ZipArchive.Open (filename, mode); + } + + public void Flush () { + if (archive != null) { + archive.Close (); + archive.Dispose (); + archive = null; + } + archive = ZipArchive.Open (filename, FileMode.Open); + } + + /// + /// HACK: aapt2 is creating zip entries on Windows such as `assets\subfolder/asset2.txt` + /// + public void FixupWindowsPathSeparators (Action onRename) + { + bool modified = false; + foreach (var entry in archive) { + if (entry.FullName.Contains ("\\")) { + var name = entry.FullName.Replace ('\\', '/'); + onRename?.Invoke (entry.FullName, name); + entry.Rename (name); + modified = true; + } + } + if (modified) { + Flush (); + } + } + + public void Dispose () + { + Dispose(true); + GC.SuppressFinalize (this); + } + + protected virtual void Dispose(bool disposing) { + if (disposing) { + if (archive != null) { + archive.Close (); + archive.Dispose (); + archive = null; + } + } + } + } + void AssertEntryIsValid (ZipEntry e, string expectedArchivePath, EntryPermissions permissions = EntryPermissions.Default, CompressionMethod compression = CompressionMethod.Store) { @@ -257,6 +312,76 @@ public void CheckForUnknownCompressionMethods () } } + [Test] + [NonParallelizable] + //[Repeat (100)] + public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive) + { + string filePath = Path.GetFullPath ("packaged_resources"); + if (!File.Exists (filePath)) { + filePath = Path.GetFullPath (Path.Combine ("/Users/dean/Documents/Sandbox/dellis1972/LibZipSharp/LibZipSharp.UnitTest", "packaged_resources")); + } + + if (File.Exists ("base.zip")) + File.Delete ("base.zip"); + + var mode = FileMode.Create; + if (copyArchive) { + File.Copy (filePath, "base.zip"); + mode = FileMode.Open; + } + + List<(string name, CompressionMethod c, ulong size)> expectedFiles = new List<(string name, CompressionMethod c, ulong size)> (); + // use a specific seed so we always generate the same files + Random rnd = new Random (3456464); + + using (var baseZip = new ZipWrapper ("base.zip", mode)) { + if (!copyArchive) { + using (var zip = ZipArchive.Open (filePath, FileMode.Open)) { + foreach (var entry in zip) { + var entryName = entry.FullName; + if (entryName.Contains ("\\")) { + entryName = entryName.Replace ('\\', '/'); + } + var ms = new MemoryStream (); + entry.Extract (ms); + TestContext.Out.WriteLine ($"Adding {entryName} to base.zip"); + baseZip.Archive.AddStream (ms, entryName, compressionMethod: entry.CompressionMethod); + expectedFiles.Add ((entryName, entry.CompressionMethod, entry.Size)); + } + } + } + + baseZip.FixupWindowsPathSeparators ((a, b) => TestContext.Out.WriteLine ($"Fixing up malformed entry `{a}` -> `{b}`")); + + for (int i=0; i< 200; i++) { + uint fileSize = (uint)rnd.Next (341, 3535592); + byte[] buffer = new byte[fileSize]; + rnd.NextBytes (buffer); + CompressionMethod compression = rnd.NextDouble () < 0.2 ? CompressionMethod.Deflate : CompressionMethod.Store; + + var ms = new MemoryStream (buffer); + ms.Position = 0; + string entryName = $"temp/file_{i}_size_{fileSize}_{compression}.bin"; + TestContext.Out.WriteLine ($"Adding {entryName} to base.zip"); + baseZip.Archive.AddStream (ms, entryName, compressionMethod: compression); + expectedFiles.Add ((entryName, compression, fileSize)); + + if (rnd.NextDouble () < 0.2) + baseZip.Flush (); + } + + } + using (var zip = ZipArchive.Open ("base.zip", FileMode.Open, strictConsistencyChecks: true)) { + foreach (var file in expectedFiles) { + Assert.IsTrue (zip.ContainsEntry (file.name), $"zip should contain {file}."); + var e = zip.ReadEntry(file.name); + Assert.AreEqual (file.size, e.Size, $"{file} should be {file.size} but was {e.Size}."); + Assert.AreEqual (file.c, e.CompressionMethod, $"{file} should be {file.c} but was {e.CompressionMethod}."); + } + } + } + [Test] public void InMemoryZipFile () { diff --git a/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs b/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs index e9ecceab..9be642ca 100644 --- a/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs +++ b/LibZipSharp/Xamarin.Tools.Zip/ZipArchive.cs @@ -852,8 +852,14 @@ internal static unsafe Int64 stream_callback (IntPtr state, IntPtr data, UInt64 length = (int)Math.Min (stream.Length - stream.Position, length); buffer = ArrayPool.Shared.Rent (length); try { - int bytesRead = stream.Read (buffer, 0, length); - Marshal.Copy (buffer, 0, data, bytesRead); + int bytesRead = 0; + int startIndex = 0; + while (length > 0) { + bytesRead = stream.Read (buffer, 0, length); + Marshal.Copy (buffer, startIndex, data, bytesRead); + startIndex += bytesRead; + length -= bytesRead; + } return bytesRead; } finally { ArrayPool.Shared.Return (buffer); From 9966f6f112208b60058739ff5b1e1dbc37a87cec Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 26 Jan 2022 15:59:20 +0000 Subject: [PATCH 02/11] Add a new more complex unit test --- LibZipSharp.UnitTest/ZipTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index 6e46a1a8..0602cb28 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -319,7 +319,7 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive { string filePath = Path.GetFullPath ("packaged_resources"); if (!File.Exists (filePath)) { - filePath = Path.GetFullPath (Path.Combine ("/Users/dean/Documents/Sandbox/dellis1972/LibZipSharp/LibZipSharp.UnitTest", "packaged_resources")); + filePath = Path.GetFullPath (Path.Combine ("LibZipSharp.UnitTest", "packaged_resources")); } if (File.Exists ("base.zip")) From 61fc6a44aee5fd1b9a73fcb2c58dbd742c38e207 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 26 Jan 2022 16:09:41 +0000 Subject: [PATCH 03/11] Test both AddFile and AddStream --- LibZipSharp.UnitTest/ZipTests.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index 0602cb28..fed6e721 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -315,11 +315,11 @@ public void CheckForUnknownCompressionMethods () [Test] [NonParallelizable] //[Repeat (100)] - public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive) + public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive, [Values (true, false)] bool useFiles) { string filePath = Path.GetFullPath ("packaged_resources"); if (!File.Exists (filePath)) { - filePath = Path.GetFullPath (Path.Combine ("LibZipSharp.UnitTest", "packaged_resources")); + filePath = Path.GetFullPath (Path.Combine ("/Users/dean/Documents/Sandbox/dellis1972/LibZipSharp/LibZipSharp.UnitTest", "packaged_resources")); } if (File.Exists ("base.zip")) @@ -359,12 +359,17 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive byte[] buffer = new byte[fileSize]; rnd.NextBytes (buffer); CompressionMethod compression = rnd.NextDouble () < 0.2 ? CompressionMethod.Deflate : CompressionMethod.Store; - - var ms = new MemoryStream (buffer); - ms.Position = 0; string entryName = $"temp/file_{i}_size_{fileSize}_{compression}.bin"; TestContext.Out.WriteLine ($"Adding {entryName} to base.zip"); - baseZip.Archive.AddStream (ms, entryName, compressionMethod: compression); + if (useFiles) { + Directory.CreateDirectory ("temp"); + File.WriteAllBytes (entryName, buffer); + baseZip.Archive.AddFile (entryName, compressionMethod: compression); + } else { + var ms = new MemoryStream (buffer); + ms.Position = 0; + baseZip.Archive.AddStream (ms, entryName, compressionMethod: compression); + } expectedFiles.Add ((entryName, compression, fileSize)); if (rnd.NextDouble () < 0.2) From 4aa47e605ce716a8832cf972a3d4c4951e5d8256 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 26 Jan 2022 16:17:29 +0000 Subject: [PATCH 04/11] ff --- LibZipSharp.UnitTest/ZipTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index fed6e721..4390b016 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -319,7 +319,7 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive { string filePath = Path.GetFullPath ("packaged_resources"); if (!File.Exists (filePath)) { - filePath = Path.GetFullPath (Path.Combine ("/Users/dean/Documents/Sandbox/dellis1972/LibZipSharp/LibZipSharp.UnitTest", "packaged_resources")); + filePath = Path.GetFullPath (Path.Combine ("LibZipSharp.UnitTest", "packaged_resources")); } if (File.Exists ("base.zip")) @@ -358,7 +358,7 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive uint fileSize = (uint)rnd.Next (341, 3535592); byte[] buffer = new byte[fileSize]; rnd.NextBytes (buffer); - CompressionMethod compression = rnd.NextDouble () < 0.2 ? CompressionMethod.Deflate : CompressionMethod.Store; + CompressionMethod compression = rnd.NextDouble () < 0.8 ? CompressionMethod.Deflate : CompressionMethod.Store; string entryName = $"temp/file_{i}_size_{fileSize}_{compression}.bin"; TestContext.Out.WriteLine ($"Adding {entryName} to base.zip"); if (useFiles) { From 9bfb0166fa1504e6e6aaeadf8d3a1a7ca9909485 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Fri, 28 Jan 2022 10:25:00 +0000 Subject: [PATCH 05/11] Repeat the test, check we do have entires which are copied --- LibZipSharp.UnitTest/ZipTests.cs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index 4390b016..8ebd98ac 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -314,7 +314,7 @@ public void CheckForUnknownCompressionMethods () [Test] [NonParallelizable] - //[Repeat (100)] + [Repeat (100)] public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive, [Values (true, false)] bool useFiles) { string filePath = Path.GetFullPath ("packaged_resources"); @@ -336,19 +336,19 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive Random rnd = new Random (3456464); using (var baseZip = new ZipWrapper ("base.zip", mode)) { - if (!copyArchive) { - using (var zip = ZipArchive.Open (filePath, FileMode.Open)) { - foreach (var entry in zip) { - var entryName = entry.FullName; - if (entryName.Contains ("\\")) { - entryName = entryName.Replace ('\\', '/'); - } - var ms = new MemoryStream (); - entry.Extract (ms); - TestContext.Out.WriteLine ($"Adding {entryName} to base.zip"); - baseZip.Archive.AddStream (ms, entryName, compressionMethod: entry.CompressionMethod); - expectedFiles.Add ((entryName, entry.CompressionMethod, entry.Size)); + using (var zip = ZipArchive.Open (filePath, FileMode.Open)) { + foreach (var entry in zip) { + var entryName = entry.FullName; + if (entryName.Contains ("\\")) { + entryName = entryName.Replace ('\\', '/'); } + expectedFiles.Add ((entryName, entry.CompressionMethod, entry.Size)); + if (!copyArchive) + continue; + var ms = new MemoryStream (); + entry.Extract (ms); + TestContext.Out.WriteLine ($"Adding {entryName} to base.zip"); + baseZip.Archive.AddStream (ms, entryName, compressionMethod: entry.CompressionMethod); } } @@ -385,6 +385,9 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive Assert.AreEqual (file.c, e.CompressionMethod, $"{file} should be {file.c} but was {e.CompressionMethod}."); } } + + if (File.Exists ("base.zip")) + File.Delete ("base.zip"); } [Test] From 4c9d1bdfea690aa0a89b90df84a3f263e14968a5 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Fri, 28 Jan 2022 11:56:01 +0000 Subject: [PATCH 06/11] fix a few issues --- LibZipSharp.UnitTest/ZipTests.cs | 82 ++++++-------------------------- 1 file changed, 15 insertions(+), 67 deletions(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index 8ebd98ac..4d7ef43a 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -11,61 +11,6 @@ namespace Tests { public class ZipTests { - public class ZipWrapper : IDisposable { - ZipArchive archive; - string filename; - public ZipArchive Archive => archive; - - public ZipWrapper (string file, FileMode mode = FileMode.CreateNew) { - filename = file; - archive = ZipArchive.Open (filename, mode); - } - - public void Flush () { - if (archive != null) { - archive.Close (); - archive.Dispose (); - archive = null; - } - archive = ZipArchive.Open (filename, FileMode.Open); - } - - /// - /// HACK: aapt2 is creating zip entries on Windows such as `assets\subfolder/asset2.txt` - /// - public void FixupWindowsPathSeparators (Action onRename) - { - bool modified = false; - foreach (var entry in archive) { - if (entry.FullName.Contains ("\\")) { - var name = entry.FullName.Replace ('\\', '/'); - onRename?.Invoke (entry.FullName, name); - entry.Rename (name); - modified = true; - } - } - if (modified) { - Flush (); - } - } - - public void Dispose () - { - Dispose(true); - GC.SuppressFinalize (this); - } - - protected virtual void Dispose(bool disposing) { - if (disposing) { - if (archive != null) { - archive.Close (); - archive.Dispose (); - archive = null; - } - } - } - } - void AssertEntryIsValid (ZipEntry e, string expectedArchivePath, EntryPermissions permissions = EntryPermissions.Default, CompressionMethod compression = CompressionMethod.Store) { @@ -319,15 +264,17 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive { string filePath = Path.GetFullPath ("packaged_resources"); if (!File.Exists (filePath)) { - filePath = Path.GetFullPath (Path.Combine ("LibZipSharp.UnitTest", "packaged_resources")); + filePath = Path.GetFullPath (Path.Combine ("/Users/dean/Documents/Sandbox/dellis1972/LibZipSharp/LibZipSharp.UnitTest", "packaged_resources")); } - if (File.Exists ("base.zip")) - File.Delete ("base.zip"); + string baseArchive = $"base_{copyArchive}_{useFiles}.zip"; + + if (File.Exists (baseArchive)) + File.Delete (baseArchive); var mode = FileMode.Create; if (copyArchive) { - File.Copy (filePath, "base.zip"); + File.Copy (filePath, baseArchive); mode = FileMode.Open; } @@ -335,7 +282,7 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive // use a specific seed so we always generate the same files Random rnd = new Random (3456464); - using (var baseZip = new ZipWrapper ("base.zip", mode)) { + using (var baseZip = new ZipWrapper (baseArchive, mode)) { using (var zip = ZipArchive.Open (filePath, FileMode.Open)) { foreach (var entry in zip) { var entryName = entry.FullName; @@ -343,7 +290,7 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive entryName = entryName.Replace ('\\', '/'); } expectedFiles.Add ((entryName, entry.CompressionMethod, entry.Size)); - if (!copyArchive) + if (copyArchive) continue; var ms = new MemoryStream (); entry.Extract (ms); @@ -360,24 +307,25 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive rnd.NextBytes (buffer); CompressionMethod compression = rnd.NextDouble () < 0.8 ? CompressionMethod.Deflate : CompressionMethod.Store; string entryName = $"temp/file_{i}_size_{fileSize}_{compression}.bin"; + string archivePath = rnd.NextDouble () < 0.3 ? entryName : Path.GetFileName (entryName); TestContext.Out.WriteLine ($"Adding {entryName} to base.zip"); if (useFiles) { Directory.CreateDirectory ("temp"); File.WriteAllBytes (entryName, buffer); - baseZip.Archive.AddFile (entryName, compressionMethod: compression); + baseZip.Archive.AddFile (entryName, archivePath, compressionMethod: compression); } else { var ms = new MemoryStream (buffer); ms.Position = 0; - baseZip.Archive.AddStream (ms, entryName, compressionMethod: compression); + baseZip.Archive.AddStream (ms, archivePath, compressionMethod: compression); } - expectedFiles.Add ((entryName, compression, fileSize)); + expectedFiles.Add ((archivePath, compression, fileSize)); if (rnd.NextDouble () < 0.2) baseZip.Flush (); } } - using (var zip = ZipArchive.Open ("base.zip", FileMode.Open, strictConsistencyChecks: true)) { + using (var zip = ZipArchive.Open (baseArchive, FileMode.Open, strictConsistencyChecks: true)) { foreach (var file in expectedFiles) { Assert.IsTrue (zip.ContainsEntry (file.name), $"zip should contain {file}."); var e = zip.ReadEntry(file.name); @@ -386,8 +334,8 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive } } - if (File.Exists ("base.zip")) - File.Delete ("base.zip"); + if (File.Exists (baseArchive)) + File.Delete (baseArchive); } [Test] From 0de6bc125402cd2f952f82339505dc0885b22a2e Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Fri, 28 Jan 2022 11:56:37 +0000 Subject: [PATCH 07/11] fix a few issues --- LibZipSharp.UnitTest/ZipTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index 4d7ef43a..8401b3ea 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -264,7 +264,7 @@ public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive { string filePath = Path.GetFullPath ("packaged_resources"); if (!File.Exists (filePath)) { - filePath = Path.GetFullPath (Path.Combine ("/Users/dean/Documents/Sandbox/dellis1972/LibZipSharp/LibZipSharp.UnitTest", "packaged_resources")); + filePath = Path.GetFullPath (Path.Combine ("LibZipSharp.UnitTest", "packaged_resources")); } string baseArchive = $"base_{copyArchive}_{useFiles}.zip"; From e460d8cd5dcfdcf01d328a97a1cf453b6a1bae92 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Fri, 28 Jan 2022 12:14:36 +0000 Subject: [PATCH 08/11] Add missing file --- LibZipSharp.UnitTest/ZipWrapper.cs | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 LibZipSharp.UnitTest/ZipWrapper.cs diff --git a/LibZipSharp.UnitTest/ZipWrapper.cs b/LibZipSharp.UnitTest/ZipWrapper.cs new file mode 100644 index 00000000..23bbbd2f --- /dev/null +++ b/LibZipSharp.UnitTest/ZipWrapper.cs @@ -0,0 +1,65 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading; +using Xamarin.Tools.Zip; +using Unix = Mono.Unix; + +namespace Tests { + public class ZipWrapper : IDisposable { + ZipArchive archive; + string filename; + public ZipArchive Archive => archive; + + public ZipWrapper (string file, FileMode mode = FileMode.CreateNew) { + filename = file; + archive = ZipArchive.Open (filename, mode); + } + + public void Flush () { + if (archive != null) { + archive.Close (); + archive.Dispose (); + archive = null; + } + archive = ZipArchive.Open (filename, FileMode.Open); + } + + /// + /// HACK: aapt2 is creating zip entries on Windows such as `assets\subfolder/asset2.txt` + /// + public void FixupWindowsPathSeparators (Action onRename) + { + bool modified = false; + foreach (var entry in archive) { + if (entry.FullName.Contains ("\\")) { + var name = entry.FullName.Replace ('\\', '/'); + onRename?.Invoke (entry.FullName, name); + entry.Rename (name); + modified = true; + } + } + if (modified) { + Flush (); + } + } + + public void Dispose () + { + Dispose(true); + GC.SuppressFinalize (this); + } + + protected virtual void Dispose(bool disposing) { + if (disposing) { + if (archive != null) { + archive.Close (); + archive.Dispose (); + archive = null; + } + } + } + } +} From e06cd9059366483c9e454e5903c12c190500e6f6 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Fri, 28 Jan 2022 14:30:10 +0000 Subject: [PATCH 09/11] run a test 10 times --- LibZipSharp.UnitTest/ZipTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index 8401b3ea..72a06b6e 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -259,7 +259,7 @@ public void CheckForUnknownCompressionMethods () [Test] [NonParallelizable] - [Repeat (100)] + [Repeat (10)] public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive, [Values (true, false)] bool useFiles) { string filePath = Path.GetFullPath ("packaged_resources"); From 99e40fce2bec9f793bc709dfef3e31ece05e4920 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 31 Jan 2022 10:12:58 +0000 Subject: [PATCH 10/11] Remove Repeat on Test to make it run in under 30 mins --- LibZipSharp.UnitTest/ZipTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index 72a06b6e..ac4d570f 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -258,8 +258,6 @@ public void CheckForUnknownCompressionMethods () } [Test] - [NonParallelizable] - [Repeat (10)] public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive, [Values (true, false)] bool useFiles) { string filePath = Path.GetFullPath ("packaged_resources"); From b700bd71c4ac8ca509ea712b6515f6fa0025ecc1 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Mon, 31 Jan 2022 14:17:43 +0000 Subject: [PATCH 11/11] Fix Typo --- LibZipSharp.UnitTest/ZipTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibZipSharp.UnitTest/ZipTests.cs b/LibZipSharp.UnitTest/ZipTests.cs index ac4d570f..fba04d95 100644 --- a/LibZipSharp.UnitTest/ZipTests.cs +++ b/LibZipSharp.UnitTest/ZipTests.cs @@ -258,7 +258,7 @@ public void CheckForUnknownCompressionMethods () } [Test] - public void SimilateXamarinAndroidUsage ([Values (true, false)] bool copyArchive, [Values (true, false)] bool useFiles) + public void SimulateXamarinAndroidUsage ([Values (true, false)] bool copyArchive, [Values (true, false)] bool useFiles) { string filePath = Path.GetFullPath ("packaged_resources"); if (!File.Exists (filePath)) {