From: Galina Kistanova Date: Fri, 3 Jun 2011 18:36:30 +0000 (+0000) Subject: Added registered targets for in-test dependency declarations. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee22697a56f3035419e71762134ff7ea0d8f1eb8;p=clang Added registered targets for in-test dependency declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132571 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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!')