From e33e1421a4355dd1a34f4e5895b089c155ee5cc6 Mon Sep 17 00:00:00 2001 From: Nick Guerrera Date: Sat, 17 Jan 2015 09:13:41 -0800 Subject: [PATCH] Remove logging of expected outcomes from MemoyMappedFile tests --- .../tests/MemoryMappedFile/CreateFromFile.cs | 1 - .../tests/MemoryMappedFile/CreateNew.cs | 1 - .../tests/MemoryMappedFile/CreateOrOpen.cs | 1 - .../MemoryMappedFile/CreateViewAccessor.cs | 5 ++--- .../tests/MemoryMappedFile/CreateViewStream.cs | 5 ++--- .../tests/MemoryMappedFile/Dispose.cs | 1 - .../tests/MemoryMappedFile/OpenExisting.cs | 1 - .../tests/MemoryMappedViewAccessor/Flush.cs | 5 ++--- .../tests/MemoryMappedViewAccessor/ReadX.cs | 7 ------- .../SafeMemoryMappedViewHandle.cs | 1 - .../tests/MemoryMappedViewAccessor/WriteX.cs | 7 ------- .../tests/MemoryMappedViewStream/Flush.cs | 5 ++--- .../tests/MemoryMappedViewStream/ReadWrite.cs | 17 ++--------------- .../SafeMemoryMappedViewHandle.cs | 1 - .../tests/MemoryMappedViewStream/SetLength.cs | 5 ++--- 15 files changed, 12 insertions(+), 51 deletions(-) diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateFromFile.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateFromFile.cs index e73e65b19817..29c1c843b196 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateFromFile.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateFromFile.cs @@ -603,7 +603,6 @@ public bool RunTest() if (iCountErrors == 0) { - Console.WriteLine("Pass: iCountTestcases==" + iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateNew.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateNew.cs index 080d771c5a70..d34e40e5299f 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateNew.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateNew.cs @@ -218,7 +218,6 @@ public bool RunTest() if (iCountErrors == 0) { - Console.WriteLine("Pass: iCountTestcases==" + iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateOrOpen.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateOrOpen.cs index 0272f5373b86..79580e231aa8 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateOrOpen.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateOrOpen.cs @@ -370,7 +370,6 @@ public bool runTest() if (iCountErrors == 0) { - Console.WriteLine("paSs. iCountTestcases==" + iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateViewAccessor.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateViewAccessor.cs index 0571011617f2..072d41a5963d 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateViewAccessor.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateViewAccessor.cs @@ -325,7 +325,6 @@ public bool runTest() if (iCountErrors == 0) { - Console.WriteLine("paSs. iCountTestcases==" + iCountTestcases); return true; } else @@ -405,7 +404,7 @@ private void RunTestLargeCapacity(Int64 capacity) } else { - Console.WriteLine("Got expected {0}", aore.GetType().ToString()); + // Got expected ArgumentOutOfRangeException } } catch (IOException ioex) @@ -421,7 +420,7 @@ private void RunTestLargeCapacity(Int64 capacity) } else { - Console.WriteLine("Got expected {0}", ioex.GetType().ToString()); + // Got expected IOException } } } diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateViewStream.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateViewStream.cs index 45b01eee09c9..1d5f59ffd40b 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateViewStream.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/CreateViewStream.cs @@ -324,7 +324,6 @@ public bool runTest() if (iCountErrors == 0) { - Console.WriteLine("paSs. iCountTestcases==" + iCountTestcases); return true; } else @@ -404,7 +403,7 @@ private void RunTestLargeCapacity(Int64 capacity) } else { - Console.WriteLine("Got expected {0}", aore.GetType().ToString()); + // Got expected ArgumentOutOfRangeException } } catch (IOException ioex) @@ -420,7 +419,7 @@ private void RunTestLargeCapacity(Int64 capacity) } else { - Console.WriteLine("Got expected {0}", ioex.GetType().ToString()); + // Got expected IOException } } } diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/Dispose.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/Dispose.cs index 61f833c067ab..f44d0103dc54 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/Dispose.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/Dispose.cs @@ -116,7 +116,6 @@ public bool runTest() if (_iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + _iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/OpenExisting.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/OpenExisting.cs index a6a4b52abc84..420ecbae40d2 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/OpenExisting.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedFile/OpenExisting.cs @@ -299,7 +299,6 @@ public bool runTest() if (iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/Flush.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/Flush.cs index e80a2140ed9d..ce582fb90045 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/Flush.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/Flush.cs @@ -59,7 +59,6 @@ public bool runTest() if (_iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + _iCountTestcases); return true; } else @@ -85,9 +84,9 @@ public void VerifyFlushException(String strLoc, MemoryMappedViewAccesso _iCountErrors++; Console.WriteLine("ERROR, {0}: No exception thrown, expected {1}", strLoc, typeof(EXCTYPE)); } - catch (EXCTYPE ex) + catch (EXCTYPE) { - Console.WriteLine("{0}: Expected, {1}: {2}", strLoc, ex.GetType(), ex.Message); + // Expected } catch (Exception ex) { diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/ReadX.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/ReadX.cs index 380cd69d15fd..6eece8a368f5 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/ReadX.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/ReadX.cs @@ -53,8 +53,6 @@ public bool runTest() // Default ViewAccessor size - whole MMF using (MemoryMappedViewAccessor view = mmf.CreateViewAccessor()) { - Console.WriteLine("View Capacity: " + view.Capacity); - // position = 0, default (zeros) VerifyRead("Loc001a", view, 0, false); VerifyRead("Loc001b", view, 0, 0); @@ -210,8 +208,6 @@ public bool runTest() // ViewAccessor starts at nonzero offset, spans remainder of MMF using (MemoryMappedViewAccessor view = mmf.CreateViewAccessor(1000, 0)) { - Console.WriteLine(view.Capacity); - // position = 0 VerifyRead("Loc111a", view, 0, true); VerifyRead("Loc111b", view, 0, 1); @@ -308,8 +304,6 @@ public bool runTest() // ViewAccessor starts at nonzero offset, with size shorter than MMF using (MemoryMappedViewAccessor view = mmf.CreateViewAccessor(2000, 10000)) { - Console.WriteLine(view.Capacity); - // position is last possible for type VerifyRead("Loc214a", view, view.Capacity - 1, true); VerifyRead("Loc214b", view, view.Capacity - 1, Byte.MaxValue); @@ -371,7 +365,6 @@ public bool runTest() if (iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/SafeMemoryMappedViewHandle.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/SafeMemoryMappedViewHandle.cs index 9011ee5e609e..3a63a7cc8517 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/SafeMemoryMappedViewHandle.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/SafeMemoryMappedViewHandle.cs @@ -61,7 +61,6 @@ public bool runTest() if (_iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + _iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/WriteX.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/WriteX.cs index 5f6a2bdbfc5c..c7a41e084ffe 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/WriteX.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewAccessor/WriteX.cs @@ -54,8 +54,6 @@ public bool runTest() // Default ViewAccessor size - whole MMF using (MemoryMappedViewAccessor view = mmf.CreateViewAccessor()) { - Console.WriteLine(view.Capacity); - // position = 0 VerifyWrite("Loc011a", view, 0, true); VerifyWrite("Loc011b", view, 0, 234); @@ -155,8 +153,6 @@ public bool runTest() // ViewAccessor starts at nonzero offset, spans remainder of MMF using (MemoryMappedViewAccessor view2 = mmf.CreateViewAccessor(1000, 0)) { - Console.WriteLine(view2.Capacity); - // position = 0 VerifyWrite("Loc111a", view2, 0, true); VerifyWrite("Loc111b", view2, 0, 1); @@ -203,8 +199,6 @@ public bool runTest() // ViewAccessor starts at nonzero offset, with size shorter than MMF using (MemoryMappedViewAccessor view = mmf.CreateViewAccessor(2000, 10000)) { - Console.WriteLine(view.Capacity); - // position is last possible for type VerifyWrite("Loc214a", view, view.Capacity - 1, true); VerifyWrite("Loc214b", view, view.Capacity - 1, (byte)251); @@ -263,7 +257,6 @@ public bool runTest() if (iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/Flush.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/Flush.cs index 35ce5752f1cb..281e734be602 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/Flush.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/Flush.cs @@ -59,7 +59,6 @@ public bool runTest() if (_iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + _iCountTestcases); return true; } else @@ -85,9 +84,9 @@ public void VerifyFlushException(String strLoc, MemoryMappedViewStream _iCountErrors++; Console.WriteLine("ERROR, {0}: No exception thrown, expected {1}", strLoc, typeof(EXCTYPE)); } - catch (EXCTYPE ex) + catch (EXCTYPE) { - Console.WriteLine("{0}: Expected, {1}: {2}", strLoc, ex.GetType(), ex.Message); + // Expected } catch (Exception ex) { diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/ReadWrite.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/ReadWrite.cs index 1c898b662497..baa0c741e772 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/ReadWrite.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/ReadWrite.cs @@ -57,8 +57,6 @@ public bool runTest() // Default ViewStream size - whole MMF using (MemoryMappedViewStream view = mmf.CreateViewStream()) { - Console.WriteLine("View Capacity: " + view.Capacity); - BinaryReader reader = new BinaryReader(view); BinaryWriter writer = new BinaryWriter(view); @@ -149,19 +147,17 @@ public bool runTest() VerifyReadDouble("Loc074", reader2, BitConverter.ToDouble(byteArray1, 7)); reader2.BaseStream.Seek(0, SeekOrigin.Begin); VerifyReadDecimal("Loc075", reader2, new Decimal(new Int32[] { BitConverter.ToInt32(byteArray1, 0), BitConverter.ToInt32(byteArray1, 4), BitConverter.ToInt32(byteArray1, 8), BitConverter.ToInt32(byteArray1, 12) })); - Console.WriteLine(reader2.BaseStream.Seek(2161, SeekOrigin.Begin)); + reader2.BaseStream.Seek(2161, SeekOrigin.Begin); VerifyReadDecimal("Loc076", reader2, dec); VerifyReadBoolean("Loc077", reader2, true); VerifyReadInt32("Loc078", reader2, 211209802); - Console.WriteLine(reader2.BaseStream.Seek(-1, SeekOrigin.End)); + reader2.BaseStream.Seek(-1, SeekOrigin.End); VerifyReadBoolean("Loc079", reader2, true); } // ViewStream starts at nonzero offset, spans remainder of MMF using (MemoryMappedViewStream view = mmf.CreateViewStream(1000, 0)) { - Console.WriteLine(view.Capacity); - BinaryReader reader = new BinaryReader(view); BinaryWriter writer = new BinaryWriter(view); @@ -253,8 +249,6 @@ public bool runTest() // ViewStream starts at nonzero offset, with size shorter than MMF using (MemoryMappedViewStream view = mmf.CreateViewStream(2000, 10000)) { - Console.WriteLine(view.Capacity); - BinaryReader reader = new BinaryReader(view); BinaryWriter writer = new BinaryWriter(view); @@ -350,8 +344,6 @@ public bool runTest() { using (MemoryMappedViewStream view = mmf.CreateViewStream()) { - Console.WriteLine(view.Capacity); - BinaryReader reader = new BinaryReader(view); BinaryWriter writer = new BinaryWriter(view); @@ -434,8 +426,6 @@ public bool runTest() using (MemoryMappedViewStream view = mmf.CreateViewStream(0, 10000, MemoryMappedFileAccess.CopyOnWrite)) { - Console.WriteLine(view.Capacity); - BinaryReader reader = new BinaryReader(view); BinaryWriter writer = new BinaryWriter(view); @@ -463,8 +453,6 @@ public bool runTest() using (MemoryMappedViewStream view = mmf.CreateViewStream(0, 10000, MemoryMappedFileAccess.Read)) { - Console.WriteLine(view.Capacity); - BinaryReader reader = new BinaryReader(view); // Read existing values @@ -492,7 +480,6 @@ public bool runTest() if (iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/SafeMemoryMappedViewHandle.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/SafeMemoryMappedViewHandle.cs index 7c0859f720df..b6dd667add3e 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/SafeMemoryMappedViewHandle.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/SafeMemoryMappedViewHandle.cs @@ -61,7 +61,6 @@ public bool runTest() if (_iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + _iCountTestcases); return true; } else diff --git a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/SetLength.cs b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/SetLength.cs index 50e5eb47045b..0d4ab415e4ce 100644 --- a/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/SetLength.cs +++ b/src/System.IO.MemoryMappedFiles/tests/MemoryMappedViewStream/SetLength.cs @@ -52,9 +52,9 @@ public bool runTest() _iCountErrors++; Console.WriteLine("ERROR, No exception thrown, expected NotSupportedException"); } - catch (NotSupportedException ex) + catch (NotSupportedException) { - Console.WriteLine("Expected, {0}: {1}", ex.GetType(), ex.Message); + // Expected } catch (Exception ex) { @@ -77,7 +77,6 @@ public bool runTest() if (_iCountErrors == 0) { - Console.WriteLine("Pass. iCountTestcases==" + _iCountTestcases); return true; } else