diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
6 files changed, 37 insertions, 17 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py index 8bd17feacb1..494af7e2acd 100644 --- a/lldb/packages/Python/lldbsuite/test/configuration.py +++ b/lldb/packages/Python/lldbsuite/test/configuration.py @@ -107,7 +107,9 @@ lldb_platform_working_dir = None test_build_dir = None # The clang module cache directory used by lldb. -module_cache_dir = None +lldb_module_cache_dir = None +# The clang module cache directory used by clang. +clang_module_cache_dir = None # The only directory to scan for tests. If multiple test directories are # specified, and an exclusive test subdirectory is specified, the latter option diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index 652a02e5ed6..7b5414ee32d 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -426,11 +426,18 @@ def parseOptionsAndInitTestdirs(): configuration.lldb_platform_working_dir = args.lldb_platform_working_dir if args.test_build_dir: configuration.test_build_dir = args.test_build_dir - if args.module_cache_dir: - configuration.module_cache_dir = args.module_cache_dir + if args.lldb_module_cache_dir: + configuration.lldb_module_cache_dir = args.lldb_module_cache_dir else: - configuration.module_cache_dir = os.path.join(configuration.test_build_dir, - 'module-cache-lldb') + configuration.lldb_module_cache_dir = os.path.join( + configuration.test_build_dir, 'module-cache-lldb') + if args.clang_module_cache_dir: + configuration.clang_module_cache_dir = args.clang_module_cache_dir + else: + 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 # Gather all the dirs passed on the command line. if len(args.args) > 0: diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py index 4922f27c7bf..fd77c7dc88f 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest_args.py +++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -150,10 +150,15 @@ def create_parser(): default='lldb-test-build.noindex', help='The root build directory for the tests. It will be removed before running.') group.add_argument( - '--module-cache-dir', - dest='module_cache_dir', + '--lldb-module-cache-dir', + dest='lldb_module_cache_dir', metavar='The clang module cache directory used by LLDB', - help='The clang module cache directory used by LLDB. This is not the one used by the makefiles. Defaults to <test build directory>/module-cache-lldb.') + help='The clang module cache directory used by LLDB. Defaults to <test build directory>/module-cache-lldb.') + group.add_argument( + '--clang-module-cache-dir', + dest='clang_module_cache_dir', + metavar='The clang module cache directory used by Clang', + help='The clang module cache directory used in the Make files by Clang while building tests. Defaults to <test build directory>/module-cache-clang.') # Configuration options group = parser.add_argument_group('Remote platform options') diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 313823b47f6..34e6aa8f460 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -696,7 +696,7 @@ class Base(unittest2.TestCase): "settings set plugin.process.gdb-remote.packet-timeout 60", 'settings set symbols.clang-modules-cache-path "{}"'.format( - configuration.module_cache_dir), + configuration.lldb_module_cache_dir), "settings set use-color false", ] # Make sure that a sanitizer LLDB's environment doesn't get passed on. diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 378e9ec99ba..c8b01845c95 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -313,14 +313,6 @@ ifeq "$(MAKE_DWO)" "YES" CFLAGS += -gsplit-dwarf endif -# Use a shared module cache when building in the default test build directory. -CLANG_MODULE_CACHE_DIR := $(shell echo "$(BUILDDIR)" | sed $(QUOTE)s/lldb-test-build.noindex.*/lldb-test-build.noindex\/module-cache-clang/$(QUOTE)) - -ifeq "$(findstring lldb-test-build.noindex, $(BUILDDIR))" "" -CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/module-cache -$(warning failed to set the shared clang module cache dir) -endif - MODULE_BASE_FLAGS := -fmodules -gmodules -fmodules-cache-path=$(CLANG_MODULE_CACHE_DIR) MANDATORY_MODULE_BUILD_CFLAGS := $(MODULE_BASE_FLAGS) -gmodules # Build flags for building with C++ modules. diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py index e5ef5276616..aede03da14c 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_base.py @@ -122,6 +122,16 @@ def getSDKRootSpec(): return "SDKROOT={}".format(os.environ["SDKROOT"]) return ""; +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: + return "CLANG_MODULE_CACHE_DIR={}".format( + os.environ["CLANG_MODULE_CACHE_DIR"]) + return ""; + def getCmdLine(d): """ Helper function to return a properly formatted command line argument(s) @@ -168,6 +178,7 @@ def buildDefault( getCCSpec(compiler), getDsymutilSpec(), getSDKRootSpec(), + getModuleCacheSpec(), getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) @@ -191,6 +202,7 @@ def buildDwarf( getCCSpec(compiler), getDsymutilSpec(), getSDKRootSpec(), + getModuleCacheSpec(), getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) @@ -214,6 +226,7 @@ def buildDwo( getCCSpec(compiler), getDsymutilSpec(), getSDKRootSpec(), + getModuleCacheSpec(), getCmdLine(dictionary)]) runBuildCommands(commands, sender=sender) @@ -237,6 +250,7 @@ def buildGModules( getCCSpec(compiler), getDsymutilSpec(), getSDKRootSpec(), + getModuleCacheSpec(), getCmdLine(dictionary)]) lldbtest.system(commands, sender=sender) |