[Lldb-commits] [lldb] [lldb] Transfer some environment variables into the tests on Windows build host (PR #115613)

Dmitry Vasilyev via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 11 00:48:20 PST 2024


https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/115613

>From 17b3338decd050612d0b804ef6d9966912b0950b Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Sat, 9 Nov 2024 21:11:16 +0400
Subject: [PATCH 1/2] [lldb] Transfer some environment variables into the tests
 on Windows build host

Some API tests (compiler calls) create a lot of garbage and cause unexpected behavior in case of Windows host and Linux target, e.g.
```
lldb/test/API/commands/process/attach/%SystemDrive%/
lldb/test/API/functionalities/deleted-executable/%SystemDrive%/
lldb/test/API/functionalities/exec/%SystemDrive%/
lldb/test/API/functionalities/load_unload/%SystemDrive%/
lldb/test/API/functionalities/target-new-solib-notifications/%SystemDrive%/
lldb/test/API/functionalities/thread/create_after_attach/%SystemDrive%/
```
It can be fixed by transfer some standard Windows environment variables into API tests.
---
 lldb/test/API/lit.cfg.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 6ef09f36a1907e..febf8dc3d19021 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -334,3 +334,22 @@ def delete_module_cache(path):
 # Propagate XDG_CACHE_HOME
 if "XDG_CACHE_HOME" in os.environ:
     config.environment["XDG_CACHE_HOME"] = os.environ["XDG_CACHE_HOME"]
+
+# Transfer some environment variables into the tests on Windows build host.
+if platform.system() == "Windows":
+    for v in [
+        "SystemDrive",
+        "SystemRoot",
+        "ALLUSERSPROFILE",
+        "APPDATA",
+        "LOCALAPPDATA",
+        "USERDNSDOMAIN",
+        "USERDOMAIN",
+        "USERNAME",
+        "USERPROFILE",
+        "USERDOMAIN_ROAMINGPROFILE",
+        "COMPUTERNAME",
+        "ProgramData",
+    ]:
+        if v in os.environ:
+            config.environment[v] = os.environ[v]

>From 28c619781774096340e1d9321853184a2da34e5f Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Mon, 11 Nov 2024 12:48:06 +0400
Subject: [PATCH 2/2] Reduced the list of environment variables to SystemDrive
 only. We can easily add necessary variables later.

---
 lldb/test/API/lit.cfg.py | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index febf8dc3d19021..06c685ebc3f5a5 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -337,19 +337,6 @@ def delete_module_cache(path):
 
 # Transfer some environment variables into the tests on Windows build host.
 if platform.system() == "Windows":
-    for v in [
-        "SystemDrive",
-        "SystemRoot",
-        "ALLUSERSPROFILE",
-        "APPDATA",
-        "LOCALAPPDATA",
-        "USERDNSDOMAIN",
-        "USERDOMAIN",
-        "USERNAME",
-        "USERPROFILE",
-        "USERDOMAIN_ROAMINGPROFILE",
-        "COMPUTERNAME",
-        "ProgramData",
-    ]:
+    for v in ["SystemDrive"]:
         if v in os.environ:
             config.environment[v] = os.environ[v]



More information about the lldb-commits mailing list