Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1586)

Unified Diff: Tools/Scripts/webkitpy/layout_tests/servers/cli_wrapper.py

Issue 146173004: Fix run-blink-httpd to work w/ Apache and refactor webkitpy.layout_tests.servers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add cli_wrapper and update run-* scripts Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/layout_tests/servers/cli_wrapper.py
diff --git a/Tools/Scripts/webkitpy/tool/commands/abstractsequencedcommand.py b/Tools/Scripts/webkitpy/layout_tests/servers/cli_wrapper.py
similarity index 59%
copy from Tools/Scripts/webkitpy/tool/commands/abstractsequencedcommand.py
copy to Tools/Scripts/webkitpy/layout_tests/servers/cli_wrapper.py
index a0920795ac8e1648e51a714cbf746ae0820287e9..e1353e08a5337b9ba887357772dc0df3737dd924 100644
--- a/Tools/Scripts/webkitpy/tool/commands/abstractsequencedcommand.py
+++ b/Tools/Scripts/webkitpy/layout_tests/servers/cli_wrapper.py
@@ -26,29 +26,39 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+"""A utility script for starting and stopping servers as they are used in the layout tests."""
+
import logging
+import optparse
-from webkitpy.common.system.executive import ScriptError
-from webkitpy.tool.commands.stepsequence import StepSequence
-from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
+from webkitpy.common.host import Host
_log = logging.getLogger(__name__)
-class AbstractSequencedCommand(AbstractDeclarativeCommand):
- steps = None
- def __init__(self):
- self._sequence = StepSequence(self.steps)
- AbstractDeclarativeCommand.__init__(self, self._sequence.options())
+def main(server_constructor, input_fn=None, argv=None, **kwargs):
+ input_fn = input_fn or raw_input
+
+ option_parser = optparse.OptionParser()
+ option_parser.add_option('--output-dir', dest='output_dir',
+ default=None, help='output directory.')
+ option_parser.add_option('-v', '--verbose', action='store_true')
+ options, args = option_parser.parse_args(argv)
+
+ logging.basicConfig()
+ logger = logging.getLogger()
+ logger.setLevel(logging.DEBUG if options.verbose else logging.INFO)
- def _prepare_state(self, options, args, tool):
- return None
+ host = Host()
+ port_obj = host.port_factory.get()
+ if not options.output_dir:
+ options.output_dir = port_obj.default_results_directory()
- def execute(self, options, args, tool):
- try:
- state = self._prepare_state(options, args, tool)
- except ScriptError, e:
- _log.error(e.message_with_output())
- self._exit(e.exit_code or 2)
+ server = server_constructor(port_obj, options.output_dir, **kwargs)
+ server.start()
+ try:
+ _ = input_fn('Hit any key to stop the server and exit.')
+ except (KeyboardInterrupt, EOFError) as e:
+ pass
- self._sequence.run_and_handle_errors(tool, options, state)
+ server.stop()

Powered by Google App Engine
This is Rietveld 408576698