run-benchmark should either checkout JetStream 1.0.1 or support running the latest...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jun 2015 19:29:31 +0000 (19:29 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jun 2015 19:29:31 +0000 (19:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145764

Reviewed by Darin Adler.

Added the support for checkout a subversion directory in run-benchmark and used in the plans for
JetStream and SunSpider.

* Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py:
(GenericBenchmarkBuilder):
(GenericBenchmarkBuilder.prepare): Instead of taking each argument from benchmark plan, just accept
the whole JSON as the input.
(GenericBenchmarkBuilder._checkoutWithSubverion): Added.
(GenericBenchmarkBuilder._applyPatch): Check the existence of benchmark_patch in prepare() instead.
* Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
(BenchmarkRunner.execute): Removed the check for having either 'local_copy' or 'remote_archive' in
a benchmark plan now that it's checkedi in GenericBenchmarkBuilder.prepare.
* Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan:
* Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan:

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

Tools/ChangeLog
Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py
Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py
Tools/Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan
Tools/Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan

index af64edac29809e14726fe3cd81a935232422b7d8..3f9340985038b1ded5036ff5747004f5c943518b 100644 (file)
@@ -1,3 +1,25 @@
+2015-06-09  Ryosuke Niwa  <rniwa@webkit.org>
+
+        run-benchmark should either checkout JetStream 1.0.1 or support running the latest version
+        https://bugs.webkit.org/show_bug.cgi?id=145764
+
+        Reviewed by Darin Adler.
+
+        Added the support for checkout a subversion directory in run-benchmark and used in the plans for
+        JetStream and SunSpider.
+
+        * Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py:
+        (GenericBenchmarkBuilder):
+        (GenericBenchmarkBuilder.prepare): Instead of taking each argument from benchmark plan, just accept
+        the whole JSON as the input.
+        (GenericBenchmarkBuilder._checkoutWithSubverion): Added.
+        (GenericBenchmarkBuilder._applyPatch): Check the existence of benchmark_patch in prepare() instead.
+        * Scripts/webkitpy/benchmark_runner/benchmark_runner.py:
+        (BenchmarkRunner.execute): Removed the check for having either 'local_copy' or 'remote_archive' in
+        a benchmark plan now that it's checkedi in GenericBenchmarkBuilder.prepare.
+        * Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan:
+        * Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan:
+
 2015-06-09  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Remove ewstool scripts used by chromium port
index f10251ebb6074c87f1d90852094ecf649b0f1b1f..0e0ac36918185d77fb3d35a95cfcbb021e0c0827 100644 (file)
@@ -16,21 +16,26 @@ _log = logging.getLogger(__name__)
 
 class GenericBenchmarkBuilder(object):
 
-    def prepare(self, name, benchmarkPath, archiveURL, patch, createScript):
+    def prepare(self, name, plan):
         self.name = name
         self.webRoot = tempfile.mkdtemp()
         self.dest = os.path.join(self.webRoot, self.name)
-        if benchmarkPath:
-            self._copyBenchmarkToTempDir(benchmarkPath)
+        if 'local_copy' in plan:
+            self._copyBenchmarkToTempDir(plan['local_copy'])
+        elif 'remote_archive' in plan:
+            self._fetchRemoteArchive(plan['remote_archive'])
+        elif 'svn_source' in plan:
+            self._checkoutWithSubverion(plan['svn_source'])
         else:
-            assert(archiveURL)
-            self._fetchRemoteArchive(archiveURL)
+            raise Exception('The benchmark location was not specified')
 
         _log.info('Copied the benchmark into: %s' % self.dest)
         try:
-            if createScript:
-                self._runCreateScript(createScript)
-            return self._applyPatch(patch)
+            if 'create_script' in plan:
+                self._runCreateScript(plan['create_script'])
+            if 'benchmark_patch' in plan:
+                self._applyPatch(plan['benchmark_patch'])
+            return self.webRoot
         except Exception:
             self.clean()
             raise
@@ -62,16 +67,19 @@ class GenericBenchmarkBuilder(object):
                 shutil.move(firstFile, self.webRoot)
                 os.rename(os.path.join(self.webRoot, unarchivedFiles[0]), self.dest)
 
+    def _checkoutWithSubverion(self, subversionURL):
+        _log.info('Checking out %s to %s' % (subversionURL, self.dest))
+        errorCode = subprocess.call(['svn', 'checkout', subversionURL, self.dest])
+        if errorCode:
+            raise Exception('Cannot checkout the benchmark - Error: %s' % errorCode)
+
     def _applyPatch(self, patch):
-        if not patch:
-            return self.webRoot
         oldWorkingDirectory = os.getcwd()
         os.chdir(self.dest)
         errorCode = subprocess.call(['patch', '-p1', '-f', '-i', getPathFromProjectRoot(patch)])
         os.chdir(oldWorkingDirectory)
         if errorCode:
             raise Exception('Cannot apply patch, will skip current benchmarkPath - Error: %s' % errorCode)
-        return self.webRoot
 
     def clean(self):
         _log.info('Cleaning Benchmark')
index ff3712541fa2153b1fc6566daf5d085aa2e8973d..bb1db611068861e4ec182b20964c17535f812e01 100644 (file)
@@ -64,12 +64,7 @@ class BenchmarkRunner(object):
         results = []
         self.benchmarkBuilder = BenchmarkBuilderFactory.create([self.plan['benchmark_builder']])
 
-        if not self.plan.get('local_copy') and not self.plan.get('remote_archive'):
-            _log.error('Either local_copy or remote_archive must be specified in the plan')
-            sys.exit(2)
-
-        webRoot = self.benchmarkBuilder.prepare(self.planName, self.plan.get('local_copy'), self.plan.get('remote_archive'),
-            self.plan.get('benchmark_patch'), self.plan.get('create_script'))
+        webRoot = self.benchmarkBuilder.prepare(self.planName, self.plan)
         for x in xrange(int(self.plan['count'])):
             _log.info('Start the iteration %d of current benchmark' % (x + 1))
             self.httpServerDriver.serve(webRoot)
index a9498c53526be3ea99a287ce459f080c2aea391f..4b2f0ba38d1528220a33b0a94ca17f95f5bab829 100644 (file)
@@ -3,7 +3,7 @@
     "timeout" : 600,
     "count": 5,
     "benchmark_builder": "GenericBenchmarkBuilder",
-    "local_copy": "../../../../PerformanceTests/JetStream",
+    "svn_source": "https://svn.webkit.org/repository/webkit/trunk/PerformanceTests/JetStream/@r183091",
     "benchmark_patch": "data/patches/JetStream.patch",
     "create_script": ["ruby", "create.rb"],
     "entry_point": "JetStream-1.0.1/index.html",
index 06bae388fd0d9222e6850272c8dacd9144ee332a..f089d9df2a177632b295b75449d835f9486f3153 100644 (file)
@@ -3,7 +3,7 @@
     "timeout": 300,
     "count": 5,
     "benchmark_builder": "GenericBenchmarkBuilder",
-    "local_copy": "../../../../PerformanceTests/SunSpider",
+    "svn_source": "https://svn.webkit.org/repository/webkit/trunk/PerformanceTests/SunSpider/@r182170",
     "benchmark_patch": "data/patches/SunSpider.patch",
     "create_script": ["perl", "make-hosted"],
     "entry_point": "hosted/sunspider-1.0.1/driver.html",