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

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

Issue 1684883002: [NaCl SDK] Remove old/unused gyp defines (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@irt_with_clang
Patch Set: Created 4 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 class GypNinjaPosixTestCase(BasePosixTestCase): 99 class GypNinjaPosixTestCase(BasePosixTestCase):
100 def setUp(self): 100 def setUp(self):
101 BasePosixTestCase.setUp(self) 101 BasePosixTestCase.setUp(self)
102 patch('sys.executable', 'python').start() 102 patch('sys.executable', 'python').start()
103 patch('build_artifacts.SRC_DIR', 'src_dir').start() 103 patch('build_artifacts.SRC_DIR', 'src_dir').start()
104 patch('os.environ', {}).start() 104 patch('os.environ', {}).start()
105 self.run_mock = patch('buildbot_common.Run').start() 105 self.run_mock = patch('buildbot_common.Run').start()
106 self.options_mock = patch('build_artifacts.options').start() 106 self.options_mock = patch('build_artifacts.options').start()
107 self.options_mock.mac_sdk = False 107 self.options_mock.mac_sdk = False
108 self.options_mock.no_arm_trusted = False 108 self.options_mock.no_arm_trusted = False
109 self.gyp_defines_base = ['nacl_allow_thin_archives=0'] 109 self.gyp_defines_base = []
110 110
111 def testSimple(self): 111 def testSimple(self):
112 build_artifacts.GypNinjaBuild( 112 build_artifacts.GypNinjaBuild(
113 None, 'gyp.py', 'foo.gyp', 'target', 'out_dir') 113 None, 'gyp.py', 'foo.gyp', 'target', 'out_dir')
114 self.run_mock.assert_has_calls([ 114 self.run_mock.assert_has_calls([
115 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 115 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
116 'output_dir=out_dir'], 116 'output_dir=out_dir'],
117 cwd='src_dir', 117 cwd='src_dir',
118 env={'GYP_GENERATORS': 'ninja', 118 env={'GYP_DEFINES': ' '.join(self.gyp_defines_base)}),
119 'GYP_DEFINES': ' '.join(self.gyp_defines_base)}),
120 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 119 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
121 ]) 120 ])
122 121
123 def testTargetArch(self): 122 def testTargetArch(self):
124 build_artifacts.GypNinjaBuild( 123 build_artifacts.GypNinjaBuild(
125 'x64', 'gyp.py', 'foo.gyp', 'target', 'out_dir') 124 'x64', 'gyp.py', 'foo.gyp', 'target', 'out_dir')
126 self.run_mock.assert_has_calls([ 125 self.run_mock.assert_has_calls([
127 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 126 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
128 'output_dir=out_dir'], 127 'output_dir=out_dir'],
129 cwd='src_dir', 128 cwd='src_dir',
130 env={ 129 env={
131 'GYP_GENERATORS': 'ninja',
132 'GYP_DEFINES': ' '.join(self.gyp_defines_base + 130 'GYP_DEFINES': ' '.join(self.gyp_defines_base +
133 ['target_arch=x64']), 131 ['target_arch=x64']),
134 }), 132 }),
135 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 133 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
136 ]) 134 ])
137 135
138 def testMultipleTargets(self): 136 def testMultipleTargets(self):
139 build_artifacts.GypNinjaBuild( 137 build_artifacts.GypNinjaBuild(
140 None, 'gyp.py', 'foo.gyp', ['target1', 'target2'], 'out_dir') 138 None, 'gyp.py', 'foo.gyp', ['target1', 'target2'], 'out_dir')
141 self.run_mock.assert_has_calls([ 139 self.run_mock.assert_has_calls([
142 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 140 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
143 'output_dir=out_dir'], 141 'output_dir=out_dir'],
144 cwd='src_dir', 142 cwd='src_dir',
145 env={'GYP_GENERATORS': 'ninja', 143 env={'GYP_DEFINES': ' '.join(self.gyp_defines_base)}),
146 'GYP_DEFINES': ' '.join(self.gyp_defines_base)}),
147 call(['ninja', '-C', 'out_dir/Release', 'target1', 'target2'], 144 call(['ninja', '-C', 'out_dir/Release', 'target1', 'target2'],
148 cwd='src_dir') 145 cwd='src_dir')
149 ]) 146 ])
150 147
151 def testMacSdk(self): 148 def testMacSdk(self):
152 build_artifacts.PLATFORM = 'mac' 149 build_artifacts.PLATFORM = 'mac'
153 self.options_mock.mac_sdk = '10.6' 150 self.options_mock.mac_sdk = '10.6'
154 build_artifacts.GypNinjaBuild( 151 build_artifacts.GypNinjaBuild(
155 None, 'gyp.py', 'foo.gyp', 'target', 'out_dir') 152 None, 'gyp.py', 'foo.gyp', 'target', 'out_dir')
156 self.run_mock.assert_has_calls([ 153 self.run_mock.assert_has_calls([
157 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 154 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
158 'output_dir=out_dir'], 155 'output_dir=out_dir'],
159 cwd='src_dir', 156 cwd='src_dir',
160 env={ 157 env={
161 'GYP_GENERATORS': 'ninja',
162 'GYP_DEFINES': ' '.join(self.gyp_defines_base + 158 'GYP_DEFINES': ' '.join(self.gyp_defines_base +
163 ['mac_sdk=10.6', 'clang=1']), 159 ['mac_sdk=10.6']),
164 }), 160 }),
165 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 161 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
166 ]) 162 ])
167 163
168 def testArmLinux(self): 164 def testArmLinux(self):
169 build_artifacts.PLATFORM = 'linux' 165 build_artifacts.PLATFORM = 'linux'
170 build_artifacts.GypNinjaBuild( 166 build_artifacts.GypNinjaBuild(
171 'arm', 'gyp.py', 'foo.gyp', 'target', 'out_dir') 167 'arm', 'gyp.py', 'foo.gyp', 'target', 'out_dir')
172 self.run_mock.assert_has_calls([ 168 self.run_mock.assert_has_calls([
173 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 169 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
174 'output_dir=out_dir'], 170 'output_dir=out_dir'],
175 cwd='src_dir', 171 cwd='src_dir',
176 env={ 172 env={
177 'GYP_CROSSCOMPILE': '1', 173 'GYP_CROSSCOMPILE': '1',
178 'GYP_GENERATORS': 'ninja',
179 'GYP_DEFINES': ' '.join(self.gyp_defines_base + 174 'GYP_DEFINES': ' '.join(self.gyp_defines_base +
180 ['target_arch=arm']), 175 ['target_arch=arm']),
181 }), 176 }),
182 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 177 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
183 ]) 178 ])
184 179
185 def testNoArmTrusted(self): 180 def testNoArmTrusted(self):
186 build_artifacts.PLATFORM = 'linux' 181 build_artifacts.PLATFORM = 'linux'
187 self.options_mock.no_arm_trusted = True 182 self.options_mock.no_arm_trusted = True
188 build_artifacts.GypNinjaBuild( 183 build_artifacts.GypNinjaBuild(
189 'arm', 'gyp.py', 'foo.gyp', 'target', 'out_dir') 184 'arm', 'gyp.py', 'foo.gyp', 'target', 'out_dir')
190 self.run_mock.assert_has_calls([ 185 self.run_mock.assert_has_calls([
191 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G', 186 call(['python', 'gyp.py', 'foo.gyp', '--depth=.', '-G',
192 'output_dir=out_dir'], 187 'output_dir=out_dir'],
193 cwd='src_dir', 188 cwd='src_dir',
194 env={ 189 env={
195 'GYP_CROSSCOMPILE': '1', 190 'GYP_CROSSCOMPILE': '1',
196 'GYP_GENERATORS': 'ninja',
197 'GYP_DEFINES': ' '.join(self.gyp_defines_base + 191 'GYP_DEFINES': ' '.join(self.gyp_defines_base +
198 ['target_arch=arm', 192 ['target_arch=arm',
199 'disable_cross_trusted=1']), 193 'disable_cross_trusted=1']),
200 }), 194 }),
201 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir') 195 call(['ninja', '-C', 'out_dir/Release', 'target'], cwd='src_dir')
202 ]) 196 ])
203 197
204 198
205 class ArchivePosixTestCase(BasePosixTestCase): 199 class ArchivePosixTestCase(BasePosixTestCase):
206 def setUp(self): 200 def setUp(self):
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 archive = build_artifacts.Archive('foo') 277 archive = build_artifacts.Archive('foo')
284 self.assertEqual(archive.name, 'win_foo') 278 self.assertEqual(archive.name, 'win_foo')
285 self.assertEqual(archive.archive_name, 'win_foo.tar.bz2') 279 self.assertEqual(archive.archive_name, 'win_foo.tar.bz2')
286 self.assertEqual(archive.archive_path, r'c:\archive_dir\win_foo.tar.bz2') 280 self.assertEqual(archive.archive_path, r'c:\archive_dir\win_foo.tar.bz2')
287 self.assertEqual(archive.dirname, r'c:\archive_dir\win_foo') 281 self.assertEqual(archive.dirname, r'c:\archive_dir\win_foo')
288 makedir_mock.assert_called_once_with(r'c:\archive_dir\win_foo') 282 makedir_mock.assert_called_once_with(r'c:\archive_dir\win_foo')
289 283
290 284
291 if __name__ == '__main__': 285 if __name__ == '__main__':
292 unittest.main() 286 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