Chromium Code Reviews| Index: tools/clang/scripts/update.py |
| diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py |
| index 5cdfbae506b8ffb0b69a313f85991c81478adfc7..d24349c944fdfe27ec72364dc971535ac6b99414 100755 |
| --- a/tools/clang/scripts/update.py |
| +++ b/tools/clang/scripts/update.py |
| @@ -373,6 +373,24 @@ def CopyDiaDllTo(target_dir): |
| CopyFile(dia_dll, target_dir) |
| +def VeryifyVersionOfBuiltClangMatchesVERSION(): |
| + """Checks that `clang --version` outputs VERSION. If this fails, VERSION |
| + in this file is out-of-date and needs to be updated (possibly in an |
| + `if use_head_revision:` block in main() first).""" |
| + clang = os.path.join(LLVM_BUILD_DIR, 'bin', 'clang') |
| + if sys.platform == 'win32': |
| + # TODO: Parse `clang-cl /?` output for built clang's version and check that |
| + # to check the binary we're actually shipping? But clang-cl.exe is just |
| + # a copy of clang.exe, so this does check the same thing. |
| + clang += '.exe' |
|
hans
2016/08/08 18:54:00
Yeah, I think checking clang is good enough.
If w
|
| + version_out = subprocess.check_output([clang, '--version']) |
| + version_out = re.match(r'clang version (\S+)', version_out).group(1) |
|
hans
2016/08/08 18:54:00
Sorry, I should have mentioned this the first time
Nico
2016/08/08 19:00:31
Does it matter if we compare to VERSION later? If
hans
2016/08/08 19:27:32
I figured if for whatever reason clang starts prin
Nico
2016/08/08 20:26:20
Hm, I think I'd prefer if this turned red in that
|
| + if version_out != VERSION: |
| + print ('unexpected clang version %s (not %s), update VERSION in update.py' |
| + % (version_out, VERSION)) |
| + sys.exit(1) |
| + |
| + |
| def UpdateClang(args): |
| print 'Updating Clang to %s...' % PACKAGE_VERSION |
| @@ -648,7 +666,7 @@ def UpdateClang(args): |
| elif sys.platform.startswith('linux'): |
| RunCommand(['strip', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')]) |
| - # TODO(thakis): Check that `clang --version` matches VERSION. |
| + VeryifyVersionOfBuiltClangMatchesVERSION() |
| # Do an out-of-tree build of compiler-rt. |
| # On Windows, this is used to get the 32-bit ASan run-time. |