Commit 52abf0b2 authored by zandobersek@gmail.com's avatar zandobersek@gmail.com

[webkitpy] Make the Xvfb screen depth overridable

https://bugs.webkit.org/show_bug.cgi?id=122089

Reviewed by Gyuyoung Kim.

Make the Xvfb screen depth overridable by checking if the XVFB_SCREEN_DEPTH environment variable
was set. The default value that's used if the variable wasn't set is 24.

* Scripts/webkitpy/port/xvfbdriver.py:
(XvfbDriver._xvfb_screen_depth):
(XvfbDriver._start):
* Scripts/webkitpy/port/xvfbdriver_unittest.py:
(XvfbDriverTest.make_driver):
(XvfbDriverTest.test_start_no_pixel_tests):
(XvfbDriverTest.test_start_pixel_tests):
(XvfbDriverTest.test_start_arbitrary_worker_number):
(XvfbDriverTest.test_next_free_display):
(XvfbDriverTest.test_start_next_worker):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8f71118f
2013-09-30 Zan Dobersek <zdobersek@igalia.com>
[webkitpy] Make the Xvfb screen depth overridable
https://bugs.webkit.org/show_bug.cgi?id=122089
Reviewed by Gyuyoung Kim.
Make the Xvfb screen depth overridable by checking if the XVFB_SCREEN_DEPTH environment variable
was set. The default value that's used if the variable wasn't set is 24.
* Scripts/webkitpy/port/xvfbdriver.py:
(XvfbDriver._xvfb_screen_depth):
(XvfbDriver._start):
* Scripts/webkitpy/port/xvfbdriver_unittest.py:
(XvfbDriverTest.make_driver):
(XvfbDriverTest.test_start_no_pixel_tests):
(XvfbDriverTest.test_start_pixel_tests):
(XvfbDriverTest.test_start_arbitrary_worker_number):
(XvfbDriverTest.test_next_free_display):
(XvfbDriverTest.test_start_next_worker):
2013-09-29 Mark Rowe <mrowe@apple.com>
Fix the Lion build.
......
......@@ -65,6 +65,9 @@ class XvfbDriver(Driver):
if self._guard_lock.acquire_lock():
return i
def _xvfb_screen_depth(self):
return os.environ.get('XVFB_SCREEN_DEPTH', '24')
def _start(self, pixel_tests, per_test_args):
self.stop()
......@@ -74,7 +77,7 @@ class XvfbDriver(Driver):
display_id = self._next_free_display()
self._lock_file = "/tmp/.X%d-lock" % display_id
run_xvfb = ["Xvfb", ":%d" % display_id, "-screen", "0", "800x600x8", "-nolisten", "tcp"]
run_xvfb = ["Xvfb", ":%d" % display_id, "-screen", "0", "800x600x%s" % self._xvfb_screen_depth(), "-nolisten", "tcp"]
with open(os.devnull, 'w') as devnull:
self._xvfb_process = self._port.host.executive.popen(run_xvfb, stderr=devnull)
......
......@@ -51,6 +51,7 @@ class XvfbDriverTest(unittest.TestCase):
driver = XvfbDriver(port, worker_number=worker_number, pixel_tests=True)
driver._startup_delay_secs = 0
driver._xvfb_screen_depth = lambda: '24'
return driver
def cleanup_driver(self, driver):
......@@ -66,24 +67,24 @@ class XvfbDriverTest(unittest.TestCase):
def test_start_no_pixel_tests(self):
driver = self.make_driver()
expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0")
self.cleanup_driver(driver)
def test_start_pixel_tests(self):
driver = self.make_driver()
expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
self.cleanup_driver(driver)
def test_start_arbitrary_worker_number(self):
driver = self.make_driver(worker_number=17)
expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
expected_logs = "MOCK run_command: ['ps', '-eo', 'comm,command'], cwd=None\nMOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
self.cleanup_driver(driver)
def test_next_free_display(self):
output = "Xorg /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none\nXvfb Xvfb :1 -screen 0 800x600x8 -nolisten tcp"
output = "Xorg /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none\nXvfb Xvfb :1 -screen 0 800x600x24 -nolisten tcp"
executive = MockExecutive2(output)
driver = self.make_driver(executive=executive)
self.assertEqual(driver._next_free_display(), 2)
......@@ -93,12 +94,12 @@ class XvfbDriverTest(unittest.TestCase):
driver = self.make_driver(executive=executive)
self.assertEqual(driver._next_free_display(), 1)
self.cleanup_driver(driver)
output = "Xvfb Xvfb :0 -screen 0 800x600x8 -nolisten tcp"
output = "Xvfb Xvfb :0 -screen 0 800x600x24 -nolisten tcp"
executive = MockExecutive2(output)
driver = self.make_driver(executive=executive)
self.assertEqual(driver._next_free_display(), 1)
self.cleanup_driver(driver)
output = "Xvfb Xvfb :1 -screen 0 800x600x8 -nolisten tcp\nXvfb Xvfb :0 -screen 0 800x600x8 -nolisten tcp\nXvfb Xvfb :3 -screen 0 800x600x8 -nolisten tcp"
output = "Xvfb Xvfb :1 -screen 0 800x600x24 -nolisten tcp\nXvfb Xvfb :0 -screen 0 800x600x24 -nolisten tcp\nXvfb Xvfb :3 -screen 0 800x600x24 -nolisten tcp"
executive = MockExecutive2(output)
driver = self.make_driver(executive=executive)
self.assertEqual(driver._next_free_display(), 2)
......@@ -107,12 +108,12 @@ class XvfbDriverTest(unittest.TestCase):
def test_start_next_worker(self):
driver = self.make_driver()
driver._next_free_display = lambda: 0
expected_logs = "MOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
expected_logs = "MOCK popen: ['Xvfb', ':0', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":0", pixel_tests=True)
self.cleanup_driver(driver)
driver = self.make_driver()
driver._next_free_display = lambda: 3
expected_logs = "MOCK popen: ['Xvfb', ':3', '-screen', '0', '800x600x8', '-nolisten', 'tcp']\n"
expected_logs = "MOCK popen: ['Xvfb', ':3', '-screen', '0', '800x600x24', '-nolisten', 'tcp']\n"
self.assertDriverStartSuccessful(driver, expected_logs=expected_logs, expected_display=":3", pixel_tests=True)
self.cleanup_driver(driver)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment