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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145231 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lit.cfg b/test/lit.cfg
index 1f4a845..726e861 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -194,8 +194,9 @@
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 @@
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')