Changeset 113356 in webkit


Ignore:
Timestamp:
Apr 5, 2012 12:32:27 PM (12 years ago)
Author:
rniwa@webkit.org
Message:

perf-o-matic should include unit in runs JSON responses
https://bugs.webkit.org/show_bug.cgi?id=83294

Reviewed by Tony Chang.

This is a follow up to r112829. Report the unit in /api/test/runs so that the frontend can show it.
Fixed a bug in Test.update_or_insert that it didn't store the unit when it first created the Test object.

Also increment perf-o-matic's version to 18.

  • Websites/webkit-perf.appspot.com/app.yaml: Incremented the version.
  • Websites/webkit-perf.appspot.com/models.py:

(Test.update_or_insert.execute): Store unit when creating a test.
(Runs.to_json): Include unit.

  • Websites/webkit-perf.appspot.com/models_unittest.py: Added tests.

(TestModelTests.test_update_or_insert_with_unit):
(RunsTest.test_to_json_without_results):
(RunsTest.test_to_json_with_results):
(RunsTest.test_to_json_with_unit):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r113329 r113356  
     12012-04-05  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        perf-o-matic should include unit in runs JSON responses
     4        https://bugs.webkit.org/show_bug.cgi?id=83294
     5
     6        Reviewed by Tony Chang.
     7
     8        This is a follow up to r112829. Report the unit in /api/test/runs so that the frontend can show it.
     9        Fixed a bug in Test.update_or_insert that it didn't store the unit when it first created the Test object.
     10
     11        Also increment perf-o-matic's version to 18.
     12
     13        * Websites/webkit-perf.appspot.com/app.yaml: Incremented the version.
     14        * Websites/webkit-perf.appspot.com/models.py:
     15        (Test.update_or_insert.execute): Store unit when creating a test.
     16        (Runs.to_json): Include unit.
     17        * Websites/webkit-perf.appspot.com/models_unittest.py: Added tests.
     18        (TestModelTests.test_update_or_insert_with_unit):
     19        (RunsTest.test_to_json_without_results):
     20        (RunsTest.test_to_json_with_results):
     21        (RunsTest.test_to_json_with_unit):
     22
    1232012-03-14  Antonio Gomes  <agomes@rim.com>
    224
  • trunk/Websites/webkit-perf.appspot.com/app.yaml

    r112823 r113356  
    11application: webkit-perf
    2 version: 17
     2version: 18
    33runtime: python27
    44api_version: 1
  • trunk/Websites/webkit-perf.appspot.com/models.py

    r112829 r113356  
    168168                return None
    169169
    170             test = Test(id=id, name=test_name, key_name=test_name, branches=[branch.key()], platforms=[platform.key()])
     170            test = Test(id=id, name=test_name, key_name=test_name, unit=unit, branches=[branch.key()], platforms=[platform.key()])
    171171            test.put()
    172172            return test
     
    449449    def to_json(self):
    450450        # date_range is never used by common.js.
    451         return '{"test_runs": [%s], "averages": {%s}, "min": %s, "max": %s, "date_range": null, "stat": "ok"}' % (self.json_runs,
    452             self.json_averages, str(self.json_min) if self.json_min else 'null', str(self.json_max) if self.json_max else 'null')
     451        return '{"test_runs": [%s], "averages": {%s}, "min": %s, "max": %s, "unit": %s, "date_range": null, "stat": "ok"}' % (self.json_runs,
     452            self.json_averages, str(self.json_min) if self.json_min else 'null', str(self.json_max) if self.json_max else 'null',
     453            '"%s"' % self.test.unit if self.test.unit else 'null')
    453454
    454455    def chart_params(self, display_days, now=datetime.now().replace(hour=12, minute=0, second=0, microsecond=0)):
  • trunk/Websites/webkit-perf.appspot.com/models_unittest.py

    r112829 r113356  
    269269        self.assertOnlyInstance(test)
    270270
     271    def test_update_or_insert_with_unit(self):
     272        branch = Branch.create_if_possible('some-branch', 'Some Branch')
     273        platform = Platform.create_if_possible('some-platform', 'Some Platform')
     274        test = Test.update_or_insert('some-test', branch, platform, 'runs/s')
     275        self.assertOnlyInstance(test)
     276        self.assertEqualUnorderedList(test.unit, 'runs/s')
     277
    271278    def test_update_or_insert_to_update(self):
    272279        branch = Branch.create_if_possible('some-branch', 'Some Branch')
     
    661668            'min': None,
    662669            'max': None,
     670            'unit': None,
    663671            'date_range': None,
    664672            'stat': 'ok'})
     
    672680
    673681        value = json.loads(Runs.update_or_insert(some_branch, some_platform, some_test).to_json())
    674         self.assertEqualUnorderedList(value.keys(), ['test_runs', 'averages', 'min', 'max', 'date_range', 'stat'])
     682        self.assertEqualUnorderedList(value.keys(), ['test_runs', 'averages', 'min', 'max', 'unit', 'date_range', 'stat'])
    675683        self.assertEqual(value['stat'], 'ok')
    676684        self.assertEqual(value['min'], 48.0)
    677685        self.assertEqual(value['max'], 52.0)
     686        self.assertEqual(value['unit'], None)
    678687        self.assertEqual(value['date_range'], None)  # date_range is never given
    679688
     
    689698            self.assertEqual(run[7], None)  # Statistics
    690699
     700    def test_to_json_with_unit(self):
     701        some_branch = Branch.create_if_possible('some-branch', 'Some Branch')
     702        some_platform = Platform.create_if_possible('some-platform', 'Some Platform')
     703        some_builder = Builder.get(Builder.create('some-builder', 'Some Builder'))
     704        some_test = Test.update_or_insert('some-test', some_branch, some_platform, 'runs/s')
     705        builds, results = self._create_results(some_branch, some_platform, some_builder, 'some-test', [50.0, 51.0, 52.0, 49.0, 48.0])
     706
     707        value = json.loads(Runs.update_or_insert(some_branch, some_platform, some_test).to_json())
     708        self.assertEqual(value['unit'], 'runs/s')
     709
    691710    def _assert_entry(self, entry, build, result, value, statistics=None, supplementary_revisions=None):
    692711        entry = entry[:]
Note: See TracChangeset for help on using the changeset viewer.