private string ExecuteInShell(string shellCommandName, string cleanFolderUnderTempRoot, string arguments = "") { ProcessStartInfo processStartInfo; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var file = Path.Combine(cleanFolderUnderTempRoot, shellCommandName + ".exe"); processStartInfo = new ProcessStartInfo { FileName = file, UseShellExecute = false, Arguments = arguments, }; } else { var file = Path.Combine(cleanFolderUnderTempRoot, shellCommandName); processStartInfo = new ProcessStartInfo { FileName = file, Arguments = arguments, UseShellExecute = false }; } Log.WriteLine($"Launching '{processStartInfo.FileName} {processStartInfo.Arguments}'"); processStartInfo.WorkingDirectory = cleanFolderUnderTempRoot; var environmentProvider = new EnvironmentProvider(); processStartInfo.EnvironmentVariables["PATH"] = environmentProvider.GetEnvironmentVariable("PATH"); if (Environment.Is64BitProcess) { processStartInfo.EnvironmentVariables["DOTNET_ROOT"] = TestContext.Current.ToolsetUnderTest.DotNetRoot; } else { processStartInfo.EnvironmentVariables["DOTNET_ROOT(x86)"] = TestContext.Current.ToolsetUnderTest.DotNetRoot; } processStartInfo.ExecuteAndCaptureOutput(out var stdOut, out var stdErr); stdErr.Should().BeEmpty(); return(stdOut ?? ""); }
public override void Initialize(IEventSource eventSource) { var environmentProvider = new EnvironmentProvider(); var baseUrl = environmentProvider.GetEnvironmentVariable("BCC_URL") ?? "https://buildcrosscheck.azurewebsites.net"; var restClient = new RestClient(baseUrl); var submissionService = new SubmissionService(restClient); var buildServiceProvider = new BuildServiceProvider(environmentProvider); var buildService = buildServiceProvider.GetBuildService(); var parameterParser = new ParameterParser(environmentProvider, buildService); var logDataBuilderFactory = new LogDataBuilderFactory(); var fileSystem = new FileSystem(); Initialize(fileSystem, eventSource, environmentProvider, submissionService, parameterParser, logDataBuilderFactory); }