Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make host look for RID-specific assets via a known list by default #84100

Merged
merged 13 commits into from
May 18, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ public static AndConstraint<CommandResultAssertions> HaveUsedAdditionalProbingPa
.And.HaveStdErrContaining($"probe type=lookup dir=[{path}]");
}

public static AndConstraint<CommandResultAssertions> HaveReadRidGraph(this CommandResultAssertions assertion, bool readRidGraph)
{
string ridGraphMsg = "RID fallback graph =";
string hostRidsMsg = "Host RID list =";
return readRidGraph
? assertion.HaveStdErrContaining(ridGraphMsg).And.NotHaveStdErrContaining(hostRidsMsg)
: assertion.HaveStdErrContaining(hostRidsMsg).And.NotHaveStdErrContaining(ridGraphMsg);
}

public static AndConstraint<CommandResultAssertions> HaveUsedFallbackRid(this CommandResultAssertions assertion, bool usedFallbackRid)
{
string msg = "Falling back to base HostRID";
Expand Down Expand Up @@ -209,7 +218,7 @@ private static string[] RelativePathsToAbsoluteAppPaths(string relativePaths, Te
}

List<string> paths = new List<string>();
foreach (string relativePath in relativePaths.Split(';'))
foreach (string relativePath in relativePaths.Split(';', StringSplitOptions.RemoveEmptyEntries))
{
string path = relativePath.Replace('/', Path.DirectorySeparatorChar);
if (app != null)
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/installer/tests/TestUtils/RuntimeConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static RuntimeConfig FromFile(string path)
{
foreach (var includedFramework in includedFrameworks)
{
runtimeConfig.WithFramework(Framework.FromJson((JsonObject)includedFramework));
runtimeConfig.WithIncludedFramework(Framework.FromJson((JsonObject)includedFramework));
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/native/corehost/hostmisc/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,14 @@ const pal::char_t* get_arch_name(pal::architecture arch)

const pal::char_t* get_current_arch_name()
{
return get_arch_name(get_current_arch());
assert(pal::strcmp(get_arch_name(get_current_arch()), _STRINGIFY(CURRENT_ARCH_NAME)) == 0);
return _STRINGIFY(CURRENT_ARCH_NAME);
}

pal::string_t get_current_runtime_id(bool use_fallback)
{
pal::string_t rid;
if (pal::getenv(_X("DOTNET_RUNTIME_ID"), &rid))
if (try_get_runtime_id_from_env(rid))
return rid;

rid = pal::get_current_os_rid_platform();
Expand All @@ -267,6 +268,11 @@ pal::string_t get_current_runtime_id(bool use_fallback)
return rid;
}

bool try_get_runtime_id_from_env(pal::string_t& out_rid)
{
return pal::getenv(_X("DOTNET_RUNTIME_ID"), &out_rid);
}

/**
* Multilevel Lookup is enabled by default
* It can be disabled by setting DOTNET_MULTILEVEL_LOOKUP env var to a value that is not 1
Expand Down
2 changes: 2 additions & 0 deletions src/native/corehost/hostmisc/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ const pal::char_t* get_arch_name(pal::architecture arch);
const pal::char_t* get_current_arch_name();

pal::string_t get_current_runtime_id(bool use_fallback);
bool try_get_runtime_id_from_env(pal::string_t& out_rid);

bool multilevel_lookup_enabled();
void get_framework_and_sdk_locations(const pal::string_t& dotnet_dir, const bool disable_multilevel_lookup, std::vector<pal::string_t>* locations);
bool get_file_path_from_env(const pal::char_t* env_key, pal::string_t* recv);
Expand Down
Loading