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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 max 1510 ms | 264 max 1510 ms |
265 """ | 265 """ |
266 | 266 |
267 output = """Running Bindings/event-target-wrapper.html (1 of 2) | 267 output = """Running Bindings/event-target-wrapper.html (1 of 2) |
268 RESULT Bindings: event-target-wrapper: Time= 1490.0 ms | 268 RESULT Bindings: event-target-wrapper: Time= 1490.0 ms |
269 median= 1488.0 ms, stdev= 14.11751 ms, min= 1471.0 ms, max= 1510.0 ms | 269 median= 1488.0 ms, stdev= 14.11751 ms, min= 1471.0 ms, max= 1510.0 ms |
270 Finished: 0.1 s | 270 Finished: 0.1 s |
271 | 271 |
272 """ | 272 """ |
273 | 273 |
274 results = {'url': 'http://trac.webkit.org/browser/trunk/PerformanceTests/Bin
dings/event-target-wrapper.html', | 274 results = {'url': 'https://src.chromium.org/viewvc/blink/trunk/PerformanceTe
sts/Bindings/event-target-wrapper.html', |
275 'metrics': {'Time': {'current': [[1486.0, 1471.0, 1510.0, 1505.0, 1478.0
, 1490.0]] * 4}}} | 275 'metrics': {'Time': {'current': [[1486.0, 1471.0, 1510.0, 1505.0, 1478.0
, 1490.0]] * 4}}} |
276 | 276 |
277 | 277 |
278 class SomeParserTestData: | 278 class SomeParserTestData: |
279 text = """Running 20 times | 279 text = """Running 20 times |
280 Ignoring warm-up run (1115) | 280 Ignoring warm-up run (1115) |
281 | 281 |
282 Time: | 282 Time: |
283 values 1080, 1120, 1095, 1101, 1104 ms | 283 values 1080, 1120, 1095, 1101, 1104 ms |
284 avg 1100 ms | 284 avg 1100 ms |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 if results_shown: | 517 if results_shown: |
518 expected_logs += 'MOCK: user.open_url: file://...\n' | 518 expected_logs += 'MOCK: user.open_url: file://...\n' |
519 self.assertEqual(self._normalize_output(logs), expected_logs) | 519 self.assertEqual(self._normalize_output(logs), expected_logs) |
520 | 520 |
521 self.assertEqual(uploaded[0], upload_succeeds) | 521 self.assertEqual(uploaded[0], upload_succeeds) |
522 | 522 |
523 return logs | 523 return logs |
524 | 524 |
525 _event_target_wrapper_and_inspector_results = { | 525 _event_target_wrapper_and_inspector_results = { |
526 "Bindings": | 526 "Bindings": |
527 {"url": "http://trac.webkit.org/browser/trunk/PerformanceTests/Bindi
ngs", | 527 {"url": "https://src.chromium.org/viewvc/blink/trunk/PerformanceTest
s/Bindings", |
528 "tests": {"event-target-wrapper": EventTargetWrapperTestData.results
}}} | 528 "tests": {"event-target-wrapper": EventTargetWrapperTestData.results
}}} |
529 | 529 |
530 def test_run_with_json_output(self): | 530 def test_run_with_json_output(self): |
531 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', | 531 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', |
532 '--test-results-server=some.host']) | 532 '--test-results-server=some.host']) |
533 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) | 533 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True) |
534 self.assertEqual(self._load_output_json(runner), [{ | 534 self.assertEqual(self._load_output_json(runner), [{ |
535 "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_targ
et_wrapper_and_inspector_results, | 535 "buildTime": "2013-02-08T15:19:37.460000", "tests": self._event_targ
et_wrapper_and_inspector_results, |
536 "revisions": {"blink": {"timestamp": "2013-02-01 08:48:05 +0000", "r
evision": "5678"}}}]) | 536 "revisions": {"blink": {"timestamp": "2013-02-01 08:48:05 +0000", "r
evision": "5678"}}}]) |
537 | 537 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 output = generated_json[0] | 713 output = generated_json[0] |
714 self.maxDiff = None | 714 self.maxDiff = None |
715 self.assertEqual(output['platform'], 'platform1') | 715 self.assertEqual(output['platform'], 'platform1') |
716 self.assertEqual(output['buildNumber'], 123) | 716 self.assertEqual(output['buildNumber'], 123) |
717 self.assertEqual(output['buildTime'], '2013-02-08T15:19:37.460000') | 717 self.assertEqual(output['buildTime'], '2013-02-08T15:19:37.460000') |
718 self.assertEqual(output['builderName'], 'builder1') | 718 self.assertEqual(output['builderName'], 'builder1') |
719 self.assertEqual(output['builderKey'], 'value1') | 719 self.assertEqual(output['builderKey'], 'value1') |
720 self.assertEqual(output['revisions'], {'blink': {'revision': '5678', 'ti
mestamp': '2013-02-01 08:48:05 +0000'}}) | 720 self.assertEqual(output['revisions'], {'blink': {'revision': '5678', 'ti
mestamp': '2013-02-01 08:48:05 +0000'}}) |
721 self.assertEqual(output['tests'].keys(), ['Bindings']) | 721 self.assertEqual(output['tests'].keys(), ['Bindings']) |
722 self.assertEqual(sorted(output['tests']['Bindings'].keys()), ['tests', '
url']) | 722 self.assertEqual(sorted(output['tests']['Bindings'].keys()), ['tests', '
url']) |
723 self.assertEqual(output['tests']['Bindings']['url'], 'http://trac.webkit
.org/browser/trunk/PerformanceTests/Bindings') | 723 self.assertEqual(output['tests']['Bindings']['url'], 'https://src.chromi
um.org/viewvc/blink/trunk/PerformanceTests/Bindings') |
724 self.assertEqual(output['tests']['Bindings']['tests'].keys(), ['event-ta
rget-wrapper']) | 724 self.assertEqual(output['tests']['Bindings']['tests'].keys(), ['event-ta
rget-wrapper']) |
725 self.assertEqual(output['tests']['Bindings']['tests']['event-target-wrap
per'], { | 725 self.assertEqual(output['tests']['Bindings']['tests']['event-target-wrap
per'], { |
726 'url': 'http://trac.webkit.org/browser/trunk/PerformanceTests/Bindin
gs/event-target-wrapper.html', | 726 'url': 'https://src.chromium.org/viewvc/blink/trunk/PerformanceTests
/Bindings/event-target-wrapper.html', |
727 'metrics': {'Time': {'current': [[1486.0, 1471.0, 1510.0, 1505.0, 14
78.0, 1490.0]] * 4}}}) | 727 'metrics': {'Time': {'current': [[1486.0, 1471.0, 1510.0, 1505.0, 14
78.0, 1490.0]] * 4}}}) |
728 | 728 |
729 def test_run_with_repeat(self): | 729 def test_run_with_repeat(self): |
730 self.maxDiff = None | 730 self.maxDiff = None |
731 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', | 731 runner, port = self.create_runner_and_setup_results_template(args=['--ou
tput-json-path=/mock-checkout/output.json', |
732 '--test-results-server=some.host', '--repeat', '5']) | 732 '--test-results-server=some.host', '--repeat', '5']) |
733 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True, repeat=5) | 733 self._test_run_with_json_output(runner, port.host.filesystem, upload_suc
ceeds=True, repeat=5) |
734 self.assertEqual(self._load_output_json(runner), [ | 734 self.assertEqual(self._load_output_json(runner), [ |
735 {"buildTime": "2013-02-08T15:19:37.460000", | 735 {"buildTime": "2013-02-08T15:19:37.460000", |
736 "tests": self._event_target_wrapper_and_inspector_results, | 736 "tests": self._event_target_wrapper_and_inspector_results, |
(...skipping 17 matching lines...) Expand all Loading... |
754 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) | 754 self._test_run_with_json_output(runner, port.host.filesystem, compare_lo
gs=False) |
755 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) | 755 generated_json = json.loads(port.host.filesystem.files['/mock-checkout/o
utput.json']) |
756 self.assertTrue(isinstance(generated_json, list)) | 756 self.assertTrue(isinstance(generated_json, list)) |
757 self.assertEqual(len(generated_json), 1) | 757 self.assertEqual(len(generated_json), 1) |
758 | 758 |
759 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] | 759 output = generated_json[0]['tests']['Bindings']['tests']['event-target-w
rapper']['metrics']['Time']['current'] |
760 self.assertEqual(len(output), 3) | 760 self.assertEqual(len(output), 3) |
761 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] | 761 expectedMetrics = EventTargetWrapperTestData.results['metrics']['Time'][
'current'][0] |
762 for metrics in output: | 762 for metrics in output: |
763 self.assertEqual(metrics, expectedMetrics) | 763 self.assertEqual(metrics, expectedMetrics) |
OLD | NEW |