Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0
3.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,96 @@ public async Task SpecCpuExecutorExecutesTheCorrectCommandsWithDifferentProfiles
Assert.IsTrue(commandCalled);
}

[Test]
public async Task SpecCpuExecutorAppliesGcc15WorkaroundWhenGccVersionIs15OrGreaterOnLinux()
{
this.SetupLinux();

string writtenConfigText = null;
this.mockFixture.File.Setup(f => f.WriteAllTextAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
.Callback<string, string, CancellationToken>((path, content, token) => writtenConfigText = content)
.Returns(Task.CompletedTask);

this.mockFixture.ProcessManager.OnCreateProcess = (exe, arguments, workingDir) =>
{
if (exe == "sudo" && arguments == "gcc -dumpversion")
{
return new InMemoryProcess
{
StartInfo = new ProcessStartInfo { FileName = exe, Arguments = arguments },
StandardOutput = new ConcurrentBuffer(new StringBuilder("15")),
ExitCode = 0,
OnStart = () => true,
OnHasExited = () => true
};
}

return new InMemoryProcess
{
StartInfo = new ProcessStartInfo { FileName = exe, Arguments = arguments },
ExitCode = 0,
OnStart = () => true,
OnHasExited = () => true
};
};

using (TestSpecCpuExecutor specCpuExecutor = new TestSpecCpuExecutor(this.mockFixture.Dependencies, this.mockFixture.Parameters))
{
await specCpuExecutor.ExecuteAsync(CancellationToken.None).ConfigureAwait(false);
}

Assert.IsNotNull(writtenConfigText);
Assert.IsTrue(writtenConfigText.Contains("%define GCCge15"), "Config should contain '%define GCCge15' when GCC version is 15 or greater.");
Assert.IsTrue(writtenConfigText.Contains("%define GCCge10"), "Config should also contain '%define GCCge10' when GCC version is 15 or greater.");
Assert.IsFalse(writtenConfigText.Contains("$Gcc15Workaround$"), "Placeholder '$Gcc15Workaround$' should be replaced.");
Assert.IsFalse(writtenConfigText.Contains("$Gcc10Workaround$"), "Placeholder '$Gcc10Workaround$' should be replaced.");
}

[Test]
public async Task SpecCpuExecutorDoesNotApplyGcc15WorkaroundWhenGccVersionIsLessThan15OnLinux()
{
this.SetupLinux();

string writtenConfigText = null;
this.mockFixture.File.Setup(f => f.WriteAllTextAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<CancellationToken>()))
.Callback<string, string, CancellationToken>((path, content, token) => writtenConfigText = content)
.Returns(Task.CompletedTask);

this.mockFixture.ProcessManager.OnCreateProcess = (exe, arguments, workingDir) =>
{
if (exe == "sudo" && arguments == "gcc -dumpversion")
{
return new InMemoryProcess
{
StartInfo = new ProcessStartInfo { FileName = exe, Arguments = arguments },
StandardOutput = new ConcurrentBuffer(new StringBuilder("10")),
ExitCode = 0,
OnStart = () => true,
OnHasExited = () => true
};
}

return new InMemoryProcess
{
StartInfo = new ProcessStartInfo { FileName = exe, Arguments = arguments },
ExitCode = 0,
OnStart = () => true,
OnHasExited = () => true
};
};

using (TestSpecCpuExecutor specCpuExecutor = new TestSpecCpuExecutor(this.mockFixture.Dependencies, this.mockFixture.Parameters))
{
await specCpuExecutor.ExecuteAsync(CancellationToken.None).ConfigureAwait(false);
}

Assert.IsNotNull(writtenConfigText);
Assert.IsFalse(writtenConfigText.Contains("%define GCCge15"), "Config should NOT contain '%define GCCge15' when GCC version is less than 15.");
Assert.IsTrue(writtenConfigText.Contains("%define GCCge10"), "Config should contain '%define GCCge10' when GCC version is 10.");
Assert.IsFalse(writtenConfigText.Contains("$Gcc15Workaround$"), "Placeholder '$Gcc15Workaround$' should be replaced.");
Assert.IsFalse(writtenConfigText.Contains("$Gcc10Workaround$"), "Placeholder '$Gcc10Workaround$' should be replaced.");
}

private void SetupLinux()
{
this.mockFixture = new MockFixture();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ default:
# line to avoid compile errors for several FP benchmarks
#
$Gcc10Workaround$ # EDIT: remove the '#' from column 1 if using GCC 10 or later
$Gcc15Workaround$ # workaround for GCC v15 (and presumably later)

# EDIT if needed: the preENV line adds library directories to the runtime
# path. You can adjust it, or add lines for other environment variables.
Expand Down
12 changes: 12 additions & 0 deletions src/VirtualClient/VirtualClient.Actions/SPECcpu/SpecCpuExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@ private async Task WriteSpecCpuConfigAsync(CancellationToken cancellationToken)
SpecCpuConfigPlaceHolder.Gcc10Workaround,
Convert.ToInt32(compilerVersion) >= 10 ? SpecCpuConfigPlaceHolder.Gcc10WorkaroundContent : string.Empty,
StringComparison.OrdinalIgnoreCase);

templateText = templateText.Replace(
SpecCpuConfigPlaceHolder.Gcc15Workaround,
Convert.ToInt32(compilerVersion) >= 15 ? SpecCpuConfigPlaceHolder.Gcc15WorkaroundContent : string.Empty,
StringComparison.OrdinalIgnoreCase);
}
else
{
Expand All @@ -501,6 +506,11 @@ private async Task WriteSpecCpuConfigAsync(CancellationToken cancellationToken)
SpecCpuConfigPlaceHolder.Gcc10Workaround,
SpecCpuConfigPlaceHolder.Gcc10WorkaroundContent,
StringComparison.OrdinalIgnoreCase);

templateText = templateText.Replace(
SpecCpuConfigPlaceHolder.Gcc15Workaround,
SpecCpuConfigPlaceHolder.Gcc15WorkaroundContent,
StringComparison.OrdinalIgnoreCase);
}

templateText = templateText.Replace(
Expand Down Expand Up @@ -572,6 +582,8 @@ private static class SpecCpuConfigPlaceHolder
public const string PeakOptimizingFlags = "$PeakOptimizingFlags$";
public const string Gcc10Workaround = "$Gcc10Workaround$";
public const string Gcc10WorkaroundContent = "%define GCCge10";
public const string Gcc15Workaround = "$Gcc15Workaround$";
public const string Gcc15WorkaroundContent = "%define GCCge15";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ default:
# line to avoid compile errors for several FP benchmarks
#
%define GCCge10 # EDIT: remove the '#' from column 1 if using GCC 10 or later
%define GCCge15 # EDIT: remove the '#' from column 1 if using GCC 15 or later

# EDIT if needed: the preENV line adds library directories to the runtime
# path. You can adjust it, or add lines for other environment variables.
Expand Down Expand Up @@ -318,6 +319,9 @@ default: # data model applies to all benchmarks
#
default=base: # flags for all base
OPTIMIZE = -g -O3 -mcpu=native
% ifdef %{GCCge15} # workaround for GCC v15 (and presumably later)
EXTRA_CXXFLAGS = -Wno-error=template-body
% endif


#-------- Peak Tuning Flags ----------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ default:
# line to avoid compile errors for several FP benchmarks
#
$Gcc10Workaround$ # EDIT: remove the '#' from column 1 if using GCC 10 or later
$Gcc15Workaround$ # workaround for GCC v15 (and presumably later)

# EDIT if needed: the preENV line adds library directories to the runtime
# path. You can adjust it, or add lines for other environment variables.
Expand Down Expand Up @@ -314,6 +315,9 @@ default: # data model applies to all benchmarks
#
default=base: # flags for all base
OPTIMIZE = $BaseOptimizingFlags$
% ifdef %{GCCge15} # workaround for GCC v15 (and presumably later)
EXTRA_CXXFLAGS = -Wno-error=template-body
% endif


#-------- Peak Tuning Flags ----------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ default:
# line to avoid compile errors for several FP benchmarks
#
%define GCCge10 # EDIT: remove the '#' from column 1 if using GCC 10 or later
%define GCCge15 # EDIT: remove the '#' from column 1 if using GCC 15 or later

# EDIT if needed: the preENV line adds library directories to the runtime
# path. You can adjust it, or add lines for other environment variables.
Expand Down Expand Up @@ -300,7 +301,10 @@ fpspeed:
# the -march=native. See topic "Older GCC" above.
#
default=base: # flags for all base
OPTIMIZE = -g -O3 -march=native
OPTIMIZE = -g -O3 -march=native
% ifdef %{GCCge15} # workaround for GCC v15 (and presumably later)
EXTRA_CXXFLAGS = -Wno-error=template-body
% endif


#-------- Peak Tuning Flags ----------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ default:
# line to avoid compile errors for several FP benchmarks
#
$Gcc10Workaround$ # EDIT: remove the '#' from column 1 if using GCC 10 or later
$Gcc15Workaround$ # workaround for GCC v15 (and presumably later)

# EDIT if needed: the preENV line adds library directories to the runtime
# path. You can adjust it, or add lines for other environment variables.
Expand Down Expand Up @@ -297,6 +298,9 @@ fpspeed:
#
default=base: # flags for all base
OPTIMIZE = $BaseOptimizingFlags$
% ifdef %{GCCge15} # workaround for GCC v15 (and presumably later)
EXTRA_CXXFLAGS = -Wno-error=template-body
% endif


#-------- Peak Tuning Flags ----------------------------------------------
Expand Down
Loading