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

Side by Side Diff: native_client_sdk/src/build_tools/tests/build_artifacts_test.py

Issue 911423002: [NaCl SDK] Set nacl_allow_thin_archives to 0 in prep for build_nexe change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittest Created 5 years, 10 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 | « native_client_sdk/src/build_tools/build_sdk.py ('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
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2014 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 5
6 import os 6 import os
7 import ntpath 7 import ntpath
8 import posixpath 8 import posixpath
9 import sys 9 import sys
10 import collections 10 import collections
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 class GypNinjaPosixTestCase(BasePosixTestCase): 111 class GypNinjaPosixTestCase(BasePosixTestCase):
112 def setUp(self): 112 def setUp(self):
113 BasePosixTestCase.setUp(self) 113 BasePosixTestCase.setUp(self)
114 patch('sys.executable', 'python').start() 114 patch('sys.executable', 'python').start()
115 patch('build_artifacts.SRC_DIR', 'src_dir').start() 115 patch('build_artifacts.SRC_DIR', 'src_dir').start()
116 patch('os.environ', {}).start() 116 patch('os.environ', {}).start()
117 self.run_mock = patch('buildbot_common.Run').start() 117 self.run_mock = patch('buildbot_common.Run').start()
118 self.options_mock = patch('build_artifacts.options').start() 118 self.options_mock = patch('build_artifacts.options').start()
119 self.options_mock.mac_sdk = False 119 self.options_mock.mac_sdk = False
120 self.options_mock.no_arm_trusted = False 120 self.options_mock.no_arm_trusted = False
121 self.gyp_defines_base = ['nacl_allow_thin_archives=0']
121 122
122 def testSimple(self): 123 def testSimple(self):
123 build_artifacts.GypNinjaBuild( 124 build_artifacts.GypNinjaBuild(
124 None, 'gyp.py', 'foo.gyp', 'target', 'out_dir') 125 None, 'gyp.py', 'foo.gyp', 'target', 'out_dir')
125 self.run_mock.assert_has_calls([ 126 self.run_mock.assert_has_calls([
126 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 127 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
127 'output_dir=out_dir'], 128 'output_dir=out_dir'],
128 cwd='src_dir', 129 cwd='src_dir',
129 env={'GYP_GENERATORS': 'ninja', 'GYP_DEFINES': ''}), 130 env={'GYP_GENERATORS': 'ninja',
131 'GYP_DEFINES': ' '.join(self.gyp_defines_base)}),
130 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 132 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
131 ]) 133 ])
132 134
133 def testTargetArch(self): 135 def testTargetArch(self):
134 build_artifacts.GypNinjaBuild( 136 build_artifacts.GypNinjaBuild(
135 'x64', 'gyp.py', 'foo.gyp', 'target', 'out_dir') 137 'x64', 'gyp.py', 'foo.gyp', 'target', 'out_dir')
136 self.run_mock.assert_has_calls([ 138 self.run_mock.assert_has_calls([
137 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 139 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
138 'output_dir=out_dir'], 140 'output_dir=out_dir'],
139 cwd='src_dir', 141 cwd='src_dir',
140 env={ 142 env={
141 'GYP_GENERATORS': 'ninja', 143 'GYP_GENERATORS': 'ninja',
142 'GYP_DEFINES': 'target_arch=x64' 144 'GYP_DEFINES': ' '.join(self.gyp_defines_base +
145 ['target_arch=x64']),
143 }), 146 }),
144 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 147 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
145 ]) 148 ])
146 149
147 def testMultipleTargets(self): 150 def testMultipleTargets(self):
148 build_artifacts.GypNinjaBuild( 151 build_artifacts.GypNinjaBuild(
149 None, 'gyp.py', 'foo.gyp', ['target1', 'target2'], 'out_dir') 152 None, 'gyp.py', 'foo.gyp', ['target1', 'target2'], 'out_dir')
150 self.run_mock.assert_has_calls([ 153 self.run_mock.assert_has_calls([
151 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 154 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
152 'output_dir=out_dir'], 155 'output_dir=out_dir'],
153 cwd='src_dir', 156 cwd='src_dir',
154 env={'GYP_GENERATORS': 'ninja', 'GYP_DEFINES': ''}), 157 env={'GYP_GENERATORS': 'ninja',
158 'GYP_DEFINES': ' '.join(self.gyp_defines_base)}),
155 call(['ninja', '-C', 'out_dir/Release', 'target1', 'target2'], 159 call(['ninja', '-C', 'out_dir/Release', 'target1', 'target2'],
156 cwd='src_dir') 160 cwd='src_dir')
157 ]) 161 ])
158 162
159 def testMacSdk(self): 163 def testMacSdk(self):
160 build_artifacts.PLATFORM = 'mac' 164 build_artifacts.PLATFORM = 'mac'
161 self.options_mock.mac_sdk = '10.6' 165 self.options_mock.mac_sdk = '10.6'
162 build_artifacts.GypNinjaBuild( 166 build_artifacts.GypNinjaBuild(
163 None, 'gyp.py', 'foo.gyp', 'target', 'out_dir') 167 None, 'gyp.py', 'foo.gyp', 'target', 'out_dir')
164 self.run_mock.assert_has_calls([ 168 self.run_mock.assert_has_calls([
165 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 169 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
166 'output_dir=out_dir'], 170 'output_dir=out_dir'],
167 cwd='src_dir', 171 cwd='src_dir',
168 env={ 172 env={
169 'GYP_GENERATORS': 'ninja', 173 'GYP_GENERATORS': 'ninja',
170 'GYP_DEFINES': 'mac_sdk=10.6 clang=1' 174 'GYP_DEFINES': ' '.join(self.gyp_defines_base +
175 ['mac_sdk=10.6', 'clang=1']),
171 }), 176 }),
172 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 177 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
173 ]) 178 ])
174 179
175 def testArmLinux(self): 180 def testArmLinux(self):
176 build_artifacts.PLATFORM = 'linux' 181 build_artifacts.PLATFORM = 'linux'
177 build_artifacts.GypNinjaBuild( 182 build_artifacts.GypNinjaBuild(
178 'arm', 'gyp.py', 'foo.gyp', 'target', 'out_dir') 183 'arm', 'gyp.py', 'foo.gyp', 'target', 'out_dir')
179 self.run_mock.assert_has_calls([ 184 self.run_mock.assert_has_calls([
180 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 185 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
181 'output_dir=out_dir'], 186 'output_dir=out_dir'],
182 cwd='src_dir', 187 cwd='src_dir',
183 env={ 188 env={
184 'GYP_CROSSCOMPILE': '1', 189 'GYP_CROSSCOMPILE': '1',
185 'GYP_GENERATORS': 'ninja', 190 'GYP_GENERATORS': 'ninja',
186 'GYP_DEFINES': 'target_arch=arm arm_float_abi=hard', 191 'GYP_DEFINES': ' '.join(self.gyp_defines_base +
192 ['target_arch=arm',
193 'arm_float_abi=hard']),
187 }), 194 }),
188 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 195 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
189 ]) 196 ])
190 197
191 def testNoArmTrusted(self): 198 def testNoArmTrusted(self):
192 build_artifacts.PLATFORM = 'linux' 199 build_artifacts.PLATFORM = 'linux'
193 self.options_mock.no_arm_trusted = True 200 self.options_mock.no_arm_trusted = True
194 build_artifacts.GypNinjaBuild( 201 build_artifacts.GypNinjaBuild(
195 'arm', 'gyp.py', 'foo.gyp', 'target', 'out_dir') 202 'arm', 'gyp.py', 'foo.gyp', 'target', 'out_dir')
196 self.run_mock.assert_has_calls([ 203 self.run_mock.assert_has_calls([
197 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 204 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
198 'output_dir=out_dir'], 205 'output_dir=out_dir'],
199 cwd='src_dir', 206 cwd='src_dir',
200 env={ 207 env={
201 'GYP_CROSSCOMPILE': '1', 208 'GYP_CROSSCOMPILE': '1',
202 'GYP_GENERATORS': 'ninja', 209 'GYP_GENERATORS': 'ninja',
203 'GYP_DEFINES': 'target_arch=arm arm_float_abi=hard ' 210 'GYP_DEFINES': ' '.join(self.gyp_defines_base +
204 'disable_cross_trusted=1', 211 ['target_arch=arm',
212 'arm_float_abi=hard',
213 'disable_cross_trusted=1']),
205 }), 214 }),
206 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 215 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
207 ]) 216 ])
208 217
209 218
210 class ArchivePosixTestCase(BasePosixTestCase): 219 class ArchivePosixTestCase(BasePosixTestCase):
211 def setUp(self): 220 def setUp(self):
212 BasePosixTestCase.setUp(self) 221 BasePosixTestCase.setUp(self)
213 self.makedir_mock = patch('buildbot_common.MakeDir').start() 222 self.makedir_mock = patch('buildbot_common.MakeDir').start()
214 self.copyfile_mock = patch('buildbot_common.CopyFile').start() 223 self.copyfile_mock = patch('buildbot_common.CopyFile').start()
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 archive = build_artifacts.Archive('foo') 297 archive = build_artifacts.Archive('foo')
289 self.assertEqual(archive.name, 'win_foo') 298 self.assertEqual(archive.name, 'win_foo')
290 self.assertEqual(archive.archive_name, 'win_foo.tar.bz2') 299 self.assertEqual(archive.archive_name, 'win_foo.tar.bz2')
291 self.assertEqual(archive.archive_path, r'c:\archive_dir\win_foo.tar.bz2') 300 self.assertEqual(archive.archive_path, r'c:\archive_dir\win_foo.tar.bz2')
292 self.assertEqual(archive.dirname, r'c:\archive_dir\win_foo') 301 self.assertEqual(archive.dirname, r'c:\archive_dir\win_foo')
293 makedir_mock.assert_called_once_with(r'c:\archive_dir\win_foo') 302 makedir_mock.assert_called_once_with(r'c:\archive_dir\win_foo')
294 303
295 304
296 if __name__ == '__main__': 305 if __name__ == '__main__':
297 unittest.main() 306 unittest.main()
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/build_sdk.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698