webkit-perf.appspot.com should have an ability to merge tests
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jan 2012 23:06:39 +0000 (23:06 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jan 2012 23:06:39 +0000 (23:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77250

Reviewed by Adam Barth.

Added admin/merge-tests. This page allows administrators to easily merge test objects.

Also add the forgotten title.png and rename api/create to admin/create since we don't allow
non-admins to create new models anyway.

* Websites/webkit-perf.appspot.com/app.yaml:
* Websites/webkit-perf.appspot.com/css: Added.
* Websites/webkit-perf.appspot.com/css/title.png: Added.
* Websites/webkit-perf.appspot.com/main.py:
* Websites/webkit-perf.appspot.com/merge_tests.yaml: Added.
* Websites/webkit-perf.appspot.com/merge_tests_handler.py: Added.
(MergeTestHandler):
(MergeTestHandler.get):
(MergeTestHandler.post):
* Websites/webkit-perf.appspot.com/models.py:
(deleteModelWithNumericIdHolder):
* Websites/webkit-perf.appspot.com/static/create-models.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106292 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Websites/webkit-perf.appspot.com/app.yaml
Websites/webkit-perf.appspot.com/css/title.png [new file with mode: 0644]
Websites/webkit-perf.appspot.com/main.py
Websites/webkit-perf.appspot.com/merge_tests.yaml [new file with mode: 0644]
Websites/webkit-perf.appspot.com/merge_tests_handler.py [new file with mode: 0644]
Websites/webkit-perf.appspot.com/models.py
Websites/webkit-perf.appspot.com/static/create-models.html
Websites/webkit-perf.appspot.com/static/manual-submit.html

index a993e0d7c50cecbad6bc7f9aa18464b950991441..9429755d742c169202dea22b42efbc8c1b76d57a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2012-01-30  Ryosuke Niwa  <rniwa@webkit.org>
+
+        webkit-perf.appspot.com should have an ability to merge tests
+        https://bugs.webkit.org/show_bug.cgi?id=77250
+
+        Reviewed by Adam Barth.
+
+        Added admin/merge-tests. This page allows administrators to easily merge test objects.
+
+        Also add the forgotten title.png and rename api/create to admin/create since we don't allow
+        non-admins to create new models anyway.
+
+        * Websites/webkit-perf.appspot.com/app.yaml:
+        * Websites/webkit-perf.appspot.com/css: Added.
+        * Websites/webkit-perf.appspot.com/css/title.png: Added.
+        * Websites/webkit-perf.appspot.com/main.py:
+        * Websites/webkit-perf.appspot.com/merge_tests.yaml: Added.
+        * Websites/webkit-perf.appspot.com/merge_tests_handler.py: Added.
+        (MergeTestHandler):
+        (MergeTestHandler.get):
+        (MergeTestHandler.post):
+        * Websites/webkit-perf.appspot.com/models.py:
+        (deleteModelWithNumericIdHolder):
+        * Websites/webkit-perf.appspot.com/static/create-models.html:
+
 2012-01-30  Kenneth Rohde Christiansen  <kenneth@webkit.org>
 
         Add manual tests for tap highlighting
index 060f48a3f9f25980b01a04b4ee8d69f523d38a31..8e2133e204959827e7119fcc39a2f736df45dafa 100644 (file)
@@ -1,5 +1,5 @@
 application: webkit-perf
-version: 8
+version: 9
 runtime: python27
 api_version: 1
 threadsafe: false
@@ -9,7 +9,7 @@ handlers:
   static_files: favicon.ico
   upload: favicon\.ico
 
-- url: /admin/((.+)\.html)
+- url: /admin/(.+\.html)
   static_files: static/\1
   upload: static
   secure: always
@@ -36,12 +36,7 @@ handlers:
   script: main.py
   secure: always
 
-- url: /admin/report
-  script: main.py
-  secure: always
-  login: admin
-
-- url: /api/create/(\w+)
+- url: /admin/
   script: main.py
   secure: always
   login: admin
diff --git a/Websites/webkit-perf.appspot.com/css/title.png b/Websites/webkit-perf.appspot.com/css/title.png
new file mode 100644 (file)
index 0000000..05928f7
Binary files /dev/null and b/Websites/webkit-perf.appspot.com/css/title.png differ
index 76b222dc180e64659a0dfe143b4e0219f85b3679..7536820a11182ba92377ecd24b0d59258fd05fa4 100644 (file)
@@ -26,12 +26,14 @@ from manifest_handler import ManifestHandler
 from report_handler import ReportHandler
 from report_handler import AdminReportHandler
 from runs_handler import RunsHandler
+from merge_tests_handler import MergeTestsHandler
 
 routes = [
-    ('/api/create/(.*)', CreateHandler),
+    ('/admin/report/?', AdminReportHandler),
+    ('/admin/merge-tests/?', MergeTestsHandler),
+    ('/admin/create/(.*)', CreateHandler),
     ('/api/test/?', ManifestHandler),
     ('/api/test/report/?', ReportHandler),
-    ('/admin/report/?', AdminReportHandler),
     ('/api/test/runs/?', RunsHandler),
     ('/api/test/dashboard/?', DashboardHandler),
 ]
diff --git a/Websites/webkit-perf.appspot.com/merge_tests.yaml b/Websites/webkit-perf.appspot.com/merge_tests.yaml
new file mode 100644 (file)
index 0000000..c264650
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<body>
+<h1>Merge tests</h1>
+<form method="post" action="/admin/merge-tests">
+
+<label for="merge">Merge</label>:
+<select id="merge" name="merge">
+{% for test in tests %}
+    <option value="{{ test.name }}">{{ test.name }}</option>
+{% endfor %}
+</select>
+
+<label for="into">Into</label>:
+<select id="into" name="into">
+{% for test in tests %}
+    <option value="{{ test.name }}">{{ test.name }}</option>
+{% endfor %}
+</select>
+
+<button type="submit">Merge</button>
+
+</form>
+</body>
+</html>
diff --git a/Websites/webkit-perf.appspot.com/merge_tests_handler.py b/Websites/webkit-perf.appspot.com/merge_tests_handler.py
new file mode 100644 (file)
index 0000000..ecc7b71
--- /dev/null
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# Copyright (C) 2012 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import webapp2
+from google.appengine.ext.webapp import template
+
+import os
+
+from models import Test
+from models import TestResult
+from models import deleteModelWithNumericIdHolder
+
+
+class MergeTestsHandler(webapp2.RequestHandler):
+    def get(self):
+        self.response.out.write(template.render('merge_tests.yaml', {'tests': Test.all()}))
+
+    def post(self):
+        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8';
+
+        merge = Test.get_by_key_name(self.request.get('merge'))
+        into = Test.get_by_key_name(self.request.get('into'))
+        if not merge or not into:
+            self.response.out.write('Invalid test names')
+            return
+
+        mergedResults = TestResult.all()
+        mergedResults.filter('name =', merge.name)
+        for result in mergedResults:
+            result.name = into.name
+            result.put()
+
+        deleteModelWithNumericIdHolder(merge)
+
+        self.response.out.write('OK')
index da820917812d057514e90e2e9a3efcfe596c002a..43f0fc611c982d5bbdd6e9f5fd490f6b10fd0d56 100644 (file)
@@ -51,6 +51,12 @@ def createInTransactionWithNumericIdHolder(callback):
     return owner
 
 
+def deleteModelWithNumericIdHolder(model):
+    idHolder = NumericIdHolder.get_by_id(model.id)
+    model.delete()
+    idHolder.delete()
+
+
 def modelFromNumericId(id, expectedKind):
     idHolder = NumericIdHolder.get_by_id(id)
     return idHolder.owner if idHolder and idHolder.owner and isinstance(idHolder.owner, expectedKind) else None
index fdf537ac3cd2dc962dc3c2f1e2df568d4471bbce..d8b45076b1b2895a8f555066d7a47414e41d6e39 100644 (file)
@@ -14,21 +14,21 @@ h3 {font-size: 1em;}
 <p>Key: canonicalized name used by build bots and storage. Name: human friendly name</p>
 
 <h2>Builder</h2>
-<form method="post" action="/api/create/builder" onsubmit="return submitByXHR(this, event)">
+<form method="post" action="/admin/create/builder" onsubmit="return submitByXHR(this, event)">
 <label for="name">Name/Key</label><input type="text" name="name">
 <label for="password">Password</label><input type="password" name="password">
 <button type="submit">Create</button>
 </form>
 
 <h2>Branch</h2>
-<form method="post" action="/api/create/branch" onsubmit="return submitByXHR(this, event);">
+<form method="post" action="/admin/create/branch" onsubmit="return submitByXHR(this, event);">
 <label for="key">Key</label><input type="text" name="key">
 <label for="name">Name</label><input type="text" name="name">
 <button type="submit">Create</button>
 </form>
 
 <h2>Platform</h2>
-<form method="post" action="/api/create/platform" onsubmit="return submitByXHR(this, event)">
+<form method="post" action="/admin/create/platform" onsubmit="return submitByXHR(this, event)">
 <label for="key">Key</label><input type="text" name="key">
 <label for="name">Name</label><input type="text" name="name">
 <button type="submit">Create</button>
index fe875b56970208a049a226efd398853149c1d31f..345f0b492233d4113676d69a6e439f3bd20d503d 100644 (file)
@@ -52,7 +52,7 @@ function submit() {
 $('data').value = JSON.stringify({
     'branch': 'webkit-trunk',
     'platform': 'chromium-mac',
-    'builder-name': 'google-mac-2',
+    'builder-name': 'Chromium Mac Release (Perf)',
     'build-number': '123',
     'timestamp': parseInt(Date.now() / 1000),
     'revision': 104856,