diff --git a/src/VirtualClient/VirtualClient.Actions.UnitTests/SPEC/SpecCpuExecutorTests.cs b/src/VirtualClient/VirtualClient.Actions.UnitTests/SPEC/SpecCpuExecutorTests.cs index 83d32add90..080bb0408a 100644 --- a/src/VirtualClient/VirtualClient.Actions.UnitTests/SPEC/SpecCpuExecutorTests.cs +++ b/src/VirtualClient/VirtualClient.Actions.UnitTests/SPEC/SpecCpuExecutorTests.cs @@ -119,7 +119,7 @@ public async Task SpecCpuExecutorExecutesTheCorrectCommandsWithInstallationInWin $"powershell -Command \"Mount-DiskImage -ImagePath {this.mockPackage.Path}\\speccpu.iso\"", $"powershell -Command \"(Get-DiskImage -ImagePath {this.mockPackage.Path}\\speccpu.iso| Get-Volume).DriveLetter\"", $"cmd /c echo 1 | X:\\install.bat {this.mockPackage.Path}", - "gcc -dumpversion", + "C:\\tools\\cygwin\\bin\\gcc -dumpversion", $"powershell -Command \"Dismount-DiskImage -ImagePath {this.mockPackage.Path}\\speccpu.iso\"", $"cmd /c runspeccpu.bat --config vc-win-x64.cfg --iterations 2 --copies 4 --threads 8 --tune all --noreportable intrate" }; @@ -135,7 +135,7 @@ public async Task SpecCpuExecutorExecutesTheCorrectCommandsWithInstallationInWin output.Append("X"); } - if (exe == "gcc" && arguments == "-dumpversion") + if (exe == "C:\\tools\\cygwin\\bin\\gcc" && arguments == "-dumpversion") { return new InMemoryProcess { @@ -421,6 +421,8 @@ private void SetupWindows() this.mockFixture.FileInfo.Setup(file => file.New(It.IsAny())) .Returns(new Mock().Object); + this.mockFixture.SetEnvironmentVariable("ChocolateyToolsLocation", this.mockFixture.Combine("C:", "tools")); + this.mockFixture.Parameters = new Dictionary() { { nameof(SpecCpuExecutor.SpecProfile), "intrate" }, diff --git a/src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs b/src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs index 9836463c9e..f0930a366b 100644 --- a/src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs +++ b/src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs @@ -443,9 +443,15 @@ private async Task GetInstalledCompilerDumpVersionAsync(string compilerN { string command = compilerName; string commandArguments = "-dumpversion"; - + string chocolateyToolsLocation = this.GetEnvironmentVariable("ChocolateyToolsLocation", EnvironmentVariableTarget.User); + string cygwinInstallationPath = this.PlatformSpecifics.Combine(chocolateyToolsLocation, "cygwin"); string version = string.Empty; + if (this.Platform == PlatformID.Win32NT) + { + command = this.PlatformSpecifics.Combine(cygwinInstallationPath, "bin", compilerName); + } + using (IProcessProxy process = this.systemManager.ProcessManager.CreateElevatedProcess(this.Platform, command, commandArguments)) { try