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

Side by Side Diff: scripts/slave/recipe_modules/chromium_android/api.py

Issue 2246443002: Do not assume that perf tests always have end_time (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import contextlib 5 import contextlib
6 import datetime 6 import datetime
7 import json 7 import json
8 import os 8 import os
9 import re 9 import re
10 import sys 10 import sys
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 enable_platform_mode=enable_platform_mode, **kwargs) 733 enable_platform_mode=enable_platform_mode, **kwargs)
734 734
735 # now obtain the list of tests that were executed. 735 # now obtain the list of tests that were executed.
736 result = self.test_runner( 736 result = self.test_runner(
737 'get perf test list', 737 'get perf test list',
738 ['perf', '--steps', config, '--output-json-list', self.m.json.output(), 738 ['perf', '--steps', config, '--output-json-list', self.m.json.output(),
739 '--blacklist-file', self.blacklist_file], 739 '--blacklist-file', self.blacklist_file],
740 step_test_data=lambda: self.m.json.test_api.output([ 740 step_test_data=lambda: self.m.json.test_api.output([
741 {'test': 'perf_test.foo', 'device_affinity': 0, 741 {'test': 'perf_test.foo', 'device_affinity': 0,
742 'end_time': 1443438432.949711, 'has_archive': True}, 742 'end_time': 1443438432.949711, 'has_archive': True},
743 {'test': 'page_cycler.foo', 'device_affinity': 0, 743 {'test': 'page_cycler.foo', 'device_affinity': 0}]),
744 'end_time': 1470050195.193213}]),
745 env=self.m.chromium.get_env() 744 env=self.m.chromium.get_env()
746 ) 745 )
747 perf_tests = result.json.output 746 perf_tests = result.json.output
748 747
749 if perf_tests and isinstance(perf_tests[0], dict): 748 if perf_tests and isinstance(perf_tests[0], dict):
750 perf_tests = sorted(perf_tests, 749 perf_tests = sorted(perf_tests,
751 key=lambda x: (x['device_affinity'], x['test'])) 750 key=lambda x: (x['device_affinity'], x['test']))
752 else: 751 else:
753 perf_tests = [{'test': v} for v in perf_tests] 752 perf_tests = [{'test': v} for v in perf_tests]
754 753
755 failures = [] 754 failures = []
756 for test_data in perf_tests: 755 for test_data in perf_tests:
757 test_name = str(test_data['test']) # un-unicode 756 test_name = str(test_data['test']) # un-unicode
758 test_type = test_type_transform(test_name) 757 test_type = test_type_transform(test_name)
759 annotate = self.m.chromium.get_annotate_by_test_name(test_name) 758 annotate = self.m.chromium.get_annotate_by_test_name(test_name)
760 point_id = int(test_data['end_time']) if timestamp_as_point_id else None 759 test_end_time = int(test_data.get('end_time', 0))
760 if not test_end_time:
761 test_end_time = int(self.m.time.time())
762 point_id = test_end_time if timestamp_as_point_id else None
761 763
762 if upload_archives_to_bucket and test_data.get('has_archive'): 764 if upload_archives_to_bucket and test_data.get('has_archive'):
763 archive = self.m.path.mkdtemp('perf_archives').join('output_dir.zip') 765 archive = self.m.path.mkdtemp('perf_archives').join('output_dir.zip')
764 else: 766 else:
765 archive = None 767 archive = None
766 print_step_cmd = ['perf', '--print-step', test_name, '--verbose', 768 print_step_cmd = ['perf', '--print-step', test_name, '--verbose',
767 '--adb-path', self.m.adb.adb_path(), 769 '--adb-path', self.m.adb.adb_path(),
768 '--blacklist-file', self.blacklist_file] 770 '--blacklist-file', self.blacklist_file]
769 if archive: 771 if archive:
770 print_step_cmd.extend(['--get-output-dir-archive', archive]) 772 print_step_cmd.extend(['--get-output-dir-archive', archive])
(...skipping 22 matching lines...) Expand all
793 if 'device_affinity' in test_data: 795 if 'device_affinity' in test_data:
794 step_result = self.m.step.active_result 796 step_result = self.m.step.active_result
795 step_result.presentation.step_text += ( 797 step_result.presentation.step_text += (
796 self.m.test_utils.format_step_text( 798 self.m.test_utils.format_step_text(
797 [['Device Affinity: %s' % test_data['device_affinity']]])) 799 [['Device Affinity: %s' % test_data['device_affinity']]]))
798 800
799 if archive: 801 if archive:
800 dest = '{builder}/{test}/{timestamp}_build_{buildno}.zip'.format( 802 dest = '{builder}/{test}/{timestamp}_build_{buildno}.zip'.format(
801 builder=self.m.properties['buildername'], 803 builder=self.m.properties['buildername'],
802 test=test_name, 804 test=test_name,
803 timestamp=_TimestampToIsoFormat(test_data['end_time']), 805 timestamp=_TimestampToIsoFormat(test_end_time),
804 buildno=self.m.properties['buildnumber']) 806 buildno=self.m.properties['buildnumber'])
805 self.m.gsutil.upload( 807 self.m.gsutil.upload(
806 name='upload %s output dir archive' % test_name, 808 name='upload %s output dir archive' % test_name,
807 source=archive, 809 source=archive,
808 bucket=upload_archives_to_bucket, 810 bucket=upload_archives_to_bucket,
809 dest=dest, 811 dest=dest,
810 link_name='output_dir.zip') 812 link_name='output_dir.zip')
811 813
812 if failures: 814 if failures:
813 raise self.m.step.StepFailure('sharded perf tests failed %s' % failures) 815 raise self.m.step.StepFailure('sharded perf tests failed %s' % failures)
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 script = self.c.test_runner 1471 script = self.c.test_runner
1470 if wrapper_script_suite_name: 1472 if wrapper_script_suite_name:
1471 script = self.m.chromium.output_dir.join('bin', 'run_%s' % 1473 script = self.m.chromium.output_dir.join('bin', 'run_%s' %
1472 wrapper_script_suite_name) 1474 wrapper_script_suite_name)
1473 else: 1475 else:
1474 env = kwargs.get('env', {}) 1476 env = kwargs.get('env', {})
1475 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR', 1477 env['CHROMIUM_OUTPUT_DIR'] = env.get('CHROMIUM_OUTPUT_DIR',
1476 self.m.chromium.output_dir) 1478 self.m.chromium.output_dir)
1477 kwargs['env'] = env 1479 kwargs['env'] = env
1478 return self.m.python(step_name, script, args, **kwargs) 1480 return self.m.python(step_name, script, args, **kwargs)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698