Author: Jonas Devlieghere Date: 2020-06-02T16:11:32-07:00 New Revision: 5138a91ef4f365a3e71eec4cea6b4599dfaabf26
URL: https://github.com/llvm/llvm-project/commit/5138a91ef4f365a3e71eec4cea6b4599dfaabf26 DIFF: https://github.com/llvm/llvm-project/commit/5138a91ef4f365a3e71eec4cea6b4599dfaabf26.diff LOG: [lldb/Test] Don't use the env to pass around configuration variables (NFC) Don't use the environment to pass values to the builder that are present in the dotest configuration module. A subsequent patch will pass the remaining values through the configuration instead of the environment. Added: Modified: lldb/packages/Python/lldbsuite/test/dotest.py lldb/packages/Python/lldbsuite/test/plugins/builder_base.py Removed: ################################################################################ diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index c4e4b615aca8..54e5d4bc2df5 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -462,8 +462,6 @@ def parseOptionsAndInitTestdirs(): configuration.clang_module_cache_dir = os.path.join( configuration.test_build_dir, 'module-cache-clang') - os.environ['CLANG_MODULE_CACHE_DIR'] = configuration.clang_module_cache_dir - if args.lldb_libs_dir: configuration.lldb_libs_dir = args.lldb_libs_dir @@ -522,7 +520,6 @@ def setupSysPath(): os.environ["LLDB_TEST_SRC"] = lldbsuite.lldb_test_root # Set up the root build directory. - builddir = configuration.test_build_dir if not configuration.test_build_dir: raise Exception("test_build_dir is not set") os.environ["LLDB_BUILD"] = os.path.abspath(configuration.test_build_dir) @@ -1096,8 +1093,6 @@ def run_suite(): print("compiler=%s" % configuration.compiler) # Iterating over all possible architecture and compiler combinations. - os.environ["ARCH"] = configuration.arch - os.environ["CC"] = configuration.compiler configString = "arch=%s compiler=%s" % (configuration.arch, configuration.compiler) diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py index 0f30f70546fa..3c19839869c4 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py @@ -21,17 +21,18 @@ # Our imports import lldbsuite.test.lldbtest as lldbtest import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test import configuration from lldbsuite.test_event import build_exception def getArchitecture(): """Returns the architecture in effect the test suite is running with.""" - return os.environ["ARCH"] if "ARCH" in os.environ else "" + return configuration.arch if configuration.arch else "" def getCompiler(): """Returns the compiler in effect the test suite is running with.""" - compiler = os.environ.get("CC", "clang") + compiler = configuration.compiler if configuration.compiler else "clang" compiler = lldbutil.which(compiler) return os.path.realpath(compiler) @@ -86,8 +87,8 @@ def getArchSpec(architecture): used for the make system. """ arch = architecture if architecture else None - if not arch and "ARCH" in os.environ: - arch = os.environ["ARCH"] + if not arch and configuration.arch: + arch = configuration.arch return ("ARCH=" + arch) if arch else "" @@ -98,8 +99,8 @@ def getCCSpec(compiler): used for the make system. """ cc = compiler if compiler else None - if not cc and "CC" in os.environ: - cc = os.environ["CC"] + if not cc and configuration.compiler: + cc = configuration.compiler if cc: return "CC=\"%s\"" % cc else: @@ -128,9 +129,9 @@ def getModuleCacheSpec(): Helper function to return the key-value string to specify the clang module cache used for the make system. """ - if "CLANG_MODULE_CACHE_DIR" in os.environ: + if configuration.clang_module_cache_dir: return "CLANG_MODULE_CACHE_DIR={}".format( - os.environ["CLANG_MODULE_CACHE_DIR"]) + configuration.clang_module_cache_dir) return ""; def getCmdLine(d): _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits