Browse Source

Reduce log noise from compiler/assembler process output.

pull/2832/head
Siegfried Pammer 3 years ago
parent
commit
7349e3017d
  1. 12
      ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs
  2. 54
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

12
ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs

@ -72,7 +72,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -72,7 +72,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
{
references = references.Concat(new[] { "-r:\"Microsoft.VisualBasic.dll\"" });
}
string otherOptions = $"-noconfig " +
string otherOptions = $"-nologo -noconfig " +
"-optioninfer+ -optionexplicit+ " +
$"-langversion:{languageVersion} " +
$"/optimize{(flags.HasFlag(CompilerOptions.Optimize) ? "+ " : "- ")}";
@ -122,8 +122,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -122,8 +122,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
var result = await command.ExecuteBufferedAsync().ConfigureAwait(false);
Console.WriteLine("output: " + result.StandardOutput);
Console.WriteLine("errors: " + result.StandardError);
if (!string.IsNullOrWhiteSpace(result.StandardOutput))
{
Console.WriteLine("output:" + Environment.NewLine + result.StandardOutput);
}
if (!string.IsNullOrWhiteSpace(result.StandardError))
{
Console.WriteLine("errors:" + Environment.NewLine + result.StandardError);
}
Assert.AreEqual(0, result.ExitCode, "vbc failed");
return results;

54
ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

@ -176,13 +176,19 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -176,13 +176,19 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
}
var command = Cli.Wrap(ilasmPath)
.WithArguments($"/nologo {otherOptions}/output=\"{outputFile}\" \"{sourceFileName}\"")
.WithArguments($"/quiet {otherOptions}/output=\"{outputFile}\" \"{sourceFileName}\"")
.WithValidation(CommandResultValidation.None);
var result = await command.ExecuteBufferedAsync().ConfigureAwait(false);
Console.WriteLine("output: " + result.StandardOutput);
Console.WriteLine("errors: " + result.StandardError);
if (!string.IsNullOrWhiteSpace(result.StandardOutput))
{
Console.WriteLine("output:" + Environment.NewLine + result.StandardOutput);
}
if (!string.IsNullOrWhiteSpace(result.StandardError))
{
Console.WriteLine("errors:" + Environment.NewLine + result.StandardError);
}
Assert.AreEqual(0, result.ExitCode, "ilasm failed");
return outputFile;
@ -224,8 +230,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -224,8 +230,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
var result = await command.ExecuteBufferedAsync().ConfigureAwait(false);
Console.WriteLine("output: " + result.StandardOutput);
Console.WriteLine("errors: " + result.StandardError);
if (!string.IsNullOrWhiteSpace(result.StandardOutput))
{
Console.WriteLine("output:" + Environment.NewLine + result.StandardOutput);
}
if (!string.IsNullOrWhiteSpace(result.StandardError))
{
Console.WriteLine("errors:" + Environment.NewLine + result.StandardError);
}
Assert.AreEqual(0, result.ExitCode, "ildasm failed");
// Unlike the .imagebase directive (which is a fixed value when compiling with /deterministic),
@ -430,7 +442,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -430,7 +442,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
{
references = references.Concat(new[] { "-r:\"System.Runtime.CompilerServices.Unsafe.dll\"" });
}
string otherOptions = $"-noconfig " +
string otherOptions = $"-nologo -noconfig " +
$"-langversion:{languageVersion} " +
$"-unsafe -o{(flags.HasFlag(CompilerOptions.Optimize) ? "+ " : "- ")}";
@ -485,9 +497,15 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -485,9 +497,15 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
Console.WriteLine($"\"{command.TargetFilePath}\" {command.Arguments}");
var result = await command.ExecuteBufferedAsync().ConfigureAwait(false);
if (!string.IsNullOrWhiteSpace(result.StandardOutput))
{
Console.WriteLine("output:" + Environment.NewLine + result.StandardOutput);
}
if (!string.IsNullOrWhiteSpace(result.StandardError))
{
Console.WriteLine("errors:" + Environment.NewLine + result.StandardError);
}
Console.WriteLine("output: " + result.StandardOutput);
Console.WriteLine("errors: " + result.StandardError);
Assert.AreEqual(0, result.ExitCode, "csc failed");
return results;
@ -542,8 +560,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -542,8 +560,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
var result = await command.ExecuteBufferedAsync().ConfigureAwait(false);
Console.WriteLine("output: " + result.StandardOutput);
Console.WriteLine("errors: " + result.StandardError);
if (!string.IsNullOrWhiteSpace(result.StandardOutput))
{
Console.WriteLine("output:" + Environment.NewLine + result.StandardOutput);
}
if (!string.IsNullOrWhiteSpace(result.StandardError))
{
Console.WriteLine("errors:" + Environment.NewLine + result.StandardError);
}
Assert.AreEqual(0, result.ExitCode, "mcs failed");
return results;
@ -815,8 +839,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -815,8 +839,14 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
var result = await command.ExecuteBufferedAsync().ConfigureAwait(false);
Assert.AreEqual(0, result.ExitCode, "sn failed");
Console.WriteLine("output: " + result.StandardOutput);
Console.WriteLine("errors: " + result.StandardError);
if (!string.IsNullOrWhiteSpace(result.StandardOutput))
{
Console.WriteLine("output:" + Environment.NewLine + result.StandardOutput);
}
if (!string.IsNullOrWhiteSpace(result.StandardError))
{
Console.WriteLine("errors:" + Environment.NewLine + result.StandardError);
}
}
public static async Task<string> FindMSBuild()

Loading…
Cancel
Save