Title: [185371] trunk/Tools
Revision
185371
Author
[email protected]
Date
2015-06-09 12:29:31 -0700 (Tue, 09 Jun 2015)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (185370 => 185371)


--- trunk/Tools/ChangeLog	2015-06-09 18:42:46 UTC (rev 185370)
+++ trunk/Tools/ChangeLog	2015-06-09 19:29:31 UTC (rev 185371)
@@ -1,3 +1,25 @@
+2015-06-09  Ryosuke Niwa  <[email protected]>
+
+        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  <[email protected]>
 
         Remove ewstool scripts used by chromium port

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py (185370 => 185371)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py	2015-06-09 18:42:46 UTC (rev 185370)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_builder/generic_benchmark_builder.py	2015-06-09 19:29:31 UTC (rev 185371)
@@ -16,21 +16,26 @@
 
 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 @@
                 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')

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py (185370 => 185371)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py	2015-06-09 18:42:46 UTC (rev 185370)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/benchmark_runner.py	2015-06-09 19:29:31 UTC (rev 185371)
@@ -64,12 +64,7 @@
         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)

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan (185370 => 185371)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan	2015-06-09 18:42:46 UTC (rev 185370)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/jetstream.plan	2015-06-09 19:29:31 UTC (rev 185371)
@@ -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",

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan (185370 => 185371)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan	2015-06-09 18:42:46 UTC (rev 185370)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/plans/sunspider.plan	2015-06-09 19:29:31 UTC (rev 185371)
@@ -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",
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to