Woohoo! On 03/06/2020 01:50, Jonas Devlieghere via lldb-commits wrote: > > Author: Jonas Devlieghere > Date: 2020-06-02T16:49:58-07:00 > New Revision: 4c53d4801cbbb1b573e4ef758f93ead12e1f59a2 > > URL: > https://github.com/llvm/llvm-project/commit/4c53d4801cbbb1b573e4ef758f93ead12e1f59a2 > DIFF: > https://github.com/llvm/llvm-project/commit/4c53d4801cbbb1b573e4ef758f93ead12e1f59a2.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. Use the > configuration instead. > > Added: > > > Modified: > lldb/packages/Python/lldbsuite/test/configuration.py > lldb/packages/Python/lldbsuite/test/dotest.py > lldb/packages/Python/lldbsuite/test/lldbtest.py > lldb/packages/Python/lldbsuite/test/plugins/builder_base.py > > Removed: > > > > ################################################################################ > diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py > b/lldb/packages/Python/lldbsuite/test/configuration.py > index 0439c4e8f1ac..f05152253c75 100644 > --- a/lldb/packages/Python/lldbsuite/test/configuration.py > +++ b/lldb/packages/Python/lldbsuite/test/configuration.py > @@ -42,8 +42,10 @@ > count = 1 > > # The 'arch' and 'compiler' can be specified via command line. > -arch = None # Must be initialized after option parsing > -compiler = None # Must be initialized after option parsing > +arch = None > +compiler = None > +dsymutil = None > +sdkroot = None > > # The overriden dwarf verison. > dwarf_version = 0 > > diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py > b/lldb/packages/Python/lldbsuite/test/dotest.py > index 54e5d4bc2df5..80edad811bae 100644 > --- a/lldb/packages/Python/lldbsuite/test/dotest.py > +++ b/lldb/packages/Python/lldbsuite/test/dotest.py > @@ -275,9 +275,9 @@ def parseOptionsAndInitTestdirs(): > break > > if args.dsymutil: > - os.environ['DSYMUTIL'] = args.dsymutil > + configuration.dsymutil = args.dsymutil > elif platform_system == 'Darwin': > - os.environ['DSYMUTIL'] = seven.get_command_output( > + configuration.dsymutil = seven.get_command_output( > 'xcrun -find -toolchain default dsymutil') > > if args.filecheck: > @@ -302,7 +302,7 @@ def parseOptionsAndInitTestdirs(): > > # Set SDKROOT if we are using an Apple SDK > if platform_system == 'Darwin' and args.apple_sdk: > - os.environ['SDKROOT'] = seven.get_command_output( > + configuration.sdkroot = seven.get_command_output( > 'xcrun --sdk "%s" --show-sdk-path 2> /dev/null' % > (args.apple_sdk)) > > @@ -310,10 +310,10 @@ def parseOptionsAndInitTestdirs(): > configuration.arch = args.arch > if configuration.arch.startswith( > 'arm') and platform_system == 'Darwin' and not > args.apple_sdk: > - os.environ['SDKROOT'] = seven.get_command_output( > + configuration.sdkroot = seven.get_command_output( > 'xcrun --sdk iphoneos.internal --show-sdk-path 2> /dev/null') > - if not os.path.exists(os.environ['SDKROOT']): > - os.environ['SDKROOT'] = seven.get_command_output( > + if not os.path.exists(configuration.sdkroot): > + configuration.sdkroot = seven.get_command_output( > 'xcrun --sdk iphoneos --show-sdk-path 2> /dev/null') > else: > configuration.arch = platform_machine > @@ -522,7 +522,7 @@ def setupSysPath(): > # Set up the root build directory. > 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) > + configuration.test_build_dir = > os.path.abspath(configuration.test_build_dir) > > # Set up the LLDB_SRC environment variable, so that the tests can locate > # the LLDB source code. > @@ -1041,8 +1041,7 @@ def run_suite(): > > # Set up the working directory. > # Note that it's not dotest's job to clean this directory. > - build_dir = configuration.test_build_dir > - lldbutil.mkdir_p(build_dir) > + lldbutil.mkdir_p(configuration.test_build_dir) > > target_platform = lldb.selected_platform.GetTriple().split('-')[2] > > > diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py > b/lldb/packages/Python/lldbsuite/test/lldbtest.py > index 04ba7ea02d09..0a640d2d5c93 100644 > --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py > +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py > @@ -668,7 +668,7 @@ def getBuildDirBasename(self): > > def getBuildDir(self): > """Return the full path to the current test.""" > - return os.path.join(os.environ["LLDB_BUILD"], self.mydir, > + return os.path.join(configuration.test_build_dir, self.mydir, > self.getBuildDirBasename()) > > def getReproducerDir(self): > @@ -682,7 +682,6 @@ def getReproducerDir(self): > def makeBuildDir(self): > """Create the test-specific working directory, deleting any previous > contents.""" > - # See also dotest.py which sets up ${LLDB_BUILD}. > bdir = self.getBuildDir() > if os.path.isdir(bdir): > shutil.rmtree(bdir) > > diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py > b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py > index 3c19839869c4..e54431eb1fe7 100644 > --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py > +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py > @@ -63,11 +63,10 @@ def getMake(test_subdir, test_name): > # Construct the base make invocation. > lldb_test = os.environ["LLDB_TEST"] > lldb_test_src = os.environ["LLDB_TEST_SRC"] > - lldb_build = os.environ["LLDB_BUILD"] > - if not (lldb_test and lldb_test_src and lldb_build and test_subdir and > + if not (lldb_test and lldb_test_src and configuration.test_build_dir and > test_subdir and > test_name and (not os.path.isabs(test_subdir))): > raise Exception("Could not derive test directories") > - build_dir = os.path.join(lldb_build, test_subdir, test_name) > + build_dir = os.path.join(configuration.test_build_dir, test_subdir, > test_name) > src_dir = os.path.join(lldb_test_src, test_subdir) > # This is a bit of a hack to make inline testcases work. > makefile = os.path.join(src_dir, "Makefile") > @@ -111,18 +110,18 @@ def getDsymutilSpec(): > Helper function to return the key-value string to specify the dsymutil > used for the make system. > """ > - if "DSYMUTIL" in os.environ: > - return "DSYMUTIL={}".format(os.environ["DSYMUTIL"]) > - return ""; > + if configuration.dsymutil: > + return "DSYMUTIL={}".format(configuration.dsymutil) > + return "" > > def getSDKRootSpec(): > """ > Helper function to return the key-value string to specify the SDK root > used for the make system. > """ > - if "SDKROOT" in os.environ: > - return "SDKROOT={}".format(os.environ["SDKROOT"]) > - return ""; > + if configuration.sdkroot: > + return "SDKROOT={}".format(configuration.sdkroot) > + return "" > > def getModuleCacheSpec(): > """ > @@ -132,7 +131,7 @@ def getModuleCacheSpec(): > if configuration.clang_module_cache_dir: > return "CLANG_MODULE_CACHE_DIR={}".format( > configuration.clang_module_cache_dir) > - return ""; > + return "" > > def getCmdLine(d): > """ > > > > _______________________________________________ > lldb-commits mailing list > lldb-commits@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits >
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits