[Lldb-commits] [PATCH] D74636: [DO NOT REVIEW] Add inheritEnvironment option

Héctor Luis Díaz Aceves via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 14 13:52:48 PST 2020


diazhector98 updated this revision to Diff 244763.
diazhector98 added a comment.

Continued repair


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74636/new/

https://reviews.llvm.org/D74636

Files:
  lldb/test/API/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py
  lldb/test/API/tools/lldb-vscode/environmentVariables/main.cpp
  lldb/tools/lldb-vscode/package.json


Index: lldb/tools/lldb-vscode/package.json
===================================================================
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -84,6 +84,11 @@
 								"description": "Additional environment variables.",
 								"default": []
 							},
+							"inheritEnvironment": {
+								"type": "boolean",
+								"description": "Inherit the VSCode Environment Variables",
+								"default": false
+							},
 							"stopOnEntry": {
 								"type": "boolean",
 								"description": "Automatically stop after launch.",
Index: lldb/test/API/tools/lldb-vscode/environmentVariables/main.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/tools/lldb-vscode/environmentVariables/main.cpp
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+extern char **environ;
+
+int main(int argc, char const *argv[], char const *envp[]) {
+    char** env_var_pointer = environ;
+    for (char* env_variable = *env_var_pointer; env_variable; env_variable=*++env_var_pointer) {
+        printf("%s\n", env_variable);
+    }
+    return 0;
+}
\ No newline at end of file
Index: lldb/test/API/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py
===================================================================
--- /dev/null
+++ lldb/test/API/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py
@@ -0,0 +1,33 @@
+"""
+Test lldb-vscode completions request
+"""
+
+
+import lldbvscode_testcase
+import unittest2
+import vscode
+from lldbsuite.test import lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class TestVSCode_variables(lldbvscode_testcase.VSCodeTestCaseBase):
+
+    @skipIfWindows
+    @skipIfDarwin # Skip this test for now until we can figure out why tings aren't working on build bots
+    def test_environment_variable(self):
+        """
+            Tests the environment variables
+        """
+        program = self.getBuildArtifact("a.out")
+        path_env_variable = 'PATH='+os.environ['PATH']
+        self.build_and_launch(program, inheritEnvironment=False)
+        self.continue_to_exit()
+        output = self.get_stdout().encode('utf-8')
+        lines = output.splitlines()
+        found = False
+        for line in lines:
+            if line.startswith('PATH='):
+                found = True
+                self.assertTrue(path_env_variable == line, "PATH environment variable not the same")
+        self.assertTrue(found, 'PATH environment variable not found')
+        
\ No newline at end of file


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74636.244763.patch
Type: text/x-patch
Size: 2676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200214/f1293cae/attachment.bin>


More information about the lldb-commits mailing list