From c403cd930a2cc79d6a458ffae9c4159277b71737 Mon Sep 17 00:00:00 2001 From: Ross Wollman Date: Mon, 15 Jul 2024 11:16:12 -0700 Subject: [PATCH] chore: remove unused coyote bits (#2816) --- .../CoyoteTestOutputLogger.cs | 160 ------------------ .../Test.UnitTests.Sarif.Driver.csproj | 9 +- .../rewrite.coyote.Windows.Debug.json | 4 - .../rewrite.coyote.Windows.Release.json | 4 - .../rewrite.coyote.nonWindows.Debug.json | 4 - .../rewrite.coyote.nonWindows.Release.json | 4 - .../rewriteUnitTests.ps1 | 12 -- 7 files changed, 1 insertion(+), 196 deletions(-) delete mode 100644 src/Test.UnitTests.Sarif.Driver/CoyoteTestOutputLogger.cs delete mode 100644 src/Test.UnitTests.Sarif.Driver/rewrite.coyote.Windows.Debug.json delete mode 100644 src/Test.UnitTests.Sarif.Driver/rewrite.coyote.Windows.Release.json delete mode 100644 src/Test.UnitTests.Sarif.Driver/rewrite.coyote.nonWindows.Debug.json delete mode 100644 src/Test.UnitTests.Sarif.Driver/rewrite.coyote.nonWindows.Release.json delete mode 100644 src/Test.UnitTests.Sarif.Driver/rewriteUnitTests.ps1 diff --git a/src/Test.UnitTests.Sarif.Driver/CoyoteTestOutputLogger.cs b/src/Test.UnitTests.Sarif.Driver/CoyoteTestOutputLogger.cs deleted file mode 100644 index ce2c235db..000000000 --- a/src/Test.UnitTests.Sarif.Driver/CoyoteTestOutputLogger.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.IO; -using System.Text; - -using Microsoft.Coyote.Logging; - -using Xunit.Abstractions; - -namespace Microsoft.CodeAnalysis.Sarif.Driver -{ - /// - /// Logger that writes to the test output. - /// - public sealed class CoyoteTestOutputLogger : TextWriter, ILogger - { - /// - /// Underlying test output. - /// - private readonly ITestOutputHelper TestOutput; - - /// - /// Saves the log until the end of the test. - /// - private readonly StringBuilder Log; - - /// - /// Serializes access to the string writer. - /// - private readonly object Lock; - - /// - public TextWriter TextWriter => this; - - /// - public override Encoding Encoding => Encoding.Unicode; - - /// - /// True if this logger is disposed, else false. - /// - private bool IsDisposed; - - /// - /// Initializes a new instance of the class. - /// - /// The test output helper. - public CoyoteTestOutputLogger(ITestOutputHelper output) - { - this.TestOutput = output; - this.Log = new StringBuilder(); - this.Lock = new object(); - this.IsDisposed = false; - } - - /// - public override void Write(string value) => - this.Write(LogSeverity.Info, value); - - /// - public override void Write(string format, params object[] args) => - this.Write(LogSeverity.Info, string.Format(format, args)); - - public void Write(LogSeverity severity, string value) - { - lock (this.Lock) - { - if (!this.IsDisposed) - { - this.Log.Append(value); - } - } - } - - /// - public void Write(LogSeverity severity, string format, params object[] args) => - this.Write(severity, string.Format(format, args)); - - /// - public override void WriteLine(string value) => this.WriteLine(LogSeverity.Info, value); - - /// - public override void WriteLine(string format, params object[] args) => - this.WriteLine(LogSeverity.Info, string.Format(format, args)); - - /// - public void WriteLine(LogSeverity severity, string value) - { - lock (this.Lock) - { - if (!this.IsDisposed) - { - this.Log.AppendLine(value); - } - } - } - - /// - public void WriteLine(LogSeverity severity, string format, params object[] args) => - this.WriteLine(severity, string.Format(format, args)); - - /// - /// Write all buffered log to the test output logger. - /// - private void FlushLog() - { - if (this.Log.Length > 0) - { - this.TestOutput.WriteLine(this.Log.ToString()); - this.Log.Clear(); - } - } - - /// - protected override void Dispose(bool disposing) - { - lock (this.Lock) - { - if (!this.IsDisposed) - { - this.FlushLog(); - this.IsDisposed = true; - } - } - - base.Dispose(disposing); - } - - public void Write(LogSeverity severity, string format, object arg0) - { - throw new NotImplementedException(); - } - - public void Write(LogSeverity severity, string format, object arg0, object arg1) - { - throw new NotImplementedException(); - } - - public void Write(LogSeverity severity, string format, object arg0, object arg1, object arg2) - { - throw new NotImplementedException(); - } - - public void WriteLine(LogSeverity severity, string format, object arg0) - { - throw new NotImplementedException(); - } - - public void WriteLine(LogSeverity severity, string format, object arg0, object arg1) - { - throw new NotImplementedException(); - } - - public void WriteLine(LogSeverity severity, string format, object arg0, object arg1, object arg2) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/Test.UnitTests.Sarif.Driver/Test.UnitTests.Sarif.Driver.csproj b/src/Test.UnitTests.Sarif.Driver/Test.UnitTests.Sarif.Driver.csproj index dcb5e10b9..c2f5dc8ca 100644 --- a/src/Test.UnitTests.Sarif.Driver/Test.UnitTests.Sarif.Driver.csproj +++ b/src/Test.UnitTests.Sarif.Driver/Test.UnitTests.Sarif.Driver.csproj @@ -11,7 +11,6 @@ net6.0 false true - 1.7.3 powershell pwsh \ @@ -20,7 +19,7 @@ - $(PowershellExecutable) -executionpolicy bypass -command ".$(PathSeparator)rewriteUnitTests.ps1 -Configuration $(Configuration) -CoyoteVersion $(CoyoteVersion) -TargetFramework $(TargetFramework)" + $(PowershellExecutable) -executionpolicy bypass -command ".$(PathSeparator)rewriteUnitTests.ps1 -Configuration $(Configuration) -TargetFramework $(TargetFramework)" @@ -32,8 +31,6 @@ - - @@ -69,8 +66,4 @@ Microsoft.CodeAnalysis.Sarif.Driver.Sdk - - - - diff --git a/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.Windows.Debug.json b/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.Windows.Debug.json deleted file mode 100644 index 4542ffb52..000000000 --- a/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.Windows.Debug.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "AssembliesPath": "..\\..\\bld\\bin\\AnyCPU_Debug\\Test.UnitTests.Sarif.Driver\\netcoreapp3.1", - "Assemblies": [ "Sarif.Driver.dll", "Sarif.dll", "Test.UnitTests.Sarif.Driver.dll" ] -} diff --git a/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.Windows.Release.json b/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.Windows.Release.json deleted file mode 100644 index aed2391f3..000000000 --- a/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.Windows.Release.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "AssembliesPath": "..\\..\\bld\\bin\\AnyCPU_Release\\Test.UnitTests.Sarif.Driver\\netcoreapp3.1", - "Assemblies": [ "Sarif.Driver.dll", "Sarif.dll", "Test.UnitTests.Sarif.Driver.dll" ] -} diff --git a/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.nonWindows.Debug.json b/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.nonWindows.Debug.json deleted file mode 100644 index 107424bbf..000000000 --- a/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.nonWindows.Debug.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "AssembliesPath": "../../bld/bin/AnyCPU_Debug/Test.UnitTests.Sarif.Driver/netcoreapp3.1", - "Assemblies": [ "Sarif.Driver.dll", "Sarif.dll", "Test.UnitTests.Sarif.Driver.dll" ] -} diff --git a/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.nonWindows.Release.json b/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.nonWindows.Release.json deleted file mode 100644 index 883c1dd28..000000000 --- a/src/Test.UnitTests.Sarif.Driver/rewrite.coyote.nonWindows.Release.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "AssembliesPath": "../../bld/bin/AnyCPU_Release/Test.UnitTests.Sarif.Driver/netcoreapp3.1", - "Assemblies": [ "Sarif.Driver.dll", "Sarif.dll", "Test.UnitTests.Sarif.Driver.dll" ] -} diff --git a/src/Test.UnitTests.Sarif.Driver/rewriteUnitTests.ps1 b/src/Test.UnitTests.Sarif.Driver/rewriteUnitTests.ps1 deleted file mode 100644 index c9e600701..000000000 --- a/src/Test.UnitTests.Sarif.Driver/rewriteUnitTests.ps1 +++ /dev/null @@ -1,12 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string]$CoyoteVersion="", - [Parameter(Mandatory=$true)][string]$Configuration, - [Parameter(Mandatory=$true)][string]$TargetFramework -) - -Write-Output "Rewrite Unit Tests with Coyote" -if ($ENV:OS) { - dotnet ../../packages/microsoft.coyote.test/$CoyoteVersion/lib/$TargetFramework/coyote.dll rewrite rewrite.coyote.Windows.$Configuration.json -} else { - dotnet ../../packages/microsoft.coyote.test/$CoyoteVersion/lib/$TargetFramework/coyote.dll rewrite rewrite.coyote.nonWindows.$Configuration.json -}