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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/servers/wptserve_unittest.py

Issue 2624093003: Remove the overridden _stop_running_server method in WPTServe. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import logging
6
7 from webkitpy.common.system.log_testing import LoggingTestCase, LogTesting
8 from webkitpy.common.host_mock import MockHost
9 from webkitpy.layout_tests.port import test
10 from webkitpy.layout_tests.servers.wptserve import WPTServe
11
12
13 class TestWPTServe(LoggingTestCase):
14
15 # pylint: disable=protected-access
16
17 def test_init_start_cmd(self):
18 test_port = test.TestPort(MockHost())
19 server = WPTServe(test_port, '/foo')
20 self.assertEqual(
21 server._start_cmd, # pylint: disable=protected-access
22 [
23 'python',
24 '-u',
25 '/mock-checkout/third_party/WebKit/Tools/Scripts/webkitpy/thirdp arty/wpt/wpt/serve',
26 '--config',
27 '/mock-checkout/third_party/WebKit/Tools/Scripts/webkitpy/thirdp arty/wpt/wpt.config.json',
28 '--doc_root',
29 '/test.checkout/LayoutTests/imported/wpt'
30 ])
31
32 def test_init_env(self):
33 test_port = test.TestPort(MockHost())
34 server = WPTServe(test_port, '/foo')
35 self.assertEqual(
36 server._env, # pylint: disable=protected-access
37 {
38 'MOCK_ENVIRON_COPY': '1',
39 'PATH': '/bin:/mock/bin',
40 'PYTHONPATH': '/mock-checkout/third_party/WebKit/Tools/Scripts/w ebkitpy/thirdparty'
41 })
42
43 def test_start_with_unkillable_zombie_process(self):
44 # Allow asserting about debug logs.
45 self._log = LogTesting.setUp(self, logging_level=logging.DEBUG)
46
47 host = MockHost()
48 test_port = test.TestPort(host)
49 host.filesystem.write_text_file('/log_file_dir/access_log', 'foo')
50 host.filesystem.write_text_file('/log_file_dir/error_log', 'foo')
51 host.filesystem.write_text_file('/tmp/pidfile', '7')
52
53 server = WPTServe(test_port, '/log_file_dir')
54 server._pid_file = '/tmp/pidfile'
55 server._spawn_process = lambda: 4
56 server._is_server_running_on_all_ports = lambda: True
57
58 # Simulate a process that never gets killed.
59 host.executive.check_running_pid = lambda _: True
60
61 server.start()
62 self.assertEqual(server._pid, 4)
63 self.assertIsNone(host.filesystem.files[server._pid_file])
64
65 # In this case, we'll try to kill the process repeatedly,
66 # then give up and just try to start a new process anyway.
67 logs = self.logMessages()
68 self.assertEqual(len(logs), 43)
69 self.assertEqual(
70 logs[:2],
71 [
72 'DEBUG: stale wptserve pid file, pid 7\n',
73 'DEBUG: pid 7 is running, killing it\n'
74 ])
75 self.assertEqual(
76 logs[-2:],
77 [
78 'DEBUG: all ports are available\n',
79 'DEBUG: wptserve successfully started (pid = 4)\n'
80 ])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698