+2012-04-12 Simon Pena <spena@igalia.com>
+
+ [GTK] Test runner crashes without recent versions of pulseaudio-utils
+ https://bugs.webkit.org/show_bug.cgi?id=83774
+
+ Reviewed by Philippe Normand.
+
+ Besides checking that pactl is available, check also that its output
+ is the expected one, and handle gracefully when it isn't, when
+ trying to unload pulseaudio modules.
+
+ * Scripts/webkitpy/layout_tests/port/gtk.py:
+ (GtkPort._unload_pulseaudio_module):
+ (GtkPort._restore_pulseaudio_module):
+
2012-03-05 Pierre Rossi <pierre.rossi@gmail.com>
[Qt] Use QRawFont when building with Qt 5
with open(os.devnull, 'w') as devnull:
try:
pactl_process = subprocess.Popen(["pactl", "list", "short", "modules"], stdout=subprocess.PIPE, stderr=devnull)
+ pactl_process.wait()
except OSError:
# pactl might not be available.
_log.debug('pactl not found. Please install pulseaudio-utils to avoid some potential media test failures.')
modules_list = pactl_process.communicate()[0]
for module in modules_list.splitlines():
if module.find("module-stream-restore") >= 0:
- self._pa_module_index = module.split('\t')[0]
- break
- if int(self._pa_module_index) != -1:
- subprocess.Popen(["pactl", "unload-module", self._pa_module_index])
+ # Some pulseaudio-utils versions don't provide
+ # the index, just an empty string
+ self._pa_module_index = module.split('\t')[0] or -1
+ try:
+ # Since they could provide other stuff (not an index
+ # nor an empty string, let's make sure this is an int.
+ if int(self._pa_module_index) != -1:
+ pactl_process = subprocess.Popen(["pactl", "unload-module", self._pa_module_index])
+ pactl_process.wait()
+ if pactl_process.returncode == 0:
+ _log.debug('Unloaded module-stream-restore successfully')
+ else:
+ _log.debug('Unloading module-stream-restore failed')
+ except ValueError:
+ # pactl should have returned an index if the module is found
+ _log.debug('Unable to parse module index. Please check if your pulseaudio-utils version is too old.')
+ return
def _restore_pulseaudio_module(self):
# If pulseaudio's module-stream-restore was previously unloaded,
- # restore it back.
+ # restore it back. We shouldn't need extra checks here, since an
+ # index != -1 here means we successfully unloaded it previously.
if self._pa_module_index != -1:
with open(os.devnull, 'w') as devnull:
- subprocess.Popen(["pactl", "load-module", "module-stream-restore"], stdout=devnull, stderr=devnull)
+ pactl_process = subprocess.Popen(["pactl", "load-module", "module-stream-restore"], stdout=devnull, stderr=devnull)
+ pactl_process.wait()
+ if pactl_process.returncode == 0:
+ _log.debug('Restored module-stream-restore successfully')
+ else:
+ _log.debug('Restoring module-stream-restore failed')
+
def setup_test_run(self):
self._unload_pulseaudio_module()