[Lldb-commits] [lldb] ae316ac - [lldb/qemu] Sort entries in QEMU_(UN)SET_ENV

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 8 06:56:41 PST 2021


Author: Pavel Labath
Date: 2021-12-08T15:56:32+01:00
New Revision: ae316ac66ffff430997e342772fc4629c1acece0

URL: https://github.com/llvm/llvm-project/commit/ae316ac66ffff430997e342772fc4629c1acece0
DIFF: https://github.com/llvm/llvm-project/commit/ae316ac66ffff430997e342772fc4629c1acece0.diff

LOG: [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.

Added: 
    

Modified: 
    lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
index 3bcb1e12e0bbf..2542464301dee 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
@@ -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.


        


More information about the lldb-commits mailing list