aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/CodeGen/2009-10-20-GlobalDebug.c1
-rw-r--r--test/lit.cfg30
2 files changed, 31 insertions, 0 deletions
diff --git a/test/CodeGen/2009-10-20-GlobalDebug.c b/test/CodeGen/2009-10-20-GlobalDebug.c
index 3c46bea379..42f020e39e 100644
--- a/test/CodeGen/2009-10-20-GlobalDebug.c
+++ b/test/CodeGen/2009-10-20-GlobalDebug.c
@@ -1,3 +1,4 @@
+// REQUIRES: x86-registered-target
// RUN: %clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s
int global;
// CHECK: ascii "localstatic" ## DW_AT_name
diff --git a/test/lit.cfg b/test/lit.cfg
index 4b9d529b7d..e18105df19 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -171,3 +171,33 @@ if platform.system() != 'Windows':
# Shell execution
if platform.system() not in ['Windows'] or lit.getBashPath() != '':
config.available_features.add('shell')
+
+# Registered Targets
+import subprocess
+import re
+import os
+
+def getRegisteredTargets(tool):
+ set_of_targets = set()
+
+ cmd = subprocess.Popen([tool, '-version'], stdout=subprocess.PIPE)
+
+ # Parse the stdout to get the list of registered targets.
+ parse_targets = False
+ for line in cmd.stdout:
+ if parse_targets:
+ m = re.match( r'(.*) - ', line)
+ if m is not None:
+ set_of_targets.add(m.group(1).strip() + '-registered-target')
+ else:
+ break
+ elif "Registered Targets:" in line:
+ parse_targets = True
+
+ return set_of_targets
+
+registered_targets = getRegisteredTargets(os.path.join(llvm_tools_dir, 'llc'))
+if len(registered_targets) > 0:
+ config.available_features.update(registered_targets)
+else:
+ lit.fatal('No Targets Registered with the LLVM Tools!')