diff --git a/Runner/Helpers/JitDiffUtils.cs b/Runner/Helpers/JitDiffUtils.cs index 20e30f2..d8c4208 100644 --- a/Runner/Helpers/JitDiffUtils.cs +++ b/Runner/Helpers/JitDiffUtils.cs @@ -24,6 +24,13 @@ private static async Task RunJitDiffAsync(JobBase job, string coreRootFolder, st bool debugInfo = job.TryGetFlag("debuginfo"); bool gcInfo = job.TryGetFlag("gcinfo"); + List<(string, string)> envVars = []; + + if (job.TryGetFlag("JitDisasmWithGC")) + { + envVars.Add(("DOTNET_JitDisasmWithGC", "1")); + } + await job.RunProcessAsync("jitutils/bin/jit-diff", $"diff " + (debugInfo ? "--debuginfo " : "") + @@ -35,7 +42,8 @@ await job.RunProcessAsync("jitutils/bin/jit-diff", $"{frameworksOrAssembly} --pmi " + $"--core_root {coreRootFolder} " + $"--base {checkedClrFolder}", - logPrefix: $"jit-diff {coreRootFolder}"); + logPrefix: $"jit-diff {coreRootFolder}", + envVars: envVars); } public static async Task RunJitAnalyzeAsync(JobBase job, string mainDirectory, string prDirectory, int count = 100) diff --git a/Runner/JobBase.cs b/Runner/JobBase.cs index dc026f6..6a97b27 100644 --- a/Runner/JobBase.cs +++ b/Runner/JobBase.cs @@ -315,6 +315,7 @@ public async Task RunProcessAsync( bool suppressOutputLogs = false, bool suppressStartingLog = false, ProcessPriorityClass priority = ProcessPriorityClass.Normal, + List<(string, string)>? envVars = null, CancellationToken cancellationToken = default) { processLogs ??= i => i; @@ -334,14 +335,24 @@ public async Task RunProcessAsync( await LogAsync($"{logPrefix}{processLogs($"Running '{fileName} {arguments}'{(workDir is null ? null : $" from '{workDir}'")}")}"); } - using var process = new Process + var startInfo = new ProcessStartInfo(fileName, arguments) + { + RedirectStandardError = true, + RedirectStandardOutput = true, + WorkingDirectory = workDir ?? string.Empty, + }; + + if (envVars is not null) { - StartInfo = new ProcessStartInfo(fileName, arguments) + foreach ((string key, string value) in envVars) { - RedirectStandardError = true, - RedirectStandardOutput = true, - WorkingDirectory = workDir ?? string.Empty, + startInfo.EnvironmentVariables.Add(key, value); } + } + + using var process = new Process + { + StartInfo = startInfo }; using var cts = CancellationTokenSource.CreateLinkedTokenSource(JobTimeout, cancellationToken);