Extend sunspider driver to be able to run kraken
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Nov 2011 21:03:52 +0000 (21:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Nov 2011 21:03:52 +0000 (21:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=71799

Patch by Andy Wingo <wingo@igalia.com> on 2011-11-15
Reviewed by Filip Pizlo.

* resources/sunspider-standalone-driver.js: Try to load a -data
file.  If that succeeds, we have a kraken-like test, so we time
the test using `load'.  Otherwise fall back to using `run'.

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

PerformanceTests/SunSpider/ChangeLog
PerformanceTests/SunSpider/resources/sunspider-standalone-driver.js

index ace665f..d85348e 100644 (file)
@@ -1,3 +1,14 @@
+2011-11-15  Andy Wingo  <wingo@igalia.com>
+
+        Extend sunspider driver to be able to run kraken
+        https://bugs.webkit.org/show_bug.cgi?id=71799
+
+        Reviewed by Filip Pizlo.
+
+        * resources/sunspider-standalone-driver.js: Try to load a -data
+        file.  If that succeeds, we have a kraken-like test, so we time
+        the test using `load'.  Otherwise fall back to using `run'.
+
 2011-08-11  Mark Rowe  <mrowe@apple.com>
 
         Fix sunspider-compare-results to default to the same suite version as the sunspider script.
index 136e6b7..e6686f1 100644 (file)
@@ -32,12 +32,28 @@ var times = [];
 times.length = tests.length;
 
 for (var j = 0; j < tests.length; j++) {
-    var testName = suitePath + "/" + tests[j] + ".js";
-    var startTime = new Date;
-    if (testName.indexOf('parse-only') >= 0)
+    var testBase = suitePath + "/" + tests[j];
+    var testName = testBase + ".js";
+    var testData = testBase + "-data.js";
+
+    if (testName.indexOf('parse-only') >= 0) {
         times[j] = checkSyntax(testName);
-    else
-        times[j] = run(testName);
+    } else {
+        // Tests may or may not have associated -data files whose loading
+        // should not be timed.
+        try {
+            load(testData);
+            // If a file does have test data, then we can't use the
+            // higher-precision `run' timer, because `run' uses a fresh
+            // global environment, so we fall back to `load'.
+            var startTime = new Date;
+            load(testName);
+            times[j] = new Date() - startTime;
+        } catch (e) {
+            // No test data, just use `run'.
+            times[j] = run(testName);
+        }
+    }
     gc();
 }