Skip to content

Commit 7aaef2a

Browse files
author
Jessica Paquette
committed
Fix version string handling in compilers.py to work with monorepo builds
We should never have a case where we have separate LLVM + clang commit hashes at this point. Remove the code from compilers.py that supports separate revisions. It is no longer correct to have this code, and it can prevent LNT from picking up the monorepo revision. Update testcases to reflect this.
1 parent 10f1592 commit 7aaef2a

File tree

5 files changed

+26
-48
lines changed

5 files changed

+26
-48
lines changed

lnt/testing/util/compilers.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,6 @@ def get_cc_info(path, cc_flags=[]):
158158
cc_build = 'DEV'
159159
else:
160160
cc_build = 'DEV'
161-
162-
# Newer Clang's can report separate versions for LLVM and Clang. Parse
163-
# the cc_extra text so we can get the maximum SVN version.
164-
if cc_extra.startswith('(') and cc_extra.endswith(')'):
165-
m = re.match(r'\((.+) ([^ ]+)\)', cc_extra)
166-
if m:
167-
cc_alt_src_branch, cc_alt_src_revision = m.groups()
168-
169-
# With a CMake build, the branch is not emitted.
170-
if cc_src_branch and not cc_src_revision and \
171-
cc_src_branch.isdigit():
172-
cc_alt_src_revision = cc_alt_src_branch
173-
cc_alt_src_branch = ""
174-
175-
else:
176-
logger.error('unable to determine '
177-
'Clang development build info: %r' %
178-
((cc_name, cc_build_string, cc_extra), ))
179-
180161
elif cc_name == 'gcc' and 'LLVM build' in cc_extra:
181162
llvm_capable = True
182163
cc_norm_name = 'llvm-gcc'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fakecompiler.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fakecompiler.py

tests/SharedInputs/FakeCompilers/fakecompiler.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,12 @@ def print_verbose_info(self):
104104
g_program,), file=sys.stderr)
105105

106106

107-
# Clang build from a git repository.
108-
class Clang_git(LLVMCompiler):
109-
compiler_name = "clang-git"
110-
107+
# Monorepo clang build
108+
class Clang_monorepo(LLVMCompiler):
109+
compiler_name = "clang-monorepo"
111110
def print_verbose_info(self):
112111
print("""\
113-
clang version 3.1\
114-
(git:/git/clang.git 37ce0feee598d82e7220fa0a4b110619cae6ea72)\
115-
(git:/git/llvm.git 60fca4f64e697ad834ce7ee8c2e478cae394c7dc)
112+
clang version 1.2.3 (ssh://something.com/llvm-project.git 597522d740374f093a089a2acbec5b20466b2f34)
116113
Target: arm-apple-darwin11.4.0
117114
Thread model: posix
118115
InstalledDir: /home/foo/bin
@@ -121,23 +118,19 @@ def print_verbose_info(self):
121118
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
122119
g_program,), file=sys.stderr)
123120

124-
125-
# Clang build from a git repository.
126-
class Clang_git_2(LLVMCompiler):
127-
compiler_name = "clang-git-2"
128-
121+
# Monorepo clang build with some extra stuff after the version string
122+
class Clang_monorepo2(LLVMCompiler):
123+
compiler_name = "clang-monorepo2"
129124
def print_verbose_info(self):
130125
print("""\
131-
clang version 3.2\
132-
(/d/g/pz/clang.git git:/git/pz/clang.git 8ab09316f63ea99ff23b2684c454b1008b8d5f10)\
133-
(http://llvm.org/git/llvm.git /d/g/pz/llvm.git git:/git/pb/llvm.git 7c53f795961cc2d35b85d315aadb2ac135a0fdb2)
134-
Target: x86_64-apple-darwin12.2.0
135-
Thread model: posix""", file=sys.stderr)
126+
clang version 1.2.3 (ssh://something.com/llvm-project.git 597522d740374f093a089a2acbec5b20466b2f34) (extra) (stuff) (here)
127+
Thread model: posix
128+
InstalledDir: /home/foo/bin
129+
""", file=sys.stderr)
136130
print("""\
137131
"%s" "-cc1" "-E" ... more boring stuff here ...""" % (
138132
g_program,), file=sys.stderr)
139133

140-
141134
class AppleClang_138_1(LLVMCompiler):
142135
compiler_name = "apple-clang-138.1"
143136

tests/testing/Compilers.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,24 @@ def get_info(name):
4242
assert info['cc_build'] == 'PROD'
4343
assert info['inferred_run_order'] == '138.1'
4444

45-
# Check a Clang built from git repositories.
46-
info = get_info("clang-git")
45+
# Check a monorepo Clang.
46+
info = get_info("clang-monorepo")
4747
pprint.pprint(info)
4848
assert info['cc_name'] == 'clang'
4949
assert info['cc_build'] == 'DEV'
50-
assert info['inferred_run_order'] == '%s,%s' % (
51-
'37ce0feee598d82e7220fa0a4b110619cae6ea72',
52-
'60fca4f64e697ad834ce7ee8c2e478cae394c7dc')
50+
assert info['cc_src_branch'] == 'ssh://something.com/llvm-project.git'
51+
assert info['cc_src_revision'] == '597522d740374f093a089a2acbec5b20466b2f34'
52+
assert info['inferred_run_order'] == info['cc_src_revision']
53+
assert info['cc_version_number'] == '1.2.3'
5354

54-
info = get_info("clang-git-2")
55+
# Same as clang-monorepo, except the version string has some extra parens at
56+
# the end. Verify that we can still match this.
57+
info = get_info("clang-monorepo2")
5558
pprint.pprint(info)
56-
assert info['cc_name'] == 'clang'
57-
assert info['cc_build'] == 'DEV'
58-
assert info['inferred_run_order'] == '%s,%s' % (
59-
'8ab09316f63ea99ff23b2684c454b1008b8d5f10',
60-
'7c53f795961cc2d35b85d315aadb2ac135a0fdb2')
59+
assert info['cc_src_branch'] == 'ssh://something.com/llvm-project.git'
60+
assert info['cc_src_revision'] == '597522d740374f093a089a2acbec5b20466b2f34'
61+
assert info['inferred_run_order'] == info['cc_src_revision']
62+
assert info['cc_version_number'] == '1.2.3'
6163

6264
# Check a Clang that prints no info.
6365
info = get_info("clang-no-info")

0 commit comments

Comments
 (0)