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

Side by Side Diff: tests/run_isolated_smoke_test.py

Issue 19917006: Move all googletest related scripts into googletest/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Remove unnecessary pylint warning disable Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « tests/run_isolated/regen_test_data.py ('k') | tests/run_test_cases/output.py » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 hashlib 6 import hashlib
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 Returns a list of the required arguments. 133 Returns a list of the required arguments.
134 """ 134 """
135 return [ 135 return [
136 '--hash', sha1_hash, 136 '--hash', sha1_hash,
137 '--cache', self.cache, 137 '--cache', self.cache,
138 '--remote', self.table, 138 '--remote', self.table,
139 ] 139 ]
140 140
141 def test_result(self): 141 def test_result(self):
142 # Loads an arbitrary .isolated on the file system. 142 # Loads an arbitrary .isolated on the file system.
143 isolated = os.path.join(self.data_dir, 'gtest_fake.isolated') 143 isolated = os.path.join(self.data_dir, 'repeated_files.isolated')
144 expected = [ 144 expected = [
145 'state.json', 145 'state.json',
146 self._store('gtest_fake.py'), 146 self._store('file1.txt'),
147 self._store('file1_copy.txt'),
148 self._store('repeated_files.py'),
147 calc_sha1(isolated), 149 calc_sha1(isolated),
148 ] 150 ]
149 out, _, returncode = self._run( 151 out, err, returncode = self._run(
150 self._generate_args_with_isolated(isolated)) 152 self._generate_args_with_isolated(isolated))
151 if not VERBOSE: 153 if not VERBOSE:
152 self.assertEqual(1070, len(out), out) 154 self.assertEqual('Success\n', out, (out, err))
153 self.assertEqual(6, returncode) 155 self.assertEqual(0, returncode)
154 actual = list_files_tree(self.cache) 156 actual = list_files_tree(self.cache)
155 self.assertEqual(sorted(expected), actual) 157 self.assertEqual(sorted(set(expected)), actual)
156 158
157 def test_hash(self): 159 def test_hash(self):
158 # Loads the .isolated from the store as a hash. 160 # Loads the .isolated from the store as a hash.
159 result_sha1 = self._store('gtest_fake.isolated') 161 result_sha1 = self._store('repeated_files.isolated')
160 expected = [ 162 expected = [
161 'state.json', 163 'state.json',
162 self._store('gtest_fake.py'), 164 self._store('file1.txt'),
165 self._store('file1_copy.txt'),
166 self._store('repeated_files.py'),
163 result_sha1, 167 result_sha1,
164 ] 168 ]
165 169
166 out, err, returncode = self._run(self._generate_args_with_sha1(result_sha1)) 170 out, err, returncode = self._run(self._generate_args_with_sha1(result_sha1))
167 if not VERBOSE: 171 if not VERBOSE:
168 self.assertEqual('', err) 172 self.assertEqual('', err)
169 self.assertEqual(1070, len(out), out) 173 self.assertEqual('Success\n', out, out)
170 self.assertEqual(6, returncode) 174 self.assertEqual(0, returncode)
171 actual = list_files_tree(self.cache) 175 actual = list_files_tree(self.cache)
172 self.assertEqual(sorted(expected), actual) 176 self.assertEqual(sorted(set(expected)), actual)
173 177
174 def test_download_isolated(self): 178 def test_download_isolated(self):
175 out_dir = None 179 out_dir = None
176 try: 180 try:
177 out_dir = tempfile.mkdtemp() 181 out_dir = tempfile.mkdtemp()
178 182
179 # Store the required files. 183 # Store the required files.
180 self._store('file1.txt') 184 self._store('file1.txt')
181 self._store('repeated_files.py') 185 self._store('repeated_files.py')
182 186
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if not VERBOSE: 229 if not VERBOSE:
226 self.assertEqual('', out) 230 self.assertEqual('', out)
227 self.assertEqual('No command to run\n', err) 231 self.assertEqual('No command to run\n', err)
228 self.assertEqual(1, returncode) 232 self.assertEqual(1, returncode)
229 actual = list_files_tree(self.cache) 233 actual = list_files_tree(self.cache)
230 self.assertEqual(sorted(expected), actual) 234 self.assertEqual(sorted(expected), actual)
231 235
232 def test_includes(self): 236 def test_includes(self):
233 # Loads an .isolated that includes another one. 237 # Loads an .isolated that includes another one.
234 238
235 # References manifest1.isolated and gtest_fake.isolated. Maps file3.txt as 239 # References manifest2.isolated and repeated_files.isolated. Maps file3.txt
236 # file2.txt. 240 # as file2.txt.
237 result_sha1 = self._store('check_files.isolated') 241 result_sha1 = self._store('check_files.isolated')
238 expected = [ 242 expected = [
239 'state.json', 243 'state.json',
240 self._store('check_files.py'), 244 self._store('check_files.py'),
241 self._store('gtest_fake.py'),
242 self._store('gtest_fake.isolated'),
243 self._store('file1.txt'), 245 self._store('file1.txt'),
244 self._store('file3.txt'), 246 self._store('file3.txt'),
245 # Maps file1.txt. 247 # Maps file1.txt.
246 self._store('manifest1.isolated'), 248 self._store('manifest1.isolated'),
247 # References manifest1.isolated. Maps file2.txt but it is overriden. 249 # References manifest1.isolated. Maps file2.txt but it is overriden.
248 self._store('manifest2.isolated'), 250 self._store('manifest2.isolated'),
249 result_sha1, 251 result_sha1,
252 self._store('repeated_files.py'),
253 self._store('repeated_files.isolated'),
250 ] 254 ]
251 out, err, returncode = self._run(self._generate_args_with_sha1(result_sha1)) 255 out, err, returncode = self._run(self._generate_args_with_sha1(result_sha1))
252 if not VERBOSE: 256 if not VERBOSE:
253 self.assertEqual('', err) 257 self.assertEqual('', err)
254 self.assertEqual('Success\n', out) 258 self.assertEqual('Success\n', out)
255 self.assertEqual(0, returncode) 259 self.assertEqual(0, returncode)
256 actual = list_files_tree(self.cache) 260 actual = list_files_tree(self.cache)
257 self.assertEqual(sorted(expected), actual) 261 self.assertEqual(sorted(expected), actual)
258 262
259 def test_link_all_hash_instances(self): 263 def test_link_all_hash_instances(self):
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 self.assertEqual(0, returncode) 310 self.assertEqual(0, returncode)
307 311
308 self.assertEqual(os.stat(os.path.join(self.data_dir, 'file1.txt')).st_size, 312 self.assertEqual(os.stat(os.path.join(self.data_dir, 'file1.txt')).st_size,
309 os.stat(cached_file_path).st_size) 313 os.stat(cached_file_path).st_size)
310 314
311 315
312 if __name__ == '__main__': 316 if __name__ == '__main__':
313 VERBOSE = '-v' in sys.argv 317 VERBOSE = '-v' in sys.argv
314 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 318 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
315 unittest.main() 319 unittest.main()
OLDNEW
« no previous file with comments | « tests/run_isolated/regen_test_data.py ('k') | tests/run_test_cases/output.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698