logWriter.WriteLine($"Version bubble: {(_options.LargeBubble ? "input + all reference assemblies" : "single assembly")}");
logWriter.WriteLine($"Input folder: {_options.InputDirectory?.FullName}");
logWriter.WriteLine($"CORE_ROOT: {_options.CoreRootDirectory?.FullName}");
+ logWriter.WriteLine($"GC stress mode: {(!string.IsNullOrEmpty(_options.GCStress) ? _options.GCStress : "None")}");
logWriter.WriteLine($"Total folders: {_buildFolders.Count()}");
logWriter.WriteLine($"Blocked w/issues: {_buildFolders.Count(folder => folder.IsBlockedWithIssue)}");
int foldersToBuild = FoldersToBuild.Count();
public FileInfo[] IssuesPath { get; set; }
public FileInfo R2RDumpPath { get; set; }
public FileInfo CrossgenResponseFile { get; set; }
- public DirectoryInfo[] RewriteOldPath { get;set; }
- public DirectoryInfo[] RewriteNewPath { get;set; }
+ public DirectoryInfo[] RewriteOldPath { get; set; }
+ public DirectoryInfo[] RewriteNewPath { get; set; }
public bool MeasurePerf { get; set; }
public string InputFileSearchString { get; set; }
public string ConfigurationSuffix => (Release ? "-ret.out" : "-chk.out");
+ public string GCStress { get; set; }
public IEnumerable<string> ReferencePaths()
{
CompilationTimeoutMinutes(),
ExecutionTimeoutMinutes(),
R2RDumpPath(),
+ GCStress(),
},
handler: CommandHandler.Create<BuildOptions>(CompileSubtreeCommand.CompileSubtree));
Option InputFileSearchString() =>
new Option(new[] { "--input-file-search-string", "-input-file" }, "Search string for input files in the input directory", new Argument<string>());
+ Option GCStress() =>
+ new Option(new[] { "--gcstress" }, "Run tests with the specified GC stress level enabled (the argument value is in hex)", new Argument<string>());
+
//
// compile-nuget specific options
//
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
+using Microsoft.Build.Logging;
namespace ReadyToRun.SuperIlc
{
{
ProcessParameters processParameters = new ProcessParameters();
+ if (!string.IsNullOrEmpty(_options.GCStress))
+ {
+ processParameters.EnvironmentOverrides["COMPlus_GCStress"] = _options.GCStress;
+ }
+
if (_options.ExecutionTimeoutMinutes != 0)
{
processParameters.TimeoutMilliseconds = _options.ExecutionTimeoutMinutes * 60 * 1000;
public override ProcessParameters Construct()
{
- return _runner.ScriptExecutionProcess(_outputRoot, _scriptPath, _modules, _folders);
+ ProcessParameters processParameters = _runner.ScriptExecutionProcess(_outputRoot, _scriptPath, _modules, _folders);
+ return processParameters;
}
}
/// </summary>
private int _state;
- private TextWriter _logWriter;
+ private volatile TextWriter _logWriter;
private CancellationTokenSource _cancellationTokenSource;
}
}
- private void StandardOutputEventHandler(object sender, DataReceivedEventArgs eventArgs)
+ private void WriteLog(string message)
{
- string data = eventArgs?.Data;
TextWriter logWriter = _logWriter;
- if (!string.IsNullOrEmpty(data) && logWriter != null)
+
+ if (logWriter != null)
{
lock (logWriter)
{
if (_logWriter != null)
{
- // The logWriter was not disposed yet
- logWriter.WriteLine(data);
+ // The logWriter was not destroyed yet
+ _logWriter.WriteLine(message);
}
}
}
}
+ private void StandardOutputEventHandler(object sender, DataReceivedEventArgs eventArgs)
+ {
+ string data = eventArgs?.Data;
+ if (!string.IsNullOrEmpty(data))
+ {
+ WriteLog(data);
+ }
+ }
+
private void StandardErrorEventHandler(object sender, DataReceivedEventArgs eventArgs)
{
string data = eventArgs?.Data;
- TextWriter logWriter = _logWriter;
- if (!string.IsNullOrEmpty(data) && logWriter != null)
+ if (!string.IsNullOrEmpty(data))
{
- lock (logWriter)
- {
- if (_logWriter != null)
- {
- // The logWriter was not disposed yet
- logWriter.WriteLine(data);
- }
- }
+ WriteLog(data);
}
}
}
_processInfo.ExitCode = (_processInfo.TimedOut ? TimeoutExitCode : _process.ExitCode);
_processInfo.Succeeded = (!_processInfo.TimedOut && _processInfo.ExitCode == _processInfo.Parameters.ExpectedExitCode);
- _logWriter.WriteLine(">>>>");
+ WriteLog(">>>>");
if (!_processInfo.Succeeded)
{
{
string successMessage = linePrefix + $"succeeded in {_processInfo.DurationMilliseconds} msecs";
- _logWriter.WriteLine(successMessage);
+ WriteLog(successMessage);
+
Console.WriteLine(successMessage + $": {processSpec}");
_processInfo.Succeeded = true;
}
}
failureMessage += $", expected {_processInfo.Parameters.ExpectedExitCode}";
}
- _logWriter.WriteLine(failureMessage);
+
+ WriteLog(failureMessage);
+
Console.Error.WriteLine(failureMessage + $": {processSpec}");
}
_processInfo.Finished = true;
- _logWriter.Flush();
+ lock (_logWriter)
+ {
+ _logWriter.Flush();
+ }
CleanupLogWriter();