[PerformanceTests] Add landing html for Dromaeo dom-query test
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jan 2012 10:13:51 +0000 (10:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Jan 2012 10:13:51 +0000 (10:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77329

Patch by Hajime Morrita <morrita@chromium.org> on 2012-01-31
Reviewed by Ryosuke Niwa.

PerformanceTests:

Added a "landing html" which includes actual dromaemo page and
send messages to interact with it. The landing html also dumps the
score in run-perf-tests friendly format.

This test isn't enabled until Dromaemo itself is available for run-perf-tests.
It will happen in a separate change.

* Dromaeo/dom-query.html: Added.
* Dromaeo/resources/dromaeorunner.js: Added.
* Skipped: Skipping this for now.

Tools:

Added some more ignorable output patterns to allow warnings
from a third party test suite.

* Scripts/webkitpy/performance_tests/perftestsrunner.py:
(PerfTestsRunner):
(PerfTestsRunner._should_ignore_line_in_parser_test_result):

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

PerformanceTests/ChangeLog
PerformanceTests/Dromaeo/dom-query.html [new file with mode: 0644]
PerformanceTests/Dromaeo/resources/dromaeorunner.js [new file with mode: 0644]
PerformanceTests/Skipped
PerformanceTests/resources/runner.js
Tools/ChangeLog
Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py

index b60d8a0..ccebae4 100644 (file)
@@ -1,3 +1,21 @@
+2012-01-31  Hajime Morrita  <morrita@chromium.org>
+
+        [PerformanceTests] Add landing html for Dromaeo dom-query test
+        https://bugs.webkit.org/show_bug.cgi?id=77329
+
+        Reviewed by Ryosuke Niwa.
+
+        Added a "landing html" which includes actual dromaemo page and
+        send messages to interact with it. The landing html also dumps the
+        score in run-perf-tests friendly format.
+
+        This test isn't enabled until Dromaemo itself is available for run-perf-tests.
+        It will happen in a separate change.
+
+        * Dromaeo/dom-query.html: Added.
+        * Dromaeo/resources/dromaeorunner.js: Added.
+        * Skipped: Skipping this for now.
+
 2012-01-30  Ryosuke Niwa  <rniwa@webkit.org>
 
         Skip inspector tests since they have been timing out.
diff --git a/PerformanceTests/Dromaeo/dom-query.html b/PerformanceTests/Dromaeo/dom-query.html
new file mode 100644 (file)
index 0000000..5743a06
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/runner.js"></script>
+<script src="resources/dromaeo/web/jquery.js"></script>
+<script src="resources/dromaeorunner.js"></script>
+<script>
+$(document).ready(function() {
+    DRT.setup("dom-query");
+});
+</script>
+</head>
+<body>
+<pre id="console"></pre>
+</body>
+</html>
diff --git a/PerformanceTests/Dromaeo/resources/dromaeorunner.js b/PerformanceTests/Dromaeo/resources/dromaeorunner.js
new file mode 100644 (file)
index 0000000..aac3c56
--- /dev/null
@@ -0,0 +1,89 @@
+(function(){
+     var DRT  = {
+         baseURL: "./resources/dromaeo/web/index.html",
+
+         computeScores: function (results) {
+             var avg = 0, min = 0, max = 0, stdev = 0, varsum = 0;
+
+             for (var i = 0; i < results.length; ++i) {
+                 var item = results[i];
+                 avg += item.mean;
+                 min += item.min;
+                 max += item.max;
+                 varsum += item.deviation * item.deviation;
+             }
+
+             return {
+                 median: 0,
+                 avg: avg,
+                 min: min,
+                 max: max,
+                 stdev: Math.sqrt(varsum)
+             };
+         },
+
+         setup: function(testName) {
+             var iframe = document.createElement("iframe");
+             var url = DRT.baseURL + "?" + testName;
+             iframe.setAttribute("src", url);
+             document.body.appendChild(iframe);
+             iframe.addEventListener(
+                 "load", function() {
+                     DRT.targetDocument = iframe.contentDocument;
+                     DRT.targetWindow = iframe.contentDocument.defaultView;
+                 });
+             
+             window.addEventListener(
+                 "message",
+                 function(event) {
+                     switch(event.data.name) {
+                     case "dromaeo:ready":
+                         DRT.start();
+                         break;
+                     case "dromaeo:progress":
+                         DRT.progress(event.data);
+                         break;
+                     case "dromaeo:alldone":
+                         DRT.teardown(event.data);
+                         break;
+                     }
+                 });
+         },
+
+         start: function() {
+             DRT.targetWindow.postMessage({ name: "dromaeo:start" } , "*");
+         },
+
+         progress: function(message) {
+             if (message.status.score)
+                 DRT.log(message.status.score.mean);
+         },
+
+         teardown: function(data) {
+             var scores = DRT.computeScores(data.result);
+             printStatistics(scores, DRT.log);
+             window.setTimeout(function() {
+                 if (window.layoutTestController)
+                     layoutTestController.notifyDone();
+             }, 0);
+         },
+
+         targetDelegateOf: function(functionName) {
+             return function() {
+                 DRT.targetWindow[functionName].apply(null, arguments);
+             };
+         },
+
+         log: function(text) {
+             document.getElementById("console").innerHTML += (text + "\n");
+         }
+     };
+
+     // These functions are referred from htmlrunner.js
+     this.startTest = DRT.targetDelegateOf("startTest");
+     this.test = DRT.targetDelegateOf("test");
+     this.endTest = DRT.targetDelegateOf("endTest");
+     this.prep = DRT.targetDelegateOf("prep");
+
+     window.DRT = DRT;
+ })();
\ No newline at end of file
index 0c0e87d..05f4745 100644 (file)
@@ -6,6 +6,9 @@ Layout
 PageLoad
 SunSpider
 XSSAuditor
+# Blocked by http://webkit.org/b/77328
+Dromaeo
 
 # Bug 77024 - Web Inspector: tests in PerformanceTests/inspector/ are timing out
 inspector
+
index fb479e4..24fff9a 100644 (file)
@@ -63,13 +63,24 @@ function computeStdev(values) {
     return Math.sqrt(sumOfSquaredDeviations / values.length);
 }
 
+function printStatistics(stats, printFunction)
+{
+    printFunction("");
+    printFunction("avg " + stats.avg);
+    printFunction("median " + stats.median);
+    printFunction("stdev " + stats.stdev);
+    printFunction("min " + stats.min);
+    printFunction("max " + stats.max);
+}
+
 function logStatistics(times) {
-    log("");
-    log("avg " + computeAverage(times));
-    log("median " + computeMedian(times));
-    log("stdev " + computeStdev(times));
-    log("min " + computeMin(times));
-    log("max " + computeMax(times));
+    printStatistics({
+        avg: computeAverage(times),
+        median: computeMedian(times),
+        stdev: computeStdev(times),
+        min: computeMin(times),
+        max: computeMax(times)
+    }, log);
 }
 
 function gc() {
index cf44136..72f0b04 100644 (file)
@@ -1,3 +1,17 @@
+2012-01-31  Hajime Morrita  <morrita@chromium.org>
+
+        [PerformanceTests] Add landing html for Dromaeo dom-query test
+        https://bugs.webkit.org/show_bug.cgi?id=77329
+
+        Reviewed by Ryosuke Niwa.
+
+        Added some more ignorable output patterns to allow warnings
+        from a third party test suite.
+
+        * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+        (PerfTestsRunner):
+        (PerfTestsRunner._should_ignore_line_in_parser_test_result):
+
 2012-01-30  Kevin Ollivier  <kevino@theolliviers.com>
 
         [wx] Unreviewed. Update download URLs to new domain.
index eb94550..3ae3792 100644 (file)
@@ -250,13 +250,15 @@ class PerfTestsRunner(object):
         re.compile(r'^Running \d+ times$'),
         re.compile(r'^Ignoring warm-up '),
         re.compile(r'^\d+(.\d+)?$'),
-    ]
+        # Following are for handle existing test like Dromaeo
+        re.compile(re.escape("""main frame - has 1 onunload handler(s)""")),
+        re.compile(re.escape("""frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)"""))]
 
     def _should_ignore_line_in_parser_test_result(self, line):
         if not line:
             return True
         for regex in self._lines_to_ignore_in_parser_result:
-            if regex.match(line):
+            if regex.search(line):
                 return True
         return False