OLD | NEW |
1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 def test_run_with_multiple_repositories(self): | 687 def test_run_with_multiple_repositories(self): |
688 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', | 688 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', |
689 '--te
st-results-server=some.host']) | 689 '--te
st-results-server=some.host']) |
690 port.repository_path = lambda: '/mock-checkout' | 690 port.repository_path = lambda: '/mock-checkout' |
691 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) | 691 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) |
692 self.assertEqual(self._load_output_json(runner), [{ | 692 self.assertEqual(self._load_output_json(runner), [{ |
693 "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_targ
et_wrapper_and_inspector_results, | 693 "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_targ
et_wrapper_and_inspector_results, |
694 "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000",
"revision": "5678"}}}]) | 694 "revisions": {"chromium": {"timestamp": "2013-02-01 08:48:05 +0000",
"revision": "5678"}}}]) |
695 | 695 |
696 def test_run_with_upload_json(self): | 696 def test_run_with_upload_json(self): |
697 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', | 697 runner, port = self.create_runner_and_setup_results_template(args=[ |
698 '--te
st-results-server', 'some.host', '--platform', 'platform1', '--builder-name', 'b
uilder1', '--build-number', '123']) | 698 '--output-json-path=/mock-checkout/output.json', |
| 699 '--test-results-server', 'some.host', |
| 700 '--platform', 'platform1', |
| 701 '--builder-name', 'builder1', |
| 702 '--build-number', '123' |
| 703 ]) |
699 | 704 |
700 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) | 705 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) |
701 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) | 706 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) |
702 self.assertEqual(generated_json[0]['platform'], 'platform1') | 707 self.assertEqual(generated_json[0]['platform'], 'platform1') |
703 self.assertEqual(generated_json[0]['builderName'], 'builder1') | 708 self.assertEqual(generated_json[0]['builderName'], 'builder1') |
704 self.assertEqual(generated_json[0]['buildNumber'], 123) | 709 self.assertEqual(generated_json[0]['buildNumber'], 123) |
705 | 710 |
706 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=False, | 711 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=False, |
707 expected_exit_code=PerfTestsRunner.EXIT_
CODE_FAILED_UPLOADING) | 712 expected_exit_code=PerfTestsRunner.EXIT_
CODE_FAILED_UPLOADING) |
708 | 713 |
709 def test_run_with_upload_json_should_generate_perf_webkit_json(self): | 714 def test_run_with_upload_json_should_generate_perf_webkit_json(self): |
710 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', | 715 runner, port = self.create_runner_and_setup_results_template(args=[ |
711 '--te
st-results-server', 'some.host', '--platform', 'platform1', '--builder-name', 'b
uilder1', '--build-number', '123', | 716 '--output-json-path=/mock-checkout/output.json', |
712 '--sl
ave-config-json-path=/mock-checkout/slave-config.json']) | 717 '--test-results-server', 'some.host', |
| 718 '--platform', 'platform1', |
| 719 '--builder-name', 'builder1', |
| 720 '--build-number', '123', |
| 721 '--slave-config-json-path=/mock-checkout/slave-config.json' |
| 722 ]) |
713 port.host.filesystem.write_text_file('/mock-checkout/slave-config.json',
'{"key": "value1"}') | 723 port.host.filesystem.write_text_file('/mock-checkout/slave-config.json',
'{"key": "value1"}') |
714 | 724 |
715 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) | 725 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) |
716 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) | 726 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) |
717 self.assertTrue(isinstance(generated_json, list)) | 727 self.assertTrue(isinstance(generated_json, list)) |
718 self.assertEqual(len(generated_json), 1) | 728 self.assertEqual(len(generated_json), 1) |
719 | 729 |
720 output = generated_json[0] | 730 output = generated_json[0] |
721 self.maxDiff = None | 731 self.maxDiff = None |
722 self.assertEqual(output['platform'], 'platform1') | 732 self.assertEqual(output['platform'], 'platform1') |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) | 772 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) |
763 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) | 773 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) |
764 self.assertTrue(isinstance(generated_json, list)) | 774 self.assertTrue(isinstance(generated_json, list)) |
765 self.assertEqual(len(generated_json), 1) | 775 self.assertEqual(len(generated_json), 1) |
766 | 776 |
767 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] | 777 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] |
768 self.assertEqual(len(output), 3) | 778 self.assertEqual(len(output), 3) |
769 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] | 779 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] |
770 for metrics in output: | 780 for metrics in output: |
771 self.assertEqual(metrics, expectedMetrics) | 781 self.assertEqual(metrics, expectedMetrics) |
OLD | NEW |