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

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

Issue 2977433002: Fixed few small bugs (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | 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
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2017 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 """A script to compile the integration tests with llvm's clang, 5 """A script to compile the integration tests with llvm's clang,
6 instrument the code with llvm's Asan, and link it to the syzyasan_rtl 6 instrument the code with llvm's Asan, and link it to the syzyasan_rtl
7 runtime environment. 7 runtime environment.
8 """ 8 """
9 9
10 import optparse 10 import optparse
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 '-DNOMINMAX', 49 '-DNOMINMAX',
50 '-D_CRT_SECURE_NO_WARNINGS', 50 '-D_CRT_SECURE_NO_WARNINGS',
51 '-I', 51 '-I',
52 src_dir, 52 src_dir,
53 ] 53 ]
54 54
55 compile_command_base = [clang_path] 55 compile_command_base = [clang_path]
56 compile_command_base.extend(compiler_flags) 56 compile_command_base.extend(compiler_flags)
57 57
58 for source_file, object_file in zip(source_files, object_files): 58 for source_file, object_file in zip(source_files, object_files):
59 compile_command = [compile_command_base, source_file, '-o', object_files] 59 compile_command = compile_command_base
Sébastien Marchand 2017/07/10 15:10:04 This doesn't work as this doesn't copy the list, s
njanevsk 2017/07/10 15:55:52 Actually the code does what it is supposed to do.
60 60 compile_command.extend([source_file, '-o', object_file])
61 print compile_command
Sébastien Marchand 2017/07/07 19:11:22 Remove the debugging code.
Sébastien Marchand 2017/07/10 14:58:42 You forgot to address this comment. Please make su
njanevsk 2017/07/10 15:55:52 Done.
njanevsk 2017/07/10 15:55:53 Done.
61 ret = subprocess.call(compile_command) 62 ret = subprocess.call(compile_command)
62 if ret != 0: 63 if ret != 0:
63 print 'ERROR: Failed compiling %s using clang-cl.' % target_name 64 print 'ERROR: Failed compiling %s using clang-cl.' % target_name
64 return ret 65 return ret
65 return ret 66 return ret
66 67
67 68
68 def link(clang_path, object_files, build_dir, target_name): 69 def link(clang_path, object_files, build_dir, target_name):
69 """ Links the object files and produces the integration_tests_clang_dll.dll. 70 """ Links the object files and produces the integration_tests_clang_dll.dll.
70 71
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 parser.error('--input-files is required.') 114 parser.error('--input-files is required.')
114 if not options.target_name: 115 if not options.target_name:
115 parser.error('--target-name is required.') 116 parser.error('--target-name is required.')
116 117
117 def get_object_file_location(source_file, 118 def get_object_file_location(source_file,
118 output_dir, target_name): 119 output_dir, target_name):
119 return os.path.join(output_dir, 'obj', 120 return os.path.join(output_dir, 'obj',
120 os.path.split(os.path.relpath(source_file, 121 os.path.split(os.path.relpath(source_file,
121 _SRC_DIR))[0], 122 _SRC_DIR))[0],
122 '%s.%s.obj' % (target_name, 123 '%s.%s.obj' % (target_name,
123 os.path.splitext(os.path.basename(source_file))[0]) 124 os.path.splitext(os.path.basename(source_file))[0]))
124 125
125 source_files = options.input_files.split() 126 source_files = options.input_files.split()
126 object_files = [] 127 object_files = []
127 128
128 for source_file in source_files: 129 for source_file in source_files:
129 object_files.append(get_object_file_location(source_file, 130 object_files.append(get_object_file_location(source_file,
130 options.output_dir, 131 options.output_dir,
131 options.target_name)) 132 options.target_name))
132 133
133 ret = compile_with_asan(_CLANG_CL_PATH, source_files, _SRC_DIR, 134 ret = compile_with_asan(_CLANG_CL_PATH, source_files, _SRC_DIR,
134 object_files, options.target_name) 135 object_files, options.target_name)
135 136
136 if ret == 0: 137 if ret == 0:
137 ret = link(_CLANG_CL_PATH, object_files, options.output_dir, 138 ret = link(_CLANG_CL_PATH, object_files, options.output_dir,
138 options.target_name) 139 options.target_name)
139 else: 140 else:
140 print ('ERROR: Compilation of %s failed, skipping link step.' 141 print ('ERROR: Compilation of %s failed, skipping link step.'
141 % options.target_name) 142 % options.target_name)
142 143
143 return ret 144 return ret
144 145
145 146
146 if __name__ == '__main__': 147 if __name__ == '__main__':
147 sys.exit(main()) 148 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698