Changeset 128511 in webkit


Ignore:
Timestamp:
Sep 13, 2012 2:51:59 PM (12 years ago)
Author:
rniwa@webkit.org
Message:

run-perf-tests output cryptic error when the config file is missing.
https://bugs.webkit.org/show_bug.cgi?id=96453

Reviewed by Tony Chang.

Add a special error message when a configuration file is missing.

Also update the help message of --source-json-path to signify the fact it specifies
the configuration file on performance tests bots.

  • Scripts/webkitpy/performance_tests/perftestsrunner.py:

(PerfTestsRunner._parse_args):
(PerfTestsRunner._generate_and_show_results):
(PerfTestsRunner._merge_slave_config_json):

  • Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:

(_test_run_with_json_output): Make upload to fail by default and assert the result
in the function so that we can return logs instead.
(_test_run_with_json_output.mock_upload_json):
(test_run_with_json_output):
(test_run_with_description):
(test_run_respects_no_results):
(test_run_with_slave_config_json):
(test_run_with_bad_slave_config_json):
(test_run_with_multiple_repositories):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r128507 r128511  
     12012-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
    1282012-09-13  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    229
  • trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py

    r125332 r128511  
    101101            optparse.make_option("--output-json-path",
    102102                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."),
    105105            optparse.make_option("--description",
    106106                help="Add a description to the output JSON file if one is generated"),
     
    181181
    182182        if options.source_json_path:
    183             output = self._merge_source_json(options.source_json_path, output)
     183            output = self._merge_slave_config_json(options.source_json_path, output)
    184184            if not output:
    185185                return self.EXIT_CODE_BAD_SOURCE_JSON
     
    216216        return contents
    217217
    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
    219223        try:
    220             source_json_file = self._host.filesystem.open_text_file_for_reading(source_json_path)
    221             source_json = json.load(source_json_file)
    222             return dict(source_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())
    223227        except Exception, error:
    224             _log.error("Failed to merge source 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))
    225229        return None
    226230
  • trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py

    r125812 r128511  
    283283        self.assertEqual(results['Parser/memory-test:Malloc'], {'min': 511000.0, 'max': 548000.0, 'median': 529000.0, 'stdev': 13000.0, 'avg': 532000.0, 'unit': 'bytes'})
    284284
    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):
    286286        filesystem.write_text_file(runner._base_path + '/inspector/pass.html', 'some content')
    287287        filesystem.write_text_file(runner._base_path + '/Bindings/event-target-wrapper.html', 'some content')
     
    292292            self.assertEqual(hostname, 'some.host')
    293293            self.assertEqual(json_path, '/mock-checkout/output.json')
    294             uploaded[0] = True
     294            uploaded[0] = upload_suceeds
    295295            return upload_suceeds
    296296
     
    316316                '']))
    317317
    318         return uploaded[0]
     318        self.assertEqual(uploaded[0], upload_suceeds)
     319
     320        return logs
    319321
    320322    _event_target_wrapper_and_inspector_results = {
     
    325327        runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json',
    326328            '--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)
    328330        self.assertEqual(runner.load_output_json(), {
    329331            "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results,
     
    333335        runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json',
    334336            '--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)
    336338        self.assertEqual(runner.load_output_json(), {
    337339            "timestamp": 123456789, "description": "some description",
     
    351353        runner, port = self.create_runner(args=['--output-json-path=/mock-checkout/output.json',
    352354            '--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)
    354356        self.assertFalse(port.host.filesystem.isfile('/mock-checkout/output.json'))
    355357
     
    420422        self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_MERGE)
    421423
    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/source.json', '--test-results-server=some.host'])
    425         port.host.filesystem.write_text_file('/mock-checkout/source.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)
    427429        self.assertEqual(runner.load_output_json(), {
    428430            "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results,
    429431            "webkit-revision": "5678", "branch": "webkit-trunk", "key": "value"})
    430432
    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')
    434439        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"]')
    438441        self._test_run_with_json_output(runner, port.host.filesystem, expected_exit_code=PerfTestsRunner.EXIT_CODE_BAD_SOURCE_JSON)
    439442
     
    442445            '--test-results-server=some.host'])
    443446        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)
    445448        self.assertEqual(runner.load_output_json(), {
    446449            "timestamp": 123456789, "results": self._event_target_wrapper_and_inspector_results,
Note: See TracChangeset for help on using the changeset viewer.