remove writedump tests for diagnostics client tests (#1741)
authorSung Yoon Whang <suwhang@microsoft.com>
Wed, 18 Nov 2020 17:26:03 +0000 (09:26 -0800)
committerGitHub <noreply@github.com>
Wed, 18 Nov 2020 17:26:03 +0000 (09:26 -0800)
src/tests/Microsoft.Diagnostics.NETCore.Client/WriteDumpTests.cs [deleted file]

diff --git a/src/tests/Microsoft.Diagnostics.NETCore.Client/WriteDumpTests.cs b/src/tests/Microsoft.Diagnostics.NETCore.Client/WriteDumpTests.cs
deleted file mode 100644 (file)
index ff3e0d8..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Tracing;
-using System.IO;
-using System.Runtime.InteropServices;
-using Xunit;
-using Xunit.Abstractions;
-
-using Microsoft.Diagnostics.Tracing;
-using Microsoft.Diagnostics.TestHelpers;
-using Microsoft.Diagnostics.NETCore.Client;
-
-namespace Microsoft.Diagnostics.NETCore.Client
-{
-    public class WriteDumpTests
-    {
-        private readonly ITestOutputHelper output;
-
-        public WriteDumpTests(ITestOutputHelper outputHelper)
-        {
-            output = outputHelper;
-        }
-
-        /// <summary>
-        /// A simple test that writes a single dump file
-        /// </summary>
-        [Fact]
-        public void BasicWriteDumpTest()
-        {
-            if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
-            {
-                var dumpPath = "./myDump.dmp";
-                using TestRunner runner = new TestRunner(CommonHelper.GetTraceePathWithArgs(), output);
-                runner.Start(timeoutInMSPipeCreation: 3000);
-                DiagnosticsClient client = new DiagnosticsClient(runner.Pid);
-
-                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Environment.Version.ToString().StartsWith("3"))
-                {
-                    Assert.Throws<UnsupportedCommandException>(() => client.WriteDump(DumpType.Normal, dumpPath));
-                }
-                else
-                {
-                    output.WriteLine($"Requesting dump at {DateTime.Now.ToString()}");
-                    client.WriteDump(DumpType.Normal, dumpPath);
-                    Assert.True(File.Exists(dumpPath));
-                    File.Delete(dumpPath);
-                }
-
-                runner.Stop();
-            }
-        }
-
-        /// <summary>
-        /// A test that writes all the different types of dump file
-        /// </summary>
-        [Fact(Skip = "Test often times out in official builds/PRs. See https://github.com/dotnet/diagnostics/issues/913")]
-        public void WriteAllDumpTypesTest()
-        {
-            var normalDumpPath = "./myDump-normal.dmp";
-            var heapDumpPath = "./myDump-heap.dmp";
-            var triageDumpPath = "./myDump-triage.dmp";
-            var fullDumpPath = "./myDump-full.dmp";
-            using TestRunner runner = new TestRunner(CommonHelper.GetTraceePathWithArgs(), output);
-            runner.Start(timeoutInMSPipeCreation: 3000);
-            DiagnosticsClient client = new DiagnosticsClient(runner.Pid);
-
-            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
-            {
-                Assert.Throws<UnsupportedCommandException>(() => client.WriteDump(DumpType.Normal, normalDumpPath));
-                Assert.Throws<UnsupportedCommandException>(() => client.WriteDump(DumpType.WithHeap, heapDumpPath));
-                Assert.Throws<UnsupportedCommandException>(() => client.WriteDump(DumpType.Triage, triageDumpPath));
-                Assert.Throws<UnsupportedCommandException>(() => client.WriteDump(DumpType.Full, fullDumpPath));
-            }
-            else
-            {
-                // Write each type of dump
-                output.WriteLine($"Requesting dump at {DateTime.Now.ToString()}");
-                client.WriteDump(DumpType.Normal, normalDumpPath);
-                client.WriteDump(DumpType.WithHeap, heapDumpPath);
-                client.WriteDump(DumpType.Triage, triageDumpPath);
-                client.WriteDump(DumpType.Full, fullDumpPath);
-
-                // Check they were all created
-                Assert.True(File.Exists(normalDumpPath));
-                Assert.True(File.Exists(heapDumpPath));
-                Assert.True(File.Exists(triageDumpPath));
-                Assert.True(File.Exists(fullDumpPath));
-
-                // Remove them
-                File.Delete(normalDumpPath);
-                File.Delete(heapDumpPath);
-                File.Delete(triageDumpPath);
-                File.Delete(fullDumpPath);
-            }
-            runner.Stop();
-        }
-
-        /// <summary>
-        /// A test that tries to write a dump of a non-existent process
-        /// </summary>
-        [Fact]
-        public void WriteDumpFailTest()
-        {
-            List<int> pids = new List<int>(DiagnosticsClient.GetPublishedProcesses());
-            int arbitraryPid = 1;
-            string dumpPath = "./myDump.dmp";
-            while (pids.Contains(arbitraryPid))
-            {
-                arbitraryPid += 1;
-            }
-
-            var client = new DiagnosticsClient(arbitraryPid);
-            Assert.Throws<ServerNotAvailableException>(() => client.WriteDump(DumpType.Normal, dumpPath));
-        }
-    }
-}