[lldb/qemu] Sort entries in QEMU_(UN)SET_ENV

The test for this functionality was failing on the darwin bot, because
the entries came out in opposite order. While this does not impact
functionality, and the algorithm that produces it is technically
deterministic (the nondeterminism comes from the contents of the host
environment), it seems like it would be more user-friendly if the
entries came out in a more predictible order.

Therefore I am adding the sort call to the actual code instead of
relaxing test expectations.
This commit is contained in:
Pavel Labath 2021-12-08 15:51:31 +01:00
parent eecfc73ae4
commit ae316ac66f
1 changed files with 2 additions and 0 deletions

View File

@ -126,6 +126,7 @@ static Environment ComputeLaunchEnvironment(Environment target,
if (host_it == host.end() || host_it->second != KV.second)
set_env.push_back(Environment::compose(KV));
}
llvm::sort(set_env);
std::vector<llvm::StringRef> unset_env;
for (const auto &KV : host) {
@ -134,6 +135,7 @@ static Environment ComputeLaunchEnvironment(Environment target,
if (target.count(KV.first()) == 0)
unset_env.push_back(KV.first());
}
llvm::sort(unset_env);
// The actual QEMU_(UN)SET_ENV variables should not be forwarded to the
// target.