From 61cde94af19dc5132f54c7978336b56b0d425ae0 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 4 Oct 2018 21:18:17 -0700 Subject: [PATCH] Clean up test failures --- .../CommandLineTestResources.Designer.cs | 73 ----------- .../CommandLine/CommandLineTestResources.resx | 124 ------------------ .../Test/CommandLine/CommandLineTests.cs | 13 +- .../Test/CommandLine/ErrorLoggerTests.cs | 9 +- ...alysis.CSharp.CommandLine.UnitTests.csproj | 15 +-- .../CSharp/Test/Emit/Resources.Designer.cs | 4 +- .../Test/WinRT/Metadata/WinMdMetadataTests.cs | 2 +- src/Compilers/CSharp/Test/WinRT/PdbTests.cs | 2 +- .../Test/Resources/Core/ResourceLoader.cs | 21 +-- 9 files changed, 33 insertions(+), 230 deletions(-) delete mode 100644 src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.Designer.cs delete mode 100644 src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.resx diff --git a/src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.Designer.cs b/src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.Designer.cs deleted file mode 100644 index 117412b32f6..00000000000 --- a/src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.Designer.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class CommandLineTestResources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal CommandLineTestResources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTestResources", typeof(CommandLineTestResources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] csc_rsp { - get { - object obj = ResourceManager.GetObject("csc_rsp", resourceCulture); - return ((byte[])(obj)); - } - } - } -} diff --git a/src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.resx b/src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.resx deleted file mode 100644 index 2315d56ec5c..00000000000 --- a/src/Compilers/CSharp/Test/CommandLine/CommandLineTestResources.resx +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ../../csc/csc.rsp;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - diff --git a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs index d6a98bc6f6e..d97f5aa0085 100644 --- a/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs +++ b/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs @@ -6375,7 +6375,7 @@ private void CheckManifestString(string source, OutputKind outputKind, string ex } [WorkItem(544926, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544926")] - [ClrOnlyFact] + [ConditionalFact(typeof(WindowsOnly), Reason = "https://github.com/dotnet/roslyn/issues/30289")] public void ResponseFilesWithNoconfig_01() { string source = Temp.CreateFile("a.cs").WriteAllText(@" @@ -6457,7 +6457,7 @@ public static void Main() } [WorkItem(544926, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544926")] - [ClrOnlyFact] + [ConditionalFact(typeof(WindowsOnly), Reason = "https://github.com/dotnet/roslyn/issues/30289")] public void ResponseFilesWithNoconfig_03() { string source = Temp.CreateFile("a.cs").WriteAllText(@" @@ -6554,7 +6554,8 @@ public void NoStdLib() private string GetDefaultResponseFilePath() { - return Temp.CreateFile().WriteAllBytes(CommandLineTestResources.csc_rsp).Path; + var cscRsp = global::TestResources.ResourceLoader.GetResourceBlob("csc.rsp"); + return Temp.CreateFile().WriteAllBytes(cscRsp).Path; } [Fact, WorkItem(530359, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/530359")] @@ -8277,7 +8278,7 @@ public void ParseFeatures() Assert.True(args.ParseOptions.Features.SetEquals(new Dictionary { { "Test", "true" } })); } - [Fact] + [ConditionalFact(typeof(WindowsOnly), Reason = "https://github.com/dotnet/roslyn/issues/30289")] public void ParseAdditionalFile() { var args = DefaultParse(new[] { "/additionalfile:web.config", "a.cs" }, WorkingDirectory); @@ -9325,7 +9326,7 @@ public void PathMapParser() Assert.Equal(KeyValuePairUtil.Create("K 2\\", "V 2\\"), parsedArgs.PathMap[1]); } - [Fact] + [ConditionalFact(typeof(WindowsOnly), Reason = "https://github.com/dotnet/roslyn/issues/30289")] [CompilerTrait(CompilerFeature.Determinism)] public void PathMapPdbParser() { @@ -9338,7 +9339,7 @@ public void PathMapPdbParser() Assert.Null(parsedArgs.EmitOptions.PdbFilePath); } - [Fact] + [ConditionalFact(typeof(WindowsOnly), Reason = ConditionalSkipReason.NativePdbRequiresDesktop)] [CompilerTrait(CompilerFeature.Determinism)] public void PathMapPdbEmit() { diff --git a/src/Compilers/CSharp/Test/CommandLine/ErrorLoggerTests.cs b/src/Compilers/CSharp/Test/CommandLine/ErrorLoggerTests.cs index 8fd24c58e86..cc7be109782 100644 --- a/src/Compilers/CSharp/Test/CommandLine/ErrorLoggerTests.cs +++ b/src/Compilers/CSharp/Test/CommandLine/ErrorLoggerTests.cs @@ -8,6 +8,7 @@ using Microsoft.CodeAnalysis.CSharp.Test.Utilities; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities; using Xunit; using static Microsoft.CodeAnalysis.CommonDiagnosticAnalyzers; @@ -18,7 +19,7 @@ namespace Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests { public class ErrorLoggerTests : CommandLineTestBase { - [Fact] + [ConditionalFact(typeof(WindowsOnly), Reason = "https://github.com/dotnet/roslyn/issues/30289")] public void NoDiagnostics() { var helloWorldCS = @"using System; @@ -58,7 +59,7 @@ public static void Main(string[] args) CleanupAllGeneratedFiles(errorLogFile); } - [Fact] + [ConditionalFact(typeof(WindowsOnly), Reason = "https://github.com/dotnet/roslyn/issues/30289")] public void SimpleCompilerDiagnostics() { var source = @" @@ -152,7 +153,7 @@ public class C CleanupAllGeneratedFiles(errorLogFile); } - [Fact] + [ConditionalFact(typeof(WindowsOnly), Reason = "https://github.com/dotnet/roslyn/issues/30289")] public void SimpleCompilerDiagnostics_Suppressed() { var source = @" @@ -252,7 +253,7 @@ public class C CleanupAllGeneratedFiles(errorLogFile); } - [Fact] + [ConditionalFact(typeof(WindowsOnly), Reason = "https://github.com/dotnet/roslyn/issues/30289")] public void AnalyzerDiagnosticsWithAndWithoutLocation() { var source = @" diff --git a/src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj b/src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj index 5badf4f099c..580508b7176 100644 --- a/src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj +++ b/src/Compilers/CSharp/Test/CommandLine/Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.csproj @@ -10,6 +10,9 @@ UnitTestPortable true + + + @@ -23,19 +26,9 @@ - - True - True - CommandLineTestResources.resx - + - - - ResXFileCodeGenerator - CommandLineTestResources.Designer.cs - - diff --git a/src/Compilers/CSharp/Test/Emit/Resources.Designer.cs b/src/Compilers/CSharp/Test/Emit/Resources.Designer.cs index 03762382a7c..dacb4f8ca86 100644 --- a/src/Compilers/CSharp/Test/Emit/Resources.Designer.cs +++ b/src/Compilers/CSharp/Test/Emit/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18010 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdMetadataTests.cs b/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdMetadataTests.cs index 3c0b9ea229b..3e182d58bf6 100644 --- a/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdMetadataTests.cs +++ b/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdMetadataTests.cs @@ -140,7 +140,7 @@ public void WinMdColorType() /// Ensure that a simple program that uses projected types can compile /// and run. /// - [ConditionalFact(typeof(OSVersionWin8))] + [ConditionalFact(typeof(WindowsDesktopOnly), ConditionalSkipReason.TestExecutionNeedsDesktopTypes)] public void WinMdColorTest() { var text = @"using Windows.UI; diff --git a/src/Compilers/CSharp/Test/WinRT/PdbTests.cs b/src/Compilers/CSharp/Test/WinRT/PdbTests.cs index 41dc50bcd49..f57e52a864c 100644 --- a/src/Compilers/CSharp/Test/WinRT/PdbTests.cs +++ b/src/Compilers/CSharp/Test/WinRT/PdbTests.cs @@ -74,7 +74,7 @@ public void EmitToBoundedStreams() r.Diagnostics.Verify(); } - [ClrOnlyFact(ClrOnlyReason.Pdb)] + [ConditionalFact(typeof(WindowsOnly), Reason = ConditionalSkipReason.NativePdbRequiresDesktop)] public void EmitToStreamWithNonZeroPosition() { var pdbStream = new MemoryStream(); diff --git a/src/Compilers/Test/Resources/Core/ResourceLoader.cs b/src/Compilers/Test/Resources/Core/ResourceLoader.cs index fd21aedd469..c6332764eea 100644 --- a/src/Compilers/Test/Resources/Core/ResourceLoader.cs +++ b/src/Compilers/Test/Resources/Core/ResourceLoader.cs @@ -22,7 +22,7 @@ private static Stream GetResourceStream(string name) return stream; } - private static byte[] GetResourceBlob(string name) + public static byte[] GetResourceBlob(string name) { using (var stream = GetResourceStream(name)) { @@ -50,16 +50,21 @@ public static string GetOrCreateResource(ref string resource, string name) { if (resource == null) { - using (var stream = GetResourceStream(name)) - { - using (var streamReader = new StreamReader(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true)) - { - resource = streamReader.ReadToEnd(); - } - } + resource = GetResource(name); } return resource; } + + public static string GetResource(string name) + { + using (var stream = GetResourceStream(name)) + { + using (var streamReader = new StreamReader(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true)) + { + return streamReader.ReadToEnd(); + } + } + } } } -- GitLab