Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1249)

Side by Side Diff: syzygy/integration_tests/make_integration_tests_clang.py

Issue 2946063002: Python script to compile and link the integration tests using llvm's clang-cl (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « syzygy/agent/asan/syzyasan_rtl.def.template ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2017 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import optparse
7 import os
8 import re
9 import subprocess
10 import sys
11
12
13 def main():
14 parser = optparse.OptionParser(usage='%prog [options]')
15 parser.add_option('--src-dir',
Sébastien Marchand 2017/06/21 15:32:49 You don't need this, you can automatically find it
njanevsk 2017/06/21 19:26:49 That command gives the path to the script/file. I
Sébastien Marchand 2017/06/21 19:51:36 Yes, look at the line following the one I linked t
16 help='The src directory where the syzygy repository is located.')
17 parser.add_option('--release-dir', help='Syzygy build directory.')
Sébastien Marchand 2017/06/21 15:32:49 We tend to call this --build-dir
njanevsk 2017/06/21 19:26:49 Done.
18 parser.add_option('--input_files', help='files to be compiled and linked')
Sébastien Marchand 2017/06/21 15:32:49 be consistent, you're using dashes for the other f
njanevsk 2017/06/21 19:26:49 Done.
19
20 options, _ = parser.parse_args()
21
22 if not options.src_dir:
23 parser.error('--src-dir is required')
24 if not options.release_dir:
25 parser.error('--release-dir is required')
26 if not options.input_files:
27 parser.error('--input_files is required')
28
29 clang_path = options.src_dir + "/third_party/llvm-build/Release+Asserts/bin/cl ang-cl.exe"
Sébastien Marchand 2017/06/21 15:32:49 The 80 chars / line rule also apply to Python scri
njanevsk 2017/06/21 19:26:49 Done.
Sébastien Marchand 2017/06/21 19:51:36 You haven't addressed the second part of this comm
30 compiler_flags = '-c -fsanitize=address -mllvm -asan-instrumentation-with-call -threshold=0 -mllvm -asan-stack=0 -DUNICODE -D_UNICODE -DNOMINMAX -D_CRT_SECURE_ NO_WARNINGS -I' + options.src_dir
Sébastien Marchand 2017/06/21 15:32:49 Ooch, having this as a list will make it much easi
njanevsk 2017/06/21 19:26:49 Done.
31
32 source_files = re.findall(r'\b(\w+.cc)\b', options.input_files)
Sébastien Marchand 2017/06/21 15:32:49 I'd prefer to have something that works for all th
njanevsk 2017/06/21 19:26:49 Yes we can but in that case I will need to have at
Sébastien Marchand 2017/06/21 19:51:36 I think that I'll keep this as 2 lists. A lot of t
33 print subprocess.check_output('"' + clang_path + '" ' + compiler_flags + ' ' + ' '.join(source_files), shell = True)
Sébastien Marchand 2017/06/21 15:32:49 Same thing, use a list: compile_command = [ cla
njanevsk 2017/06/21 19:26:49 Done.
34 object_files = [filename[:-3] + ".o" for filename in source_files]
Sébastien Marchand 2017/06/21 15:32:49 Use os.path.splitext to get the name of the file.
njanevsk 2017/06/21 19:26:49 Done.
35
36 print subprocess.check_output('"' + clang_path + '" ' + '-m32' + ' ' + ' '.joi n(object_files) + ' -o' + ' ' + options.release_dir + '\integration_tests_dll.dl l' + ' /link /dll ' + options.release_dir + '\export_dll.dll.lib ' + options.rel ease_dir + '\syzyasan_rtl.dll.lib' + ' -defaultlib:libcmt', shell = True)
Sébastien Marchand 2017/06/21 15:32:49 Same comments as above. I'd prefer to split this i
njanevsk 2017/06/21 19:26:49 Done.
37
38 if __name__ == '__main__':
39 sys.exit(main())
OLDNEW
« no previous file with comments | « syzygy/agent/asan/syzyasan_rtl.def.template ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698