Skip to content
Merged
5 changes: 3 additions & 2 deletions src/coreclr/scripts/superpmi_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,13 @@ def build_and_run(coreclr_args, output_mch_name):
env_copy["NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY"] = "9,2000"

# If `dotnet restore` fails, retry.
tfm = "net9.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to turn it into superpmi_benchmarks.py.template with markers like {TargetFramework} which some .proj would replace at build time to generate the real superpmi_benchmarks.py somewhere under artificats/obj. linker testing uses that mechanism to avoid updating the files each time the TFM version is bumped:

<WriteLinesToFile File="$(_projectFile)"

template:
<Project Sdk="Microsoft.NET.Sdk">

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea, but a bit more work than I'd like to take on here -- I opened #110043 about it

num_tries = 3
for try_num in range(num_tries):
# On the last try, exit on fail
exit_on_fail = try_num + 1 == num_tries
(_, _, return_code) = run_command(
[dotnet_exe, "restore", project_file, "--packages", artifacts_packages_directory],
[dotnet_exe, "restore", project_file, "--packages", artifacts_packages_directory, "-p:TargetFramework=" + tfm],
_exit_on_fail=exit_on_fail, _env=env_copy)
if return_code == 0:
# It succeeded!
Expand All @@ -203,7 +204,7 @@ def build_and_run(coreclr_args, output_mch_name):

run_command(
[dotnet_exe, "build", project_file, "--configuration", "Release",
"--framework", "net9.0", "--no-restore", "/p:NuGetPackageRoot=" + artifacts_packages_directory,
"--framework", tfm, "--no-restore", "/p:NuGetPackageRoot=" + artifacts_packages_directory,
"-o", artifacts_directory], _exit_on_fail=True)

# This is specifically for PowerShell.Benchmarks.
Expand Down
5 changes: 1 addition & 4 deletions src/coreclr/scripts/superpmi_collect_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,8 @@ def setup_benchmark(workitem_directory, arch):
print("Missing " + dotnet_install_script)
return

# Sometimes the dotnet version installed by the script is latest and expect certain versions of SDK that
# have not published yet. As a result, we hit errors of "dotnet restore". As a workaround, hard code the
# working version until we move to ".NET 9" in the script.
run_command(
get_python_name() + [dotnet_install_script, "install", "--dotnet-versions", "9.0.100-rc.2.24474.11", "--architecture", arch, "--install-dir",
get_python_name() + [dotnet_install_script, "install", "--channels", "9.0", "--architecture", arch, "--install-dir",
dotnet_directory, "--verbose"])


Expand Down
Loading