OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 import json | 6 import json |
7 import os | 7 import os |
8 import re | 8 import re |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 def _writefile(self, filename, contents): | 333 def _writefile(self, filename, contents): |
334 """Convenience function for writing files.""" | 334 """Convenience function for writing files.""" |
335 return self.m.file.write('write %s' % self.m.path.basename(filename), | 335 return self.m.file.write('write %s' % self.m.path.basename(filename), |
336 filename, contents, infra_step=True) | 336 filename, contents, infra_step=True) |
337 | 337 |
338 def rmtree(self, path): | 338 def rmtree(self, path): |
339 """Wrapper around api.file.rmtree with environment fix.""" | 339 """Wrapper around api.file.rmtree with environment fix.""" |
340 env = {} | 340 env = {} |
341 if self.running_in_swarming: | 341 if self.running_in_swarming: |
342 env['PYTHONPATH'] = str(self.skia_dir.join('infra', 'bots', 'build', | 342 env['PYTHONPATH'] = str(self.m.path.join('build', 'scripts')) |
343 'scripts')) | |
344 self.m.file.rmtree(self.m.path.basename(path), | 343 self.m.file.rmtree(self.m.path.basename(path), |
345 path, | 344 path, |
346 env=env, | 345 env=env, |
347 infra_step=True) | 346 infra_step=True) |
348 | 347 |
349 def run(self, steptype, name, abort_on_failure=True, | 348 def run(self, steptype, name, abort_on_failure=True, |
350 fail_build_on_failure=True, env=None, **kwargs): | 349 fail_build_on_failure=True, env=None, **kwargs): |
351 """Run a step. If it fails, keep going but mark the build status failed.""" | 350 """Run a step. If it fails, keep going but mark the build status failed.""" |
352 env = dict(env or {}) | 351 env = dict(env or {}) |
353 env.update(self.default_env) | 352 env.update(self.default_env) |
(...skipping 13 matching lines...) Expand all Loading... |
367 source=source, | 366 source=source, |
368 bucket=bucket, | 367 bucket=bucket, |
369 dest=dest, | 368 dest=dest, |
370 args=['-R'], | 369 args=['-R'], |
371 env=self.gsutil_env_skia_infra, | 370 env=self.gsutil_env_skia_infra, |
372 abort_on_failure=False) | 371 abort_on_failure=False) |
373 | 372 |
374 def _download_and_copy_dir(self, version_file, gs_path_tmpl, host_path, | 373 def _download_and_copy_dir(self, version_file, gs_path_tmpl, host_path, |
375 device_path, test_expected_version, | 374 device_path, test_expected_version, |
376 test_actual_version): | 375 test_actual_version): |
| 376 actual_version_file = self.m.path.join(self.tmp_dir, version_file) |
377 # If we're running as a Swarming task, we should've received the test inputs | 377 # If we're running as a Swarming task, we should've received the test inputs |
378 # via the isolate server. Only download if we're not running in Swarming. | 378 # via the isolate server. Only download if we're not running in Swarming. |
379 if self.running_in_swarming: | 379 if not self.running_in_swarming: |
380 actual_version_file = self.m.path.join(host_path, version_file) | |
381 else: | |
382 # Ensure that the tmp_dir exists. | 380 # Ensure that the tmp_dir exists. |
383 self._run_once(self.m.file.makedirs, | 381 self._run_once(self.m.file.makedirs, |
384 'tmp_dir', | 382 'tmp_dir', |
385 self.tmp_dir, | 383 self.tmp_dir, |
386 infra_step=True) | 384 infra_step=True) |
387 actual_version_file = self.m.path.join(self.tmp_dir, version_file) | |
388 | 385 |
389 # Find the actually-downloaded version. | 386 # Find the actually-downloaded version. |
390 try: | 387 try: |
391 actual_version = self._readfile(actual_version_file, | 388 actual_version = self._readfile(actual_version_file, |
392 name='Get downloaded %s' % version_file, | 389 name='Get downloaded %s' % version_file, |
393 test_data=test_actual_version).rstrip() | 390 test_data=test_actual_version).rstrip() |
394 except self.m.step.StepFailure: | 391 except self.m.step.StepFailure: |
395 if self.running_in_swarming: | 392 if self.running_in_swarming: |
396 raise # pragma: no cover | 393 raise # pragma: no cover |
397 actual_version = VERSION_NONE | 394 actual_version = VERSION_NONE |
(...skipping 18 matching lines...) Expand all Loading... |
416 global_constants.GS_GM_BUCKET, | 413 global_constants.GS_GM_BUCKET, |
417 (gs_path_tmpl % expected_version) + '/*', | 414 (gs_path_tmpl % expected_version) + '/*', |
418 host_path, | 415 host_path, |
419 name='download %s' % self.m.path.basename(host_path), | 416 name='download %s' % self.m.path.basename(host_path), |
420 args=['-R'], | 417 args=['-R'], |
421 env=self.gsutil_env_chromium_skia_gm) | 418 env=self.gsutil_env_chromium_skia_gm) |
422 self._writefile(actual_version_file, expected_version) | 419 self._writefile(actual_version_file, expected_version) |
423 actual_version = expected_version | 420 actual_version = expected_version |
424 | 421 |
425 # Copy to device. | 422 # Copy to device. |
426 if self.running_in_swarming: | 423 device_version_file = self.flavor.device_path_join( |
427 device_version_file = self.flavor.device_path_join( | 424 self.device_dirs.tmp_dir, version_file) |
428 device_path, version_file) | |
429 else: | |
430 device_version_file = self.flavor.device_path_join( | |
431 self.device_dirs.tmp_dir, version_file) | |
432 if str(actual_version_file) != str(device_version_file): | 425 if str(actual_version_file) != str(device_version_file): |
433 try: | 426 try: |
434 device_version = self.flavor.read_file_on_device(device_version_file) | 427 device_version = self.flavor.read_file_on_device(device_version_file) |
435 except self.m.step.StepFailure: | 428 except self.m.step.StepFailure: |
436 device_version = VERSION_NONE | 429 device_version = VERSION_NONE |
437 if device_version != actual_version: | 430 if device_version != actual_version: |
438 self.flavor.remove_file_on_device(device_version_file) | 431 self.flavor.remove_file_on_device(device_version_file) |
439 self.flavor.create_clean_device_dir(device_path) | 432 self.flavor.create_clean_device_dir(device_path) |
440 self.flavor.copy_directory_contents_to_device(host_path, device_path) | 433 self.flavor.copy_directory_contents_to_device(host_path, device_path) |
441 | 434 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 # Don't bother to include role, which is always Test. | 790 # Don't bother to include role, which is always Test. |
798 # TryBots are uploaded elsewhere so they can use the same key. | 791 # TryBots are uploaded elsewhere so they can use the same key. |
799 blacklist = ['role', 'is_trybot'] | 792 blacklist = ['role', 'is_trybot'] |
800 | 793 |
801 flat = [] | 794 flat = [] |
802 for k in sorted(self.builder_cfg.keys()): | 795 for k in sorted(self.builder_cfg.keys()): |
803 if k not in blacklist: | 796 if k not in blacklist: |
804 flat.append(k) | 797 flat.append(k) |
805 flat.append(self.builder_cfg[k]) | 798 flat.append(self.builder_cfg[k]) |
806 return flat | 799 return flat |
OLD | NEW |