Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 to run a chrome test executable, used by the buildbot slaves. | 6 """A tool to run a chrome test executable, used by the buildbot slaves. |
| 7 | 7 |
| 8 When this is run, the current directory (cwd) should be the outer build | 8 When this is run, the current directory (cwd) should be the outer build |
| 9 directory (e.g., chrome-release/build/). | 9 directory (e.g., chrome-release/build/). |
| 10 | 10 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 Note that it adds slave's WebKit/Tools/Scripts to the PYTHONPATH | 181 Note that it adds slave's WebKit/Tools/Scripts to the PYTHONPATH |
| 182 to run the JSON generator. | 182 to run the JSON generator. |
| 183 | 183 |
| 184 Args: | 184 Args: |
| 185 options: command-line options that are supposed to have build_dir, | 185 options: command-line options that are supposed to have build_dir, |
| 186 results_directory, builder_name, build_name and test_output_xml values. | 186 results_directory, builder_name, build_name and test_output_xml values. |
| 187 """ | 187 """ |
| 188 # pylint: disable=W0703 | 188 # pylint: disable=W0703 |
| 189 results_map = None | 189 results_map = None |
| 190 try: | 190 try: |
| 191 if os.path.exists(options.test_output_xml): | 191 if (os.path.exists(options.test_output_xml) and |
| 192 not using_gtest_json(options)): | |
| 192 results_map = gtest_slave_utils.GetResultsMapFromXML( | 193 results_map = gtest_slave_utils.GetResultsMapFromXML( |
| 193 options.test_output_xml) | 194 options.test_output_xml) |
| 194 else: | 195 else: |
| 195 sys.stderr.write( | 196 if using_gtest_json(options): |
|
ghost stip (do not use)
2013/12/16 21:18:50
don't you still need the XML reader here for the f
Paweł Hajdan Jr.
2013/12/17 16:51:56
Sorry, could you explain more? We discussed this o
ghost stip (do not use)
2013/12/17 18:36:39
ah sorry, I misread the if indentation and thought
| |
| 196 ('"%s" \ "%s" doesn\'t exist: Unable to generate JSON from XML, ' | 197 sys.stderr.write('using JSON summary output instead of gtest XML\n') |
| 197 'using log output.\n') % (os.getcwd(), options.test_output_xml)) | 198 else: |
| 199 sys.stderr.write( | |
| 200 ('"%s" \ "%s" doesn\'t exist: Unable to generate JSON from XML, ' | |
| 201 'using log output.\n') % (os.getcwd(), options.test_output_xml)) | |
| 198 # The file did not get generated. See if we can generate a results map | 202 # The file did not get generated. See if we can generate a results map |
| 199 # from the log output. | 203 # from the log output. |
| 200 results_map = gtest_slave_utils.GetResultsMap(results_tracker) | 204 results_map = gtest_slave_utils.GetResultsMap(results_tracker) |
| 201 except Exception, e: | 205 except Exception, e: |
| 202 # This error will be caught by the following 'not results_map' statement. | 206 # This error will be caught by the following 'not results_map' statement. |
| 203 print 'Error: ', e | 207 print 'Error: ', e |
| 204 | 208 |
| 205 if not results_map: | 209 if not results_map: |
| 206 print 'No data was available to update the JSON results' | 210 print 'No data was available to update the JSON results' |
| 207 return | 211 return |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 stop_cmd = platform_util.GetStopHttpdCommand() | 334 stop_cmd = platform_util.GetStopHttpdCommand() |
| 331 http_server = google.httpd_utils.ApacheHttpd(start_cmd, stop_cmd, [8000]) | 335 http_server = google.httpd_utils.ApacheHttpd(start_cmd, stop_cmd, [8000]) |
| 332 try: | 336 try: |
| 333 http_server.StartServer() | 337 http_server.StartServer() |
| 334 except google.httpd_utils.HttpdNotStarted, e: | 338 except google.httpd_utils.HttpdNotStarted, e: |
| 335 raise google.httpd_utils.HttpdNotStarted('%s. See log file in %s' % | 339 raise google.httpd_utils.HttpdNotStarted('%s. See log file in %s' % |
| 336 (e, output_dir)) | 340 (e, output_dir)) |
| 337 return http_server | 341 return http_server |
| 338 | 342 |
| 339 | 343 |
| 344 def using_gtest_json(options): | |
| 345 """Returns true if we're using gtest JSON summary.""" | |
| 346 return (options.annotate == 'gtest' and | |
| 347 not options.run_python_script and | |
| 348 not options.run_shell_script) | |
| 349 | |
| 350 | |
| 340 def get_parsers(): | 351 def get_parsers(): |
| 341 """Returns a dictionary mapping strings to log parser classes.""" | 352 """Returns a dictionary mapping strings to log parser classes.""" |
| 342 parsers = {'gtest': gtest_utils.GTestLogParser, | 353 parsers = {'gtest': gtest_utils.GTestLogParser, |
| 343 'benchpress': process_log_utils.BenchpressLogProcessor, | 354 'benchpress': process_log_utils.BenchpressLogProcessor, |
| 344 'playback': process_log_utils.PlaybackLogProcessor, | 355 'playback': process_log_utils.PlaybackLogProcessor, |
| 345 'graphing': process_log_utils.GraphingLogProcessor, | 356 'graphing': process_log_utils.GraphingLogProcessor, |
| 346 'endure': process_log_utils.GraphingEndureLogProcessor, | 357 'endure': process_log_utils.GraphingEndureLogProcessor, |
| 347 'framerate': process_log_utils.GraphingFrameRateLogProcessor, | 358 'framerate': process_log_utils.GraphingFrameRateLogProcessor, |
| 348 'pagecycler': process_log_utils.GraphingPageCyclerLogProcessor} | 359 'pagecycler': process_log_utils.GraphingPageCyclerLogProcessor} |
| 349 return parsers | 360 return parsers |
| 350 | 361 |
| 351 | 362 |
| 352 def list_parsers(selection): | 363 def list_parsers(selection): |
| 353 """Prints a list of available log parser classes iff the input is 'list'. | 364 """Prints a list of available log parser classes iff the input is 'list'. |
| 354 | 365 |
| 355 Returns: | 366 Returns: |
| 356 True iff the input is 'list' (meaning that a list was printed). | 367 True iff the input is 'list' (meaning that a list was printed). |
| 357 """ | 368 """ |
| 358 parsers = get_parsers() | 369 parsers = get_parsers() |
| 359 shouldlist = selection and selection == 'list' | 370 shouldlist = selection and selection == 'list' |
| 360 if shouldlist: | 371 if shouldlist: |
| 361 print | 372 print |
| 362 print 'Available log parsers:' | 373 print 'Available log parsers:' |
| 363 for p in parsers: | 374 for p in parsers: |
| 364 print ' ', p, parsers[p].__name__ | 375 print ' ', p, parsers[p].__name__ |
| 365 | 376 |
| 366 return shouldlist | 377 return shouldlist |
| 367 | 378 |
| 368 | 379 |
| 369 def select_results_tracker(selection, use_gtest): | 380 def select_results_tracker(options): |
| 370 """Returns a log parser class (aka results tracker class). | 381 """Returns a log parser class (aka results tracker class). |
| 371 | 382 |
| 372 Args: | 383 Args: |
| 373 selection: Name of parser to use. This is the value of the | 384 options: Command-line options (from OptionParser). |
| 374 of the --annotate option that's passed to this script. | |
| 375 use_gtest: Whether the gtest parser should be used. This is | |
| 376 the value of the --generate-json-file flag. | |
| 377 | 385 |
| 378 Returns: | 386 Returns: |
| 379 A log parser class (aka results tracker class), or None. | 387 A log parser class (aka results tracker class), or None. |
| 380 """ | 388 """ |
| 389 if (using_gtest_json(options)): | |
| 390 return gtest_utils.GTestJSONParser | |
| 391 | |
| 381 parsers = get_parsers() | 392 parsers = get_parsers() |
| 382 if selection: | 393 if options.annotate: |
| 383 if selection in parsers: | 394 if options.annotate in parsers: |
| 384 if use_gtest and selection != 'gtest': | 395 if options.generate_json_file and options.annotate != 'gtest': |
| 385 raise NotImplementedError("'%s' doesn't make sense with " | 396 raise NotImplementedError("'%s' doesn't make sense with " |
| 386 "options.generate_json_file") | 397 "options.generate_json_file") |
| 387 else: | 398 else: |
| 388 return parsers[selection] | 399 return parsers[options.annotate] |
| 389 else: | 400 else: |
| 390 raise KeyError("'%s' is not a valid GTest parser!!" % selection) | 401 raise KeyError("'%s' is not a valid GTest parser!!" % options.annotate) |
| 391 elif use_gtest: | 402 elif options.generate_json_file: |
| 392 return parsers['gtest'] | 403 return parsers['gtest'] |
| 404 | |
| 393 return None | 405 return None |
| 394 | 406 |
| 395 | 407 |
| 396 def create_results_tracker(tracker_class, options): | 408 def create_results_tracker(tracker_class, options): |
| 397 """Instantiate a log parser (aka results tracker). | 409 """Instantiate a log parser (aka results tracker). |
| 398 | 410 |
| 399 Args: | 411 Args: |
| 400 tracker_class: A log parser class. | 412 tracker_class: A log parser class. |
| 401 options: Command-line options (from OptionParser). | 413 options: Command-line options (from OptionParser). |
| 402 | 414 |
| 403 Returns: | 415 Returns: |
| 404 An instance of a log parser class, or None. | 416 An instance of a log parser class, or None. |
| 405 """ | 417 """ |
| 406 if not tracker_class: | 418 if not tracker_class: |
| 407 return None | 419 return None |
| 408 | 420 |
| 409 if tracker_class.__name__ == 'GTestLogParser': | 421 if tracker_class.__name__ in ('GTestLogParser', 'GTestJSONParser'): |
| 410 tracker_obj = tracker_class() | 422 tracker_obj = tracker_class() |
| 411 else: | 423 else: |
| 412 build_dir = os.path.abspath(options.build_dir) | 424 build_dir = os.path.abspath(options.build_dir) |
| 413 try: | 425 try: |
| 414 webkit_dir = chromium_utils.FindUpward(build_dir, 'third_party', 'WebKit', | 426 webkit_dir = chromium_utils.FindUpward(build_dir, 'third_party', 'WebKit', |
| 415 'Source') | 427 'Source') |
| 416 webkit_revision = GetSvnRevision(webkit_dir) | 428 webkit_revision = GetSvnRevision(webkit_dir) |
| 417 except: # pylint: disable=W0702 | 429 except: # pylint: disable=W0702 |
| 418 webkit_revision = 'undefined' | 430 webkit_revision = 'undefined' |
| 419 | 431 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 """ | 600 """ |
| 589 | 601 |
| 590 if not options.annotate: | 602 if not options.annotate: |
| 591 raise chromium_utils.MissingArgument('--parse-input doesn\'t make sense ' | 603 raise chromium_utils.MissingArgument('--parse-input doesn\'t make sense ' |
| 592 'without --annotate.') | 604 'without --annotate.') |
| 593 | 605 |
| 594 # If --annotate=list was passed, list the log parser classes and exit. | 606 # If --annotate=list was passed, list the log parser classes and exit. |
| 595 if list_parsers(options.annotate): | 607 if list_parsers(options.annotate): |
| 596 return 0 | 608 return 0 |
| 597 | 609 |
| 598 tracker_class = select_results_tracker(options.annotate, | 610 tracker_class = select_results_tracker(options) |
| 599 options.generate_json_file) | |
| 600 results_tracker = create_results_tracker(tracker_class, options) | 611 results_tracker = create_results_tracker(tracker_class, options) |
| 601 | 612 |
| 602 if options.generate_json_file: | 613 if options.generate_json_file: |
| 603 if os.path.exists(options.test_output_xml): | 614 if os.path.exists(options.test_output_xml): |
| 604 # remove the old XML output file. | 615 # remove the old XML output file. |
| 605 os.remove(options.test_output_xml) | 616 os.remove(options.test_output_xml) |
| 606 | 617 |
| 607 if options.parse_input == '-': | 618 if options.parse_input == '-': |
| 608 f = sys.stdin | 619 f = sys.stdin |
| 609 else: | 620 else: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 command = [sys.executable, test_exe] | 665 command = [sys.executable, test_exe] |
| 655 else: | 666 else: |
| 656 command = [test_exe_path] | 667 command = [test_exe_path] |
| 657 if options.annotate == 'gtest': | 668 if options.annotate == 'gtest': |
| 658 command.extend(['--brave-new-test-launcher', '--test-launcher-bot-mode']) | 669 command.extend(['--brave-new-test-launcher', '--test-launcher-bot-mode']) |
| 659 command.extend(args[1:]) | 670 command.extend(args[1:]) |
| 660 | 671 |
| 661 # If --annotate=list was passed, list the log parser classes and exit. | 672 # If --annotate=list was passed, list the log parser classes and exit. |
| 662 if list_parsers(options.annotate): | 673 if list_parsers(options.annotate): |
| 663 return 0 | 674 return 0 |
| 664 tracker_class = select_results_tracker(options.annotate, | 675 tracker_class = select_results_tracker(options) |
| 665 options.generate_json_file) | |
| 666 results_tracker = create_results_tracker(tracker_class, options) | 676 results_tracker = create_results_tracker(tracker_class, options) |
| 667 | 677 |
| 668 if options.generate_json_file: | 678 if options.generate_json_file: |
| 669 if os.path.exists(options.test_output_xml): | 679 if os.path.exists(options.test_output_xml): |
| 670 # remove the old XML output file. | 680 # remove the old XML output file. |
| 671 os.remove(options.test_output_xml) | 681 os.remove(options.test_output_xml) |
| 672 | 682 |
| 673 try: | 683 try: |
| 674 http_server = None | 684 http_server = None |
| 675 if options.document_root: | 685 if options.document_root: |
| 676 http_server = start_http_server('mac', build_dir=build_dir, | 686 http_server = start_http_server('mac', build_dir=build_dir, |
| 677 test_exe_path=test_exe_path, | 687 test_exe_path=test_exe_path, |
| 678 document_root=options.document_root) | 688 document_root=options.document_root) |
| 689 | |
| 690 if using_gtest_json(options): | |
| 691 json_file_name = results_tracker.OpenJSONFile( | |
| 692 options.test_launcher_summary_output) | |
| 693 command.append('--test-launcher-summary-output=%s' % json_file_name) | |
| 694 | |
| 679 pipes = [] | 695 pipes = [] |
| 680 if options.factory_properties.get('asan', False): | 696 if options.factory_properties.get('asan', False): |
| 681 symbolize = os.path.abspath(os.path.join('src', 'tools', 'valgrind', | 697 symbolize = os.path.abspath(os.path.join('src', 'tools', 'valgrind', |
| 682 'asan', 'asan_symbolize.py')) | 698 'asan', 'asan_symbolize.py')) |
| 683 pipes = [[sys.executable, symbolize], ['c++filt']] | 699 pipes = [[sys.executable, symbolize], ['c++filt']] |
| 684 | 700 |
| 685 command = generate_run_isolated_command(build_dir, test_exe_path, options, | 701 command = generate_run_isolated_command(build_dir, test_exe_path, options, |
| 686 command) | 702 command) |
| 687 result = _RunGTestCommand(command, pipes=pipes, | 703 result = _RunGTestCommand(command, pipes=pipes, |
| 688 results_tracker=results_tracker) | 704 results_tracker=results_tracker) |
| 689 finally: | 705 finally: |
| 690 if http_server: | 706 if http_server: |
| 691 http_server.StopServer() | 707 http_server.StopServer() |
| 708 if using_gtest_json(options): | |
| 709 results_tracker.ProcessAndCloseJSONFile() | |
| 692 | 710 |
| 693 if options.generate_json_file: | 711 if options.generate_json_file: |
| 694 _GenerateJSONForTestResults(options, results_tracker) | 712 _GenerateJSONForTestResults(options, results_tracker) |
| 695 | 713 |
| 696 if options.annotate: | 714 if options.annotate: |
| 697 annotation_utils.annotate( | 715 annotation_utils.annotate( |
| 698 options.test_type, result, results_tracker, | 716 options.test_type, result, results_tracker, |
| 699 options.factory_properties.get('full_test_name'), | 717 options.factory_properties.get('full_test_name'), |
| 700 perf_dashboard_id=options.perf_dashboard_id) | 718 perf_dashboard_id=options.perf_dashboard_id) |
| 701 | 719 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 896 command = [sys.executable, test_exe] | 914 command = [sys.executable, test_exe] |
| 897 else: | 915 else: |
| 898 command = [test_exe_path] | 916 command = [test_exe_path] |
| 899 if options.annotate == 'gtest': | 917 if options.annotate == 'gtest': |
| 900 command.extend(['--brave-new-test-launcher', '--test-launcher-bot-mode']) | 918 command.extend(['--brave-new-test-launcher', '--test-launcher-bot-mode']) |
| 901 command.extend(args[1:]) | 919 command.extend(args[1:]) |
| 902 | 920 |
| 903 # If --annotate=list was passed, list the log parser classes and exit. | 921 # If --annotate=list was passed, list the log parser classes and exit. |
| 904 if list_parsers(options.annotate): | 922 if list_parsers(options.annotate): |
| 905 return 0 | 923 return 0 |
| 906 tracker_class = select_results_tracker(options.annotate, | 924 tracker_class = select_results_tracker(options) |
| 907 options.generate_json_file) | |
| 908 results_tracker = create_results_tracker(tracker_class, options) | 925 results_tracker = create_results_tracker(tracker_class, options) |
| 909 | 926 |
| 910 if options.generate_json_file: | 927 if options.generate_json_file: |
| 911 if os.path.exists(options.test_output_xml): | 928 if os.path.exists(options.test_output_xml): |
| 912 # remove the old XML output file. | 929 # remove the old XML output file. |
| 913 os.remove(options.test_output_xml) | 930 os.remove(options.test_output_xml) |
| 914 | 931 |
| 915 try: | 932 try: |
| 916 start_xvfb = False | 933 start_xvfb = False |
| 917 http_server = None | 934 http_server = None |
| 918 if options.document_root: | 935 if options.document_root: |
| 919 http_server = start_http_server('linux', build_dir=build_dir, | 936 http_server = start_http_server('linux', build_dir=build_dir, |
| 920 test_exe_path=test_exe_path, | 937 test_exe_path=test_exe_path, |
| 921 document_root=options.document_root) | 938 document_root=options.document_root) |
| 922 | 939 |
| 923 # TODO(dpranke): checking on test_exe is a temporary hack until we | 940 # TODO(dpranke): checking on test_exe is a temporary hack until we |
| 924 # can change the buildbot master to pass --xvfb instead of --no-xvfb | 941 # can change the buildbot master to pass --xvfb instead of --no-xvfb |
| 925 # for these two steps. See | 942 # for these two steps. See |
| 926 # https://code.google.com/p/chromium/issues/detail?id=179814 | 943 # https://code.google.com/p/chromium/issues/detail?id=179814 |
| 927 start_xvfb = (options.xvfb or | 944 start_xvfb = (options.xvfb or |
| 928 'layout_test_wrapper' in test_exe or | 945 'layout_test_wrapper' in test_exe or |
| 929 'devtools_perf_test_wrapper' in test_exe) | 946 'devtools_perf_test_wrapper' in test_exe) |
| 930 if start_xvfb: | 947 if start_xvfb: |
| 931 xvfb.StartVirtualX( | 948 xvfb.StartVirtualX( |
| 932 slave_name, bin_dir, | 949 slave_name, bin_dir, |
| 933 with_wm=(options.factory_properties.get('window_manager', 'True') == | 950 with_wm=(options.factory_properties.get('window_manager', 'True') == |
| 934 'True'), | 951 'True'), |
| 935 server_dir=special_xvfb_dir) | 952 server_dir=special_xvfb_dir) |
| 936 | 953 |
| 954 if using_gtest_json(options): | |
| 955 json_file_name = results_tracker.OpenJSONFile( | |
| 956 options.test_launcher_summary_output) | |
| 957 command.append('--test-launcher-summary-output=%s' % json_file_name) | |
| 958 | |
| 937 pipes = [] | 959 pipes = [] |
| 938 # Plain ASan bots use a symbolizer script, whereas ASan+LSan and LSan bots | 960 # Plain ASan bots use a symbolizer script, whereas ASan+LSan and LSan bots |
| 939 # use a built-in symbolizer. | 961 # use a built-in symbolizer. |
| 940 if (options.factory_properties.get('asan', False) and | 962 if (options.factory_properties.get('asan', False) and |
| 941 not options.enable_lsan): | 963 not options.enable_lsan): |
| 942 symbolize = os.path.abspath(os.path.join('src', 'tools', 'valgrind', | 964 symbolize = os.path.abspath(os.path.join('src', 'tools', 'valgrind', |
| 943 'asan', 'asan_symbolize.py')) | 965 'asan', 'asan_symbolize.py')) |
| 944 pipes = [[sys.executable, symbolize], ['c++filt']] | 966 pipes = [[sys.executable, symbolize], ['c++filt']] |
| 945 | 967 |
| 946 command = generate_run_isolated_command(build_dir, test_exe_path, options, | 968 command = generate_run_isolated_command(build_dir, test_exe_path, options, |
| 947 command) | 969 command) |
| 948 result = _RunGTestCommand(command, pipes=pipes, | 970 result = _RunGTestCommand(command, pipes=pipes, |
| 949 results_tracker=results_tracker, | 971 results_tracker=results_tracker, |
| 950 extra_env=extra_env) | 972 extra_env=extra_env) |
| 951 finally: | 973 finally: |
| 952 if http_server: | 974 if http_server: |
| 953 http_server.StopServer() | 975 http_server.StopServer() |
| 954 if start_xvfb: | 976 if start_xvfb: |
| 955 xvfb.StopVirtualX(slave_name) | 977 xvfb.StopVirtualX(slave_name) |
| 978 if using_gtest_json(options): | |
| 979 results_tracker.ProcessAndCloseJSONFile() | |
| 956 | 980 |
| 957 if options.generate_json_file: | 981 if options.generate_json_file: |
| 958 _GenerateJSONForTestResults(options, results_tracker) | 982 _GenerateJSONForTestResults(options, results_tracker) |
| 959 | 983 |
| 960 if options.annotate: | 984 if options.annotate: |
| 961 annotation_utils.annotate( | 985 annotation_utils.annotate( |
| 962 options.test_type, result, results_tracker, | 986 options.test_type, result, results_tracker, |
| 963 options.factory_properties.get('full_test_name'), | 987 options.factory_properties.get('full_test_name'), |
| 964 perf_dashboard_id=options.perf_dashboard_id) | 988 perf_dashboard_id=options.perf_dashboard_id) |
| 965 | 989 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1025 '--'] + command | 1049 '--'] + command |
| 1026 command.extend(args[1:]) | 1050 command.extend(args[1:]) |
| 1027 | 1051 |
| 1028 # Nuke anything that appears to be stale chrome items in the temporary | 1052 # Nuke anything that appears to be stale chrome items in the temporary |
| 1029 # directory from previous test runs (i.e.- from crashes or unittest leaks). | 1053 # directory from previous test runs (i.e.- from crashes or unittest leaks). |
| 1030 slave_utils.RemoveChromeTemporaryFiles() | 1054 slave_utils.RemoveChromeTemporaryFiles() |
| 1031 | 1055 |
| 1032 # If --annotate=list was passed, list the log parser classes and exit. | 1056 # If --annotate=list was passed, list the log parser classes and exit. |
| 1033 if list_parsers(options.annotate): | 1057 if list_parsers(options.annotate): |
| 1034 return 0 | 1058 return 0 |
| 1035 tracker_class = select_results_tracker(options.annotate, | 1059 tracker_class = select_results_tracker(options) |
| 1036 options.generate_json_file) | |
| 1037 results_tracker = create_results_tracker(tracker_class, options) | 1060 results_tracker = create_results_tracker(tracker_class, options) |
| 1038 | 1061 |
| 1039 if options.generate_json_file: | 1062 if options.generate_json_file: |
| 1040 if os.path.exists(options.test_output_xml): | 1063 if os.path.exists(options.test_output_xml): |
| 1041 # remove the old XML output file. | 1064 # remove the old XML output file. |
| 1042 os.remove(options.test_output_xml) | 1065 os.remove(options.test_output_xml) |
| 1043 | 1066 |
| 1044 try: | 1067 try: |
| 1045 http_server = None | 1068 http_server = None |
| 1046 if options.document_root: | 1069 if options.document_root: |
| 1047 http_server = start_http_server('win', build_dir=build_dir, | 1070 http_server = start_http_server('win', build_dir=build_dir, |
| 1048 test_exe_path=test_exe_path, | 1071 test_exe_path=test_exe_path, |
| 1049 document_root=options.document_root) | 1072 document_root=options.document_root) |
| 1073 | |
| 1074 if using_gtest_json(options): | |
| 1075 json_file_name = results_tracker.OpenJSONFile( | |
| 1076 options.test_launcher_summary_output) | |
| 1077 command.append('--test-launcher-summary-output=%s' % json_file_name) | |
| 1078 | |
| 1050 command = generate_run_isolated_command(build_dir, test_exe_path, options, | 1079 command = generate_run_isolated_command(build_dir, test_exe_path, options, |
| 1051 command) | 1080 command) |
| 1052 result = _RunGTestCommand(command, results_tracker) | 1081 result = _RunGTestCommand(command, results_tracker) |
| 1053 finally: | 1082 finally: |
| 1054 if http_server: | 1083 if http_server: |
| 1055 http_server.StopServer() | 1084 http_server.StopServer() |
| 1085 if using_gtest_json(options): | |
| 1086 results_tracker.ProcessAndCloseJSONFile() | |
| 1056 | 1087 |
| 1057 if options.enable_pageheap: | 1088 if options.enable_pageheap: |
| 1058 slave_utils.SetPageHeap(build_dir, 'chrome.exe', False) | 1089 slave_utils.SetPageHeap(build_dir, 'chrome.exe', False) |
| 1059 | 1090 |
| 1060 if options.generate_json_file: | 1091 if options.generate_json_file: |
| 1061 _GenerateJSONForTestResults(options, results_tracker) | 1092 _GenerateJSONForTestResults(options, results_tracker) |
| 1062 | 1093 |
| 1063 if options.annotate: | 1094 if options.annotate: |
| 1064 annotation_utils.annotate( | 1095 annotation_utils.annotate( |
| 1065 options.test_type, result, results_tracker, | 1096 options.test_type, result, results_tracker, |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1087 Python scripts are the same as with linux. | 1118 Python scripts are the same as with linux. |
| 1088 """ | 1119 """ |
| 1089 if options.run_python_script: | 1120 if options.run_python_script: |
| 1090 return main_linux(options, args) | 1121 return main_linux(options, args) |
| 1091 | 1122 |
| 1092 if len(args) < 1: | 1123 if len(args) < 1: |
| 1093 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) | 1124 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) |
| 1094 | 1125 |
| 1095 if list_parsers(options.annotate): | 1126 if list_parsers(options.annotate): |
| 1096 return 0 | 1127 return 0 |
| 1097 tracker_class = select_results_tracker(options.annotate, | 1128 tracker_class = select_results_tracker(options) |
| 1098 options.generate_json_file) | |
| 1099 results_tracker = create_results_tracker(tracker_class, options) | 1129 results_tracker = create_results_tracker(tracker_class, options) |
| 1100 | 1130 |
| 1101 if options.generate_json_file: | 1131 if options.generate_json_file: |
| 1102 if os.path.exists(options.test_output_xml): | 1132 if os.path.exists(options.test_output_xml): |
| 1103 # remove the old XML output file. | 1133 # remove the old XML output file. |
| 1104 os.remove(options.test_output_xml) | 1134 os.remove(options.test_output_xml) |
| 1105 | 1135 |
| 1106 # Assume it's a gtest apk, so use the android harness. | 1136 # Assume it's a gtest apk, so use the android harness. |
| 1107 test_suite = args[0] | 1137 test_suite = args[0] |
| 1108 run_test_target_option = '--release' | 1138 run_test_target_option = '--release' |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1266 option_parser.add_option('--enable-lsan', default=False, | 1296 option_parser.add_option('--enable-lsan', default=False, |
| 1267 help='Enable memory leak detection (LeakSanitizer). ' | 1297 help='Enable memory leak detection (LeakSanitizer). ' |
| 1268 'Also can be enabled with the factory ' | 1298 'Also can be enabled with the factory ' |
| 1269 'properties "lsan" and "lsan_run_all_tests".') | 1299 'properties "lsan" and "lsan_run_all_tests".') |
| 1270 option_parser.add_option('--extra-sharding-args', default='', | 1300 option_parser.add_option('--extra-sharding-args', default='', |
| 1271 help='Extra options for run_test_cases.py.') | 1301 help='Extra options for run_test_cases.py.') |
| 1272 option_parser.add_option('--no-spawn-dbus', action='store_true', | 1302 option_parser.add_option('--no-spawn-dbus', action='store_true', |
| 1273 default=False, | 1303 default=False, |
| 1274 help='Disable GLib DBus bug workaround: ' | 1304 help='Disable GLib DBus bug workaround: ' |
| 1275 'manually spawning dbus-launch') | 1305 'manually spawning dbus-launch') |
| 1306 option_parser.add_option('--test-launcher-summary-output', | |
| 1307 help='Path to test results file with all the info ' | |
| 1308 'from the test launcher') | |
| 1276 | 1309 |
| 1277 chromium_utils.AddPropertiesOptions(option_parser) | 1310 chromium_utils.AddPropertiesOptions(option_parser) |
| 1278 options, args = option_parser.parse_args() | 1311 options, args = option_parser.parse_args() |
| 1279 if not options.perf_dashboard_id: | 1312 if not options.perf_dashboard_id: |
| 1280 options.perf_dashboard_id = options.factory_properties.get('test_name') | 1313 options.perf_dashboard_id = options.factory_properties.get('test_name') |
| 1281 | 1314 |
| 1282 options.test_type = options.test_type or options.factory_properties.get( | 1315 options.test_type = options.test_type or options.factory_properties.get( |
| 1283 'step_name', '') | 1316 'step_name', '') |
| 1284 | 1317 |
| 1285 if options.run_shell_script and options.run_python_script: | 1318 if options.run_shell_script and options.run_python_script: |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1442 return result | 1475 return result |
| 1443 finally: | 1476 finally: |
| 1444 if did_launch_dbus: | 1477 if did_launch_dbus: |
| 1445 # It looks like the command line argument --exit-with-session | 1478 # It looks like the command line argument --exit-with-session |
| 1446 # isn't working to clean up the spawned dbus-daemon. Kill it | 1479 # isn't working to clean up the spawned dbus-daemon. Kill it |
| 1447 # manually. | 1480 # manually. |
| 1448 _ShutdownDBus() | 1481 _ShutdownDBus() |
| 1449 | 1482 |
| 1450 if '__main__' == __name__: | 1483 if '__main__' == __name__: |
| 1451 sys.exit(main()) | 1484 sys.exit(main()) |
| OLD | NEW |