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

Side by Side Diff: scripts/slave/runtest.py

Issue 545803002: Update buildbots to parse new telemetry JSON format. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Switched to having telemetry output json to files. Created 6 years, 3 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 #!/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 """A tool used to run a Chrome test executable and process the output. 6 """A tool used to run a Chrome test executable and process the output.
7 7
8 This script is used by the buildbot slaves. It must be run from the outer 8 This script is used by the buildbot slaves. It must be run from the outer
9 build directory, e.g. chrome-release/build/. 9 build directory, e.g. chrome-release/build/.
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 # TODO(crbug.com/403564). We almost certainly shouldn't be importing this. 47 # TODO(crbug.com/403564). We almost certainly shouldn't be importing this.
48 import config 48 import config
49 49
50 from slave import annotation_utils 50 from slave import annotation_utils
51 from slave import build_directory 51 from slave import build_directory
52 from slave import crash_utils 52 from slave import crash_utils
53 from slave import gtest_slave_utils 53 from slave import gtest_slave_utils
54 from slave import process_log_utils 54 from slave import process_log_utils
55 from slave import results_dashboard 55 from slave import results_dashboard
56 from slave import slave_utils 56 from slave import slave_utils
57 from slave import telemetry_utils
57 from slave import xvfb 58 from slave import xvfb
58 59
59 USAGE = '%s [options] test.exe [test args]' % os.path.basename(sys.argv[0]) 60 USAGE = '%s [options] test.exe [test args]' % os.path.basename(sys.argv[0])
60 61
61 CHROME_SANDBOX_PATH = '/opt/chromium/chrome_sandbox' 62 CHROME_SANDBOX_PATH = '/opt/chromium/chrome_sandbox'
62 63
63 # Directory to write JSON for test results into. 64 # Directory to write JSON for test results into.
64 DEST_DIR = 'gtest_results' 65 DEST_DIR = 'gtest_results'
65 66
66 # Names of httpd configuration file under different platforms. 67 # Names of httpd configuration file under different platforms.
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 shouldlist = selection and selection == 'list' 547 shouldlist = selection and selection == 'list'
547 if shouldlist: 548 if shouldlist:
548 print 549 print
549 print 'Available log parsers:' 550 print 'Available log parsers:'
550 for p in parsers: 551 for p in parsers:
551 print ' ', p, parsers[p].__name__ 552 print ' ', p, parsers[p].__name__
552 553
553 return shouldlist 554 return shouldlist
554 555
555 556
556 def _SelectResultsTracker(options): 557 def _SelectResultsTracker(options, test_exe):
557 """Returns a log parser class (aka results tracker class). 558 """Returns a log parser class (aka results tracker class).
558 559
559 Args: 560 Args:
560 options: Command-line options (from OptionParser). 561 options: Command-line options (from OptionParser).
562 test_exe: Name of the test to execute
561 563
562 Returns: 564 Returns:
563 A log parser class (aka results tracker class), or None. 565 A log parser class (aka results tracker class), or None.
564 """ 566 """
565 if _UsingGtestJson(options): 567 if _UsingGtestJson(options):
566 return gtest_utils.GTestJSONParser 568 return gtest_utils.GTestJSONParser
567 569
570 if test_exe and test_exe.endswith('telemetry.py'):
571 return telemetry_utils.TelemetryResultsTracker
572
568 parsers = _GetParsers() 573 parsers = _GetParsers()
569 if options.annotate: 574 if options.annotate:
570 if options.annotate in parsers: 575 if options.annotate in parsers:
571 if options.generate_json_file and options.annotate != 'gtest': 576 if options.generate_json_file and options.annotate != 'gtest':
572 raise NotImplementedError('"%s" doesn\'t make sense with ' 577 raise NotImplementedError('"%s" doesn\'t make sense with '
573 'options.generate_json_file.') 578 'options.generate_json_file.')
574 else: 579 else:
575 return parsers[options.annotate] 580 return parsers[options.annotate]
576 else: 581 else:
577 raise KeyError('"%s" is not a valid GTest parser!' % options.annotate) 582 raise KeyError('"%s" is not a valid GTest parser!' % options.annotate)
578 elif options.generate_json_file: 583 elif options.generate_json_file:
579 return parsers['gtest'] 584 return parsers['gtest']
580 585
581 return None 586 return None
582 587
583 588
584 def _GetCommitPos(build_properties): 589 def _GetCommitPos(build_properties):
585 """Extract the commit position from the build properties, if its there.""" 590 """Extract the commit position from the build properties, if its there."""
586 if 'got_revision_cp' not in build_properties: 591 if 'got_revision_cp' not in build_properties:
587 return None 592 return None
588 commit_pos = build_properties['got_revision_cp'] 593 commit_pos = build_properties['got_revision_cp']
589 return int(re.search(r'{#(\d+)}', commit_pos).group(1)) 594 return int(re.search(r'{#(\d+)}', commit_pos).group(1))
590 595
591 596
597 def _GetMainRevision(options):
598 build_dir = os.path.abspath(options.build_dir)
599 commit_pos_num = _GetCommitPos(options.build_properties)
600 if commit_pos_num is not None:
601 revision = commit_pos_num
602 elif options.revision:
603 revision = options.revision
604 else:
605 revision = _GetRevision(os.path.dirname(build_dir))
606 return revision
607
608
609 def _GetBlinkRevision(options):
610 build_dir = os.path.abspath(options.build_dir)
611
612 if options.webkit_revision:
613 webkit_revision = options.webkit_revision
614 else:
615 try:
616 webkit_dir = chromium_utils.FindUpward(
617 build_dir, 'third_party', 'WebKit', 'Source')
618 webkit_revision = _GetRevision(webkit_dir)
619 except Exception:
620 webkit_revision = None
621 return webkit_revision
622
623
624 def _GetTelemetryRevisions(options):
625 """Fills in the same revisions fields that process_log_utils does."""
626
627 versions = {}
628 versions['rev'] = _GetMainRevision(options)
629 versions['webkit_rev'] = _GetBlinkRevision(options)
630 versions['webrtc_rev'] = options.build_properties.get('got_webrtc_revision')
631 versions['v8_rev'] = options.build_properties.get('got_v8_revision')
632 versions['ver'] = options.build_properties.get('version')
633 versions['git_revision'] = options.build_properties.get('git_revision')
634 return versions
635
636
592 def _CreateResultsTracker(tracker_class, options): 637 def _CreateResultsTracker(tracker_class, options):
593 """Instantiate a log parser (aka results tracker). 638 """Instantiate a log parser (aka results tracker).
594 639
595 Args: 640 Args:
596 tracker_class: A log parser class. 641 tracker_class: A log parser class.
597 options: Command-line options (from OptionParser). 642 options: Command-line options (from OptionParser).
598 643
599 Returns: 644 Returns:
600 An instance of a log parser class, or None. 645 An instance of a log parser class, or None.
601 """ 646 """
602 if not tracker_class: 647 if not tracker_class:
603 return None 648 return None
604 649
605 if tracker_class.__name__ in ('GTestLogParser',): 650 if tracker_class.__name__ in ('GTestLogParser', 'TelemetryResultsTracker'):
606 tracker_obj = tracker_class() 651 tracker_obj = tracker_class()
607 elif tracker_class.__name__ in ('GTestJSONParser',): 652 elif tracker_class.__name__ in ('GTestJSONParser',):
608 tracker_obj = tracker_class(options.build_properties.get('mastername')) 653 tracker_obj = tracker_class(options.build_properties.get('mastername'))
609 else: 654 else:
610 build_dir = os.path.abspath(options.build_dir) 655 webkit_revision = _GetBlinkRevision(options) or 'undefined'
611 656 revision = _GetMainRevision(options) or 'undefined'
612 if options.webkit_revision:
613 webkit_revision = options.webkit_revision
614 else:
615 try:
616 webkit_dir = chromium_utils.FindUpward(
617 build_dir, 'third_party', 'WebKit', 'Source')
618 webkit_revision = _GetRevision(webkit_dir)
619 except Exception:
620 webkit_revision = 'undefined'
621
622 commit_pos_num = _GetCommitPos(options.build_properties)
623 if commit_pos_num is not None:
624 revision = commit_pos_num
625 elif options.revision:
626 revision = options.revision
627 else:
628 revision = _GetRevision(os.path.dirname(build_dir))
629 657
630 tracker_obj = tracker_class( 658 tracker_obj = tracker_class(
631 revision=revision, 659 revision=revision,
632 build_properties=options.build_properties, 660 build_properties=options.build_properties,
633 factory_properties=options.factory_properties, 661 factory_properties=options.factory_properties,
634 webkit_revision=webkit_revision) 662 webkit_revision=webkit_revision)
635 663
636 if options.annotate and options.generate_json_file: 664 if options.annotate and options.generate_json_file:
637 tracker_obj.ProcessLine(_GetMasterString(_GetMaster())) 665 tracker_obj.ProcessLine(_GetMasterString(_GetMaster()))
638 666
(...skipping 14 matching lines...) Expand all
653 supplemental_columns = {} 681 supplemental_columns = {}
654 supplemental_columns_file = os.path.join(build_dir, 682 supplemental_columns_file = os.path.join(build_dir,
655 results_dashboard.CACHE_DIR, 683 results_dashboard.CACHE_DIR,
656 supplemental_colummns_file_name) 684 supplemental_colummns_file_name)
657 if os.path.exists(supplemental_columns_file): 685 if os.path.exists(supplemental_columns_file):
658 with file(supplemental_columns_file, 'r') as f: 686 with file(supplemental_columns_file, 'r') as f:
659 supplemental_columns = json.loads(f.read()) 687 supplemental_columns = json.loads(f.read())
660 return supplemental_columns 688 return supplemental_columns
661 689
662 690
663 def _SendResultsToDashboard(results_tracker, system, test, url, build_dir, 691 def _SendResultsToDashboard(results_tracker, options):
ghost stip (do not use) 2014/09/09 02:20:06 iannucci@ strongly dislikes slinging the options o
sullivan 2014/09/11 00:25:56 Done.
664 mastername, buildername, buildnumber,
665 supplemental_columns_file, extra_columns=None):
666 """Sends results from a results tracker (aka log parser) to the dashboard. 692 """Sends results from a results tracker (aka log parser) to the dashboard.
667 693
668 Args: 694 Args:
669 results_tracker: An instance of a log parser class, which has been used to 695 results_tracker: An instance of a log parser class, which has been used to
670 process the test output, so it contains the test results. 696 process the test output, so it contains the test results.
671 system: A string such as 'linux-release', which comes from perf_id. 697 options: Program arguments.
672 test: Test "suite" name string.
673 url: Dashboard URL.
674 build_dir: Build dir name (used for cache file by results_dashboard).
675 mastername: Buildbot master name, e.g. 'chromium.perf'.
676 WARNING! This is incorrectly called "masterid" in some parts of the
677 dashboard code.
678 buildername: Builder name, e.g. 'Linux QA Perf (1)'
679 buildnumber: Build number (as a string).
680 supplemental_columns_file: Filename for JSON supplemental columns file.
681 extra_columns: A dict of extra values to add to the supplemental columns
682 dict.
683 """ 698 """
699 system = _GetPerfID(options)
700 test = options.test_type
701 url = options.results_url
702 mastername = options.build_properties.get('mastername')
703 buildername = options.build_properties.get('buildername')
704 buildnumber = options.build_properties.get('buildnumber')
705 supplemental_columns_file = options.supplemental_columns_file
706 extra_columns = options.perf_config
707
684 if system is None: 708 if system is None:
685 # perf_id not specified in factory properties. 709 # perf_id not specified in factory properties.
686 print 'Error: No system name (perf_id) specified when sending to dashboard.' 710 print 'Error: No system name (perf_id) specified when sending to dashboard.'
687 return 711 return
712 build_dir = os.path.abspath(options.build_dir)
688 supplemental_columns = _GetSupplementalColumns( 713 supplemental_columns = _GetSupplementalColumns(
689 build_dir, supplemental_columns_file) 714 build_dir, supplemental_columns_file)
690 if extra_columns: 715 if extra_columns:
691 supplemental_columns.update(extra_columns) 716 supplemental_columns.update(extra_columns)
692 717
693 charts = _GetDataFromLogProcessor(results_tracker) 718 if results_tracker.IsChartJson():
694 points = results_dashboard.MakeListOfPoints( 719 results_dashboard.SendChartJsonResults(
695 charts, system, test, mastername, buildername, buildnumber, 720 results_tracker.ChartJson(), results_tracker.RefJson(),
696 supplemental_columns) 721 _GetTelemetryRevisions(options),
697 results_dashboard.SendResults(points, url, build_dir) 722 system, mastername, buildername, buildnumber,
723 supplemental_columns, url, build_dir)
724 else:
725 charts = _GetDataFromLogProcessor(results_tracker)
726 points = results_dashboard.MakeListOfPoints(
727 charts, system, test, mastername, buildername, buildnumber,
728 supplemental_columns)
729 results_dashboard.SendResults(points, url, build_dir)
698 730
699 731
700 def _GetDataFromLogProcessor(log_processor): 732 def _GetDataFromLogProcessor(log_processor):
701 """Returns a mapping of chart names to chart data. 733 """Returns a mapping of chart names to chart data.
702 734
703 Args: 735 Args:
704 log_processor: A log processor (aka results tracker) object. 736 log_processor: A log processor (aka results tracker) object.
705 737
706 Returns: 738 Returns:
707 A dictionary mapping chart name to lists of chart data. 739 A dictionary mapping chart name to lists of chart data.
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 through the specified annotation parser. 987 through the specified annotation parser.
956 """ 988 """
957 if not options.annotate: 989 if not options.annotate:
958 raise chromium_utils.MissingArgument('--parse-input doesn\'t make sense ' 990 raise chromium_utils.MissingArgument('--parse-input doesn\'t make sense '
959 'without --annotate.') 991 'without --annotate.')
960 992
961 # If --annotate=list was passed, list the log parser classes and exit. 993 # If --annotate=list was passed, list the log parser classes and exit.
962 if _ListParsers(options.annotate): 994 if _ListParsers(options.annotate):
963 return 0 995 return 0
964 996
965 tracker_class = _SelectResultsTracker(options) 997 tracker_class = _SelectResultsTracker(options, None)
966 results_tracker = _CreateResultsTracker(tracker_class, options) 998 results_tracker = _CreateResultsTracker(tracker_class, options)
967 999
968 if options.generate_json_file: 1000 if options.generate_json_file:
969 if os.path.exists(options.test_output_xml): 1001 if os.path.exists(options.test_output_xml):
970 # remove the old XML output file. 1002 # remove the old XML output file.
971 os.remove(options.test_output_xml) 1003 os.remove(options.test_output_xml)
972 1004
973 if options.parse_input == '-': 1005 if options.parse_input == '-':
974 f = sys.stdin 1006 f = sys.stdin
975 else: 1007 else:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 command = [sys.executable, test_exe] 1054 command = [sys.executable, test_exe]
1023 else: 1055 else:
1024 command = [test_exe_path] 1056 command = [test_exe_path]
1025 if options.annotate == 'gtest': 1057 if options.annotate == 'gtest':
1026 command.extend(['--brave-new-test-launcher', '--test-launcher-bot-mode']) 1058 command.extend(['--brave-new-test-launcher', '--test-launcher-bot-mode'])
1027 command.extend(args[1:]) 1059 command.extend(args[1:])
1028 1060
1029 # If --annotate=list was passed, list the log parser classes and exit. 1061 # If --annotate=list was passed, list the log parser classes and exit.
1030 if _ListParsers(options.annotate): 1062 if _ListParsers(options.annotate):
1031 return 0 1063 return 0
1032 tracker_class = _SelectResultsTracker(options) 1064 tracker_class = _SelectResultsTracker(options, test_exe)
1033 results_tracker = _CreateResultsTracker(tracker_class, options) 1065 results_tracker = _CreateResultsTracker(tracker_class, options)
1066 if hasattr(results_tracker, 'IsChartJson') and results_tracker.IsChartJson():
1067 command.extend(results_tracker.GetArguments())
1034 1068
1035 if options.generate_json_file: 1069 if options.generate_json_file:
1036 if os.path.exists(options.test_output_xml): 1070 if os.path.exists(options.test_output_xml):
1037 # remove the old XML output file. 1071 # remove the old XML output file.
1038 os.remove(options.test_output_xml) 1072 os.remove(options.test_output_xml)
1039 1073
1040 try: 1074 try:
1041 http_server = None 1075 http_server = None
1042 if options.document_root: 1076 if options.document_root:
1043 http_server = _StartHttpServer('mac', build_dir=build_dir, 1077 http_server = _StartHttpServer('mac', build_dir=build_dir,
(...skipping 28 matching lines...) Expand all
1072 if not _GenerateJSONForTestResults(options, results_tracker): 1106 if not _GenerateJSONForTestResults(options, results_tracker):
1073 return 1 1107 return 1
1074 1108
1075 if options.annotate: 1109 if options.annotate:
1076 annotation_utils.annotate( 1110 annotation_utils.annotate(
1077 options.test_type, result, results_tracker, 1111 options.test_type, result, results_tracker,
1078 options.factory_properties.get('full_test_name'), 1112 options.factory_properties.get('full_test_name'),
1079 perf_dashboard_id=options.perf_dashboard_id) 1113 perf_dashboard_id=options.perf_dashboard_id)
1080 1114
1081 if options.results_url: 1115 if options.results_url:
1082 _SendResultsToDashboard( 1116 _SendResultsToDashboard(results_tracker, options)
1083 results_tracker, _GetPerfID(options),
1084 options.test_type, options.results_url, options.build_dir,
1085 options.build_properties.get('mastername'),
1086 options.build_properties.get('buildername'),
1087 options.build_properties.get('buildnumber'),
1088 options.supplemental_columns_file,
1089 options.perf_config)
1090 1117
1091 return result 1118 return result
1092 1119
1093 1120
1094 def _MainIOS(options, args, extra_env): 1121 def _MainIOS(options, args, extra_env):
1095 """Runs the test on iOS.""" 1122 """Runs the test on iOS."""
1096 if len(args) < 1: 1123 if len(args) < 1:
1097 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) 1124 raise chromium_utils.MissingArgument('Usage: %s' % USAGE)
1098 1125
1099 def kill_simulator(): 1126 def kill_simulator():
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 command = [sys.executable, test_exe] 1302 command = [sys.executable, test_exe]
1276 else: 1303 else:
1277 command = [test_exe_path] 1304 command = [test_exe_path]
1278 if options.annotate == 'gtest': 1305 if options.annotate == 'gtest':
1279 command.extend(['--brave-new-test-launcher', '--test-launcher-bot-mode']) 1306 command.extend(['--brave-new-test-launcher', '--test-launcher-bot-mode'])
1280 command.extend(args[1:]) 1307 command.extend(args[1:])
1281 1308
1282 # If --annotate=list was passed, list the log parser classes and exit. 1309 # If --annotate=list was passed, list the log parser classes and exit.
1283 if _ListParsers(options.annotate): 1310 if _ListParsers(options.annotate):
1284 return 0 1311 return 0
1285 tracker_class = _SelectResultsTracker(options) 1312 tracker_class = _SelectResultsTracker(options, test_exe)
1286 results_tracker = _CreateResultsTracker(tracker_class, options) 1313 results_tracker = _CreateResultsTracker(tracker_class, options)
1314 if hasattr(results_tracker, 'IsChartJson') and results_tracker.IsChartJson():
1315 command.extend(results_tracker.GetArguments())
1287 1316
1288 if options.generate_json_file: 1317 if options.generate_json_file:
1289 if os.path.exists(options.test_output_xml): 1318 if os.path.exists(options.test_output_xml):
1290 # remove the old XML output file. 1319 # remove the old XML output file.
1291 os.remove(options.test_output_xml) 1320 os.remove(options.test_output_xml)
1292 1321
1293 try: 1322 try:
1294 start_xvfb = False 1323 start_xvfb = False
1295 http_server = None 1324 http_server = None
1296 json_file_name = None 1325 json_file_name = None
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 if not _GenerateJSONForTestResults(options, results_tracker): 1377 if not _GenerateJSONForTestResults(options, results_tracker):
1349 return 1 1378 return 1
1350 1379
1351 if options.annotate: 1380 if options.annotate:
1352 annotation_utils.annotate( 1381 annotation_utils.annotate(
1353 options.test_type, result, results_tracker, 1382 options.test_type, result, results_tracker,
1354 options.factory_properties.get('full_test_name'), 1383 options.factory_properties.get('full_test_name'),
1355 perf_dashboard_id=options.perf_dashboard_id) 1384 perf_dashboard_id=options.perf_dashboard_id)
1356 1385
1357 if options.results_url: 1386 if options.results_url:
1358 _SendResultsToDashboard( 1387 _SendResultsToDashboard(results_tracker, options)
1359 results_tracker, _GetPerfID(options),
1360 options.test_type, options.results_url, options.build_dir,
1361 options.build_properties.get('mastername'),
1362 options.build_properties.get('buildername'),
1363 options.build_properties.get('buildnumber'),
1364 options.supplemental_columns_file,
1365 options.perf_config)
1366 1388
1367 return result 1389 return result
1368 1390
1369 1391
1370 def _MainWin(options, args, extra_env): 1392 def _MainWin(options, args, extra_env):
1371 """Runs tests on windows. 1393 """Runs tests on windows.
1372 1394
1373 Using the target build configuration, run the executable given in the 1395 Using the target build configuration, run the executable given in the
1374 first non-option argument, passing any following arguments to that 1396 first non-option argument, passing any following arguments to that
1375 executable. 1397 executable.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 '--'] + command 1446 '--'] + command
1425 command.extend(args[1:]) 1447 command.extend(args[1:])
1426 1448
1427 # Nuke anything that appears to be stale chrome items in the temporary 1449 # Nuke anything that appears to be stale chrome items in the temporary
1428 # directory from previous test runs (i.e.- from crashes or unittest leaks). 1450 # directory from previous test runs (i.e.- from crashes or unittest leaks).
1429 slave_utils.RemoveChromeTemporaryFiles() 1451 slave_utils.RemoveChromeTemporaryFiles()
1430 1452
1431 # If --annotate=list was passed, list the log parser classes and exit. 1453 # If --annotate=list was passed, list the log parser classes and exit.
1432 if _ListParsers(options.annotate): 1454 if _ListParsers(options.annotate):
1433 return 0 1455 return 0
1434 tracker_class = _SelectResultsTracker(options) 1456 tracker_class = _SelectResultsTracker(options, test_exe)
1435 results_tracker = _CreateResultsTracker(tracker_class, options) 1457 results_tracker = _CreateResultsTracker(tracker_class, options)
1458 if hasattr(results_tracker, 'IsChartJson') and results_tracker.IsChartJson():
1459 command.extend(results_tracker.GetArguments())
1436 1460
1437 if options.generate_json_file: 1461 if options.generate_json_file:
1438 if os.path.exists(options.test_output_xml): 1462 if os.path.exists(options.test_output_xml):
1439 # remove the old XML output file. 1463 # remove the old XML output file.
1440 os.remove(options.test_output_xml) 1464 os.remove(options.test_output_xml)
1441 1465
1442 try: 1466 try:
1443 http_server = None 1467 http_server = None
1444 if options.document_root: 1468 if options.document_root:
1445 http_server = _StartHttpServer('win', build_dir=build_dir, 1469 http_server = _StartHttpServer('win', build_dir=build_dir,
(...skipping 24 matching lines...) Expand all
1470 if not _GenerateJSONForTestResults(options, results_tracker): 1494 if not _GenerateJSONForTestResults(options, results_tracker):
1471 return 1 1495 return 1
1472 1496
1473 if options.annotate: 1497 if options.annotate:
1474 annotation_utils.annotate( 1498 annotation_utils.annotate(
1475 options.test_type, result, results_tracker, 1499 options.test_type, result, results_tracker,
1476 options.factory_properties.get('full_test_name'), 1500 options.factory_properties.get('full_test_name'),
1477 perf_dashboard_id=options.perf_dashboard_id) 1501 perf_dashboard_id=options.perf_dashboard_id)
1478 1502
1479 if options.results_url: 1503 if options.results_url:
1480 _SendResultsToDashboard( 1504 _SendResultsToDashboard(results_tracker, options)
1481 results_tracker, _GetPerfID(options),
1482 options.test_type, options.results_url, options.build_dir,
1483 options.build_properties.get('mastername'),
1484 options.build_properties.get('buildername'),
1485 options.build_properties.get('buildnumber'),
1486 options.supplemental_columns_file,
1487 options.perf_config)
1488 1505
1489 return result 1506 return result
1490 1507
1491 1508
1492 def _MainAndroid(options, args, extra_env): 1509 def _MainAndroid(options, args, extra_env):
1493 """Runs tests on android. 1510 """Runs tests on android.
1494 1511
1495 Running GTest-based tests on android is different than on Linux as it requires 1512 Running GTest-based tests on android is different than on Linux as it requires
1496 src/build/android/test_runner.py to deploy and communicate with the device. 1513 src/build/android/test_runner.py to deploy and communicate with the device.
1497 Python scripts are the same as with Linux. 1514 Python scripts are the same as with Linux.
1498 1515
1499 Args: 1516 Args:
1500 options: Command-line options for this invocation of runtest.py. 1517 options: Command-line options for this invocation of runtest.py.
1501 args: Command and arguments for the test. 1518 args: Command and arguments for the test.
1502 extra_env: A dictionary of extra environment variables to set. 1519 extra_env: A dictionary of extra environment variables to set.
1503 1520
1504 Returns: 1521 Returns:
1505 Exit status code. 1522 Exit status code.
1506 """ 1523 """
1507 if options.run_python_script: 1524 if options.run_python_script:
1508 return _MainLinux(options, args, extra_env) 1525 return _MainLinux(options, args, extra_env)
1509 1526
1510 if len(args) < 1: 1527 if len(args) < 1:
1511 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) 1528 raise chromium_utils.MissingArgument('Usage: %s' % USAGE)
1512 1529
1513 if _ListParsers(options.annotate): 1530 if _ListParsers(options.annotate):
1514 return 0 1531 return 0
1515 tracker_class = _SelectResultsTracker(options) 1532 tracker_class = _SelectResultsTracker(options, None)
1516 results_tracker = _CreateResultsTracker(tracker_class, options) 1533 results_tracker = _CreateResultsTracker(tracker_class, options)
1517 1534
1518 if options.generate_json_file: 1535 if options.generate_json_file:
1519 if os.path.exists(options.test_output_xml): 1536 if os.path.exists(options.test_output_xml):
1520 # remove the old XML output file. 1537 # remove the old XML output file.
1521 os.remove(options.test_output_xml) 1538 os.remove(options.test_output_xml)
1522 1539
1523 # Assume it's a gtest apk, so use the android harness. 1540 # Assume it's a gtest apk, so use the android harness.
1524 test_suite = args[0] 1541 test_suite = args[0]
1525 run_test_target_option = '--release' 1542 run_test_target_option = '--release'
1526 if options.target == 'Debug': 1543 if options.target == 'Debug':
1527 run_test_target_option = '--debug' 1544 run_test_target_option = '--debug'
1528 command = ['src/build/android/test_runner.py', 'gtest', 1545 command = ['src/build/android/test_runner.py', 'gtest',
1529 run_test_target_option, '-s', test_suite] 1546 run_test_target_option, '-s', test_suite]
1530 result = _RunGTestCommand(command, extra_env, results_tracker=results_tracker) 1547 result = _RunGTestCommand(command, extra_env, results_tracker=results_tracker)
1531 1548
1532 if options.generate_json_file: 1549 if options.generate_json_file:
1533 if not _GenerateJSONForTestResults(options, results_tracker): 1550 if not _GenerateJSONForTestResults(options, results_tracker):
1534 return 1 1551 return 1
1535 1552
1536 if options.annotate: 1553 if options.annotate:
1537 annotation_utils.annotate( 1554 annotation_utils.annotate(
1538 options.test_type, result, results_tracker, 1555 options.test_type, result, results_tracker,
1539 options.factory_properties.get('full_test_name'), 1556 options.factory_properties.get('full_test_name'),
1540 perf_dashboard_id=options.perf_dashboard_id) 1557 perf_dashboard_id=options.perf_dashboard_id)
1541 1558
1542 if options.results_url: 1559 if options.results_url:
1543 _SendResultsToDashboard( 1560 _SendResultsToDashboard(results_tracker, options)
1544 results_tracker, _GetPerfID(options),
1545 options.test_type, options.results_url, options.build_dir,
1546 options.build_properties.get('mastername'),
1547 options.build_properties.get('buildername'),
1548 options.build_properties.get('buildnumber'),
1549 options.supplemental_columns_file,
1550 options.perf_config)
1551 1561
1552 return result 1562 return result
1553 1563
1554 1564
1555 def main(): 1565 def main():
1556 """Entry point for runtest.py. 1566 """Entry point for runtest.py.
1557 1567
1558 This function: 1568 This function:
1559 (1) Sets up the command-line options. 1569 (1) Sets up the command-line options.
1560 (2) Sets environment variables based on those options. 1570 (2) Sets environment variables based on those options.
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 finally: 1959 finally:
1950 if did_launch_dbus: 1960 if did_launch_dbus:
1951 # It looks like the command line argument --exit-with-session 1961 # It looks like the command line argument --exit-with-session
1952 # isn't working to clean up the spawned dbus-daemon. Kill it 1962 # isn't working to clean up the spawned dbus-daemon. Kill it
1953 # manually. 1963 # manually.
1954 _ShutdownDBus() 1964 _ShutdownDBus()
1955 1965
1956 1966
1957 if '__main__' == __name__: 1967 if '__main__' == __name__:
1958 sys.exit(main()) 1968 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698