From: David Dean Date: Thu, 11 Jul 2013 23:37:50 +0000 (+0000) Subject: Add the ability to use guarded malloc when running clang's lit tests. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22d017d2e12c079d1a324517a781ea6ae71e1e43;p=clang Add the ability to use guarded malloc when running clang's lit tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186135 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/lit.cfg b/test/lit.cfg index bf8528b3f6..7bc6321a7f 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -317,3 +317,23 @@ if (config.llvm_use_sanitizer == "Memory" or # Check if we should run long running tests. if lit.params.get("run_long_tests", None) == "true": config.available_features.add("long_tests") + +# Check if we should use gmalloc. +use_gmalloc_str = lit.params.get('use_gmalloc', None) +if use_gmalloc_str is not None: + if use_gmalloc_str.lower() in ('1', 'true'): + use_gmalloc = True + elif use_gmalloc_str.lower() in ('', '0', 'false'): + use_gmalloc = False + else: + lit.fatal('user parameter use_gmalloc should be 0 or 1') +else: + # Default to not using gmalloc + use_gmalloc = False + +# Allow use of an explicit path for gmalloc library. +# Will default to '/usr/lib/libgmalloc.dylib' if not set. +gmalloc_path_str = lit.params.get('gmalloc_path', '/usr/lib/libgmalloc.dylib') + +if use_gmalloc: + config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str})