Changeset 128511 in webkit
- Timestamp:
- Sep 13, 2012 2:51:59 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r128507 r128511 1 2012-09-13 Ryosuke Niwa <rniwa@webkit.org> 2 3 run-perf-tests output cryptic error when the config file is missing. 4 https://bugs.webkit.org/show_bug.cgi?id=96453 5 6 Reviewed by Tony Chang. 7 8 Add a special error message when a configuration file is missing. 9 10 Also update the help message of --source-json-path to signify the fact it specifies 11 the configuration file on performance tests bots. 12 13 * Scripts/webkitpy/performance_tests/perftestsrunner.py: 14 (PerfTestsRunner._parse_args): 15 (PerfTestsRunner._generate_and_show_results): 16 (PerfTestsRunner._merge_slave_config_json): 17 * Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py: 18 (_test_run_with_json_output): Make upload to fail by default and assert the result 19 in the function so that we can return logs instead. 20 (_test_run_with_json_output.mock_upload_json): 21 (test_run_with_json_output): 22 (test_run_with_description): 23 (test_run_respects_no_results): 24 (test_run_with_slave_config_json): 25 (test_run_with_bad_slave_config_json): 26 (test_run_with_multiple_repositories): 27 1 28 2012-09-13 Kenneth Rohde Christiansen <kenneth@webkit.org> 2 29 -
trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
r125332 r128511 101 101 optparse.make_option("--output-json-path", 102 102 help="Path to generate a JSON file at; may contain previous results if it already exists."), 103 optparse.make_option("--source-json-path", 104 help="Only used on bots. Path to a JSON file to be merged into the JSON file when --output-json-path is present."),103 optparse.make_option("--source-json-path", # FIXME: Rename it to signify the fact it's a slave configuration. 104 help="Only used on bots. Path to a slave configuration file."), 105 105 optparse.make_option("--description", 106 106 help="Add a description to the output JSON file if one is generated"), … … 181 181 182 182 if options.source_json_path: 183 output = self._merge_s ource_json(options.source_json_path, output)183 output = self._merge_slave_config_json(options.source_json_path, output) 184 184 if not output: 185 185 return self.EXIT_CODE_BAD_SOURCE_JSON … … 216 216 return contents 217 217 218 def _merge_source_json(self, source_json_path, output): 218 def _merge_slave_config_json(self, slave_config_json_path, output): 219 if not self._host.filesystem.isfile(slave_config_json_path): 220 _log.error("Missing slave configuration JSON file: %s" % slave_config_json_path) 221 return None 222 219 223 try: 220 s ource_json_file = self._host.filesystem.open_text_file_for_reading(source_json_path)221 s ource_json = json.load(source_json_file)222 return dict(s ource_json.items() + output.items())224 slave_config_json = self._host.filesystem.open_text_file_for_reading(slave_config_json_path) 225 slave_config = json.load(slave_config_json) 226 return dict(slave_config.items() + output.items()) 223 227 except Exception, error: 224 _log.error("Failed to merge s ource JSON file %s: %s" % (source_json_path, error))228 _log.error("Failed to merge slave configuration JSON file %s: %s" % (slave_config_json_path, error)) 225 229 return None 226 230 -
trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py
r125812 r128511 283 283 self.assertEqual(results['Parser/memory-test:Malloc'], {'min': 511000.0, 'max': 548000.0, 'median': 529000.0, 'stdev': 13000.0, 'avg': 532000.0, 'unit': 'bytes'}) 284 284 285 def _test_run_with_json_output(self, runner, filesystem, upload_suceeds= True, expected_exit_code=0):285 def _test_run_with_json_output(self, runner, filesystem, upload_suceeds=False, expected_exit_code=0): 286 286 filesystem.write_text_file(runner._base_path + '/inspector/pass.html', 'some content') 287 287 filesystem.write_text_file(runner._base_path + '/Bindings/event-target-wrapper.html', 'some content') … … 292 292 self.assertEqual(hostname, 'some.host') 293 293 self.assertEqual(json_path, '/mock-checkout/output.json') 294 uploaded[0] = True294 uploaded[0] = upload_suceeds 295 295 return upload_suceeds 296 296 … … 316 316 ''])) 317 317 318 return uploaded[0] 318 self.assertEqual(uploaded[0], upload_suceeds) 319 320 return logs 319 321 320 322 _event_target_wrapper_and_inspector_results = { … … 325 327 runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', 326 328 '--test-results-server=some.host']) 327 self._test_run_with_json_output(runner, port.host.filesystem )329 self._test_run_with_json_output(runner, port.host.filesystem, upload_suceeds=True) 328 330 self.assertEqual(runner.load_output_json(), { 329 331 "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results, … … 333 335 runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', 334 336 '--test-results-server=some.host', '--description', 'some description']) 335 self._test_run_with_json_output(runner, port.host.filesystem )337 self._test_run_with_json_output(runner, port.host.filesystem, upload_suceeds=True) 336 338 self.assertEqual(runner.load_output_json(), { 337 339 "timestamp": 123456789, "description": "some description", … … 351 353 runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', 352 354 '--test-results-server=some.host', '--no-results']) 353 self. assertFalse(self._test_run_with_json_output(runner, port.host.filesystem))355 self._test_run_with_json_output(runner, port.host.filesystem, upload_suceeds=False) 354 356 self.assertFalse(port.host.filesystem.isfile('/mock-checkout/output.json')) 355 357 … … 420 422 self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_MERGE) 421 423 422 def test_run_with_ json_source(self):423 runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', 424 '--source-json-path=/mock-checkout/s ource.json', '--test-results-server=some.host'])425 port.host.filesystem.write_text_file('/mock-checkout/s ource.json', '{"key": "value"}')426 self._test_run_with_json_output(runner, port.host.filesystem )424 def test_run_with_slave_config_json(self): 425 runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', 426 '--source-json-path=/mock-checkout/slave-config.json', '--test-results-server=some.host']) 427 port.host.filesystem.write_text_file('/mock-checkout/slave-config.json', '{"key": "value"}') 428 self._test_run_with_json_output(runner, port.host.filesystem, upload_suceeds=True) 427 429 self.assertEqual(runner.load_output_json(), { 428 430 "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results, 429 431 "webkit-revision": "5678", "branch": "webkit-trunk", "key": "value"}) 430 432 431 def test_run_with_bad_json_source(self): 432 runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', 433 '--source-json-path=/mock-checkout/source.json', '--test-results-server=some.host']) 433 def test_run_with_bad_slave_config_json(self): 434 runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json', 435 '--source-json-path=/mock-checkout/slave-config.json', '--test-results-server=some.host']) 436 logs = self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_SOURCE_JSON) 437 self.assertTrue('Missing slave configuration JSON file: /mock-checkout/slave-config.json' in logs) 438 port.host.filesystem.write_text_file('/mock-checkout/slave-config.json', 'bad json') 434 439 self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_SOURCE_JSON) 435 port.host.filesystem.write_text_file('/mock-checkout/source.json', 'bad json') 436 self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_SOURCE_JSON) 437 port.host.filesystem.write_text_file('/mock-checkout/source.json', '["another bad json"]') 440 port.host.filesystem.write_text_file('/mock-checkout/slave-config.json', '["another bad json"]') 438 441 self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_SOURCE_JSON) 439 442 … … 442 445 '--test-results-server=some.host']) 443 446 port.repository_paths = lambda: [('webkit', '/mock-checkout'), ('some', '/mock-checkout/some')] 444 self._test_run_with_json_output(runner, port.host.filesystem )447 self._test_run_with_json_output(runner, port.host.filesystem, upload_suceeds=True) 445 448 self.assertEqual(runner.load_output_json(), { 446 449 "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results,
Note: See TracChangeset
for help on using the changeset viewer.