[llvm-commits] [LNT] r154721 - in /lnt/trunk: lnt/testing/util/compilers.py tests/SharedInputs/FakeCompilers/clang-git tests/testing/Compilers.py
Daniel Dunbar
daniel at zuster.org
Fri Apr 13 16:36:35 PDT 2012
Author: ddunbar
Date: Fri Apr 13 18:36:34 2012
New Revision: 154721
URL: http://llvm.org/viewvc/llvm-project?rev=154721&view=rev
Log:
lnt.testing.util.compilers: Add support for sniffing versions from Clang built purely from git repos.
Added:
lnt/trunk/tests/SharedInputs/FakeCompilers/clang-git (with props)
Modified:
lnt/trunk/lnt/testing/util/compilers.py
lnt/trunk/tests/testing/Compilers.py
Modified: lnt/trunk/lnt/testing/util/compilers.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/util/compilers.py?rev=154721&r1=154720&r2=154721&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/util/compilers.py (original)
+++ lnt/trunk/lnt/testing/util/compilers.py Fri Apr 13 18:36:34 2012
@@ -7,6 +7,12 @@
from commands import error
from commands import rm_f
+def ishexhash(string):
+ return len(string) == 40 and \
+ len([c
+ for c in string
+ if c.isdigit() or c in 'abcdef']) == 40
+
def get_cc_info(path, cc_flags=[]):
"""get_cc_info(path) -> { ... }
@@ -83,6 +89,7 @@
cc_src_revision = cc_alt_src_revision = None
cc_src_tag = None
llvm_capable = False
+ cc_extra = cc_extra.strip()
if cc_name == 'icc':
cc_norm_name = 'icc'
cc_build = 'PROD'
@@ -98,8 +105,8 @@
else:
error('unable to determine gcc build version: %r' % cc_build_string)
elif (cc_name in ('clang', 'Apple clang') and
- cc_extra == '' or 'based on LLVM' in cc_extra or
- 'llvm/' in cc_extra):
+ (cc_extra == '' or 'based on LLVM' in cc_extra or
+ (cc_extra.startswith('(') and cc_extra.endswith(')')))):
llvm_capable = True
if cc_name == 'Apple clang':
cc_norm_name = 'apple_clang'
@@ -136,8 +143,8 @@
# Newer Clang's can report separate versions for LLVM and Clang. Parse
# the cc_extra text so we can get the maximum SVN version.
- if 'llvm/' in cc_extra:
- m = re.match(r' \(llvm/(.*) (.*)\)', cc_extra)
+ if cc_extra.startswith('(') and cc_extra.endswith(')'):
+ m = re.match(r'\(([^ ]*) (.*)\)', cc_extra)
if m:
cc_alt_src_branch,cc_alt_src_revision = m.groups()
else:
@@ -216,6 +223,17 @@
return str(order)
+ # Otherwise if we have a git hash, use that
+ if ishexhash(info.get('cc_src_revision','')):
+ # If we also have an alt src revision, combine them.
+ #
+ # We don't try and support a mix of integral and hash revisions.
+ if ishexhash(info.get('cc_alt_src_revision','')):
+ return '%s,%s' % (info['cc_src_revision'],
+ info['cc_alt_src_revision'])
+
+ return info['cc_src_revision']
+
# If this is a production compiler, look for a source tag. We don't accept 0
# or 9999 as valid source tag, since that is what llvm-gcc builds use when
# no build number is given.
Added: lnt/trunk/tests/SharedInputs/FakeCompilers/clang-git
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/SharedInputs/FakeCompilers/clang-git?rev=154721&view=auto
==============================================================================
--- lnt/trunk/tests/SharedInputs/FakeCompilers/clang-git (added)
+++ lnt/trunk/tests/SharedInputs/FakeCompilers/clang-git Fri Apr 13 18:36:34 2012
@@ -0,0 +1 @@
+link fakecompiler.py
\ No newline at end of file
Propchange: lnt/trunk/tests/SharedInputs/FakeCompilers/clang-git
------------------------------------------------------------------------------
svn:special = *
Modified: lnt/trunk/tests/testing/Compilers.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/testing/Compilers.py?rev=154721&r1=154720&r2=154721&view=diff
==============================================================================
--- lnt/trunk/tests/testing/Compilers.py (original)
+++ lnt/trunk/tests/testing/Compilers.py Fri Apr 13 18:36:34 2012
@@ -39,3 +39,12 @@
assert info['cc_name'] == 'apple_clang'
assert info['cc_build'] == 'PROD'
assert info['inferred_run_order'] == '138.1'
+
+# Check a Clang built from git repositories.
+info = get_info("clang-git")
+pprint.pprint(info)
+assert info['cc_name'] == 'clang'
+assert info['cc_build'] == 'DEV'
+assert info['inferred_run_order'] == '%s,%s' % (
+ '37ce0feee598d82e7220fa0a4b110619cae6ea72',
+ '60fca4f64e697ad834ce7ee8c2e478cae394c7dc')
More information about the llvm-commits
mailing list