From cd9c3d664762bfb2e37a97c023499c67f51b2462 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Mon, 28 Nov 2011 05:09:42 +0000 Subject: [PATCH] test/lit.cfg: Enhance getRegisteredTargets() to retrieve +Asserts. - s/getRegisteredTargets/get_llc_props/g - get_llc_props() returns dict {"set_of_targets", "enable_assertions"} - Enable the feature "asserts". test/Driver/darwin-verify-debug.c had expected it. llvm-svn: 145231 --- clang/test/lit.cfg | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/clang/test/lit.cfg b/clang/test/lit.cfg index 1f4a8452b010..726e861b4a86 100644 --- a/clang/test/lit.cfg +++ b/clang/test/lit.cfg @@ -194,8 +194,9 @@ if platform.system() not in ['Windows'] or lit.getBashPath() != '': config.available_features.add('shell') # Registered Targets -def getRegisteredTargets(tool): +def get_llc_props(tool): set_of_targets = set() + enable_assertions = False cmd = subprocess.Popen([tool, '-version'], stdout=subprocess.PIPE) @@ -211,10 +212,17 @@ def getRegisteredTargets(tool): elif "Registered Targets:" in line: parse_targets = True - return set_of_targets + if re.search(r'with assertions', line): + enable_assertions = True -registered_targets = getRegisteredTargets(os.path.join(llvm_tools_dir, 'llc')) -if len(registered_targets) > 0: - config.available_features.update(registered_targets) + return {"set_of_targets": set_of_targets, + "enable_assertions": enable_assertions} + +llc_props = get_llc_props(os.path.join(llvm_tools_dir, 'llc')) +if len(llc_props['set_of_targets']) > 0: + config.available_features.update(llc_props['set_of_targets']) else: lit.fatal('No Targets Registered with the LLVM Tools!') + +if llc_props['enable_assertions']: + config.available_features.add('asserts')