Bug 1633101 - consolidate pulseaudio initialization process on linux and migrate to x64 fontconfig package r=jmaher
☠☠ backed out by b8525b0c48d9 ☠ ☠
authoregao <egao@mozilla.com>
Wed, 13 May 2020 21:46:55 +0000
changeset 529717 4123014cf744af79b9bc300109291a8d5efc8f15
parent 529716 3e68d50950bf122006b30009c8891196c21b8395
child 529718 b8525b0c48d99e447f47db559269e2e0ba2092ea
push id37414
push usernbeleuzu@mozilla.com
push dateThu, 14 May 2020 02:40:10 +0000
treeherdermozilla-central@045d696faa87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1633101
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1633101 - consolidate pulseaudio initialization process on linux and migrate to x64 fontconfig package r=jmaher Changes: While the ubuntu1804 migration work was taking place, `pulseaudio` related pieces of code were sprinkled across a wide variety of modules. Now that things have settled down, remove and streamline `pulseaudio` initialization so that there are less places for this to go wrong. Differential Revision: https://phabricator.services.mozilla.com/D74809
taskcluster/docker/recipes/ubuntu1804-test-system-setup.sh
taskcluster/scripts/tester/test-linux.sh
testing/mochitest/runtests.py
testing/mozharness/scripts/desktop_unittest.py
--- a/taskcluster/docker/recipes/ubuntu1804-test-system-setup.sh
+++ b/taskcluster/docker/recipes/ubuntu1804-test-system-setup.sh
@@ -16,16 +16,17 @@ apt_packages=()
 
 apt_packages+=('autoconf2.13')
 apt_packages+=('bluez-cups')
 apt_packages+=('build-essential')
 apt_packages+=('ca-certificates')
 apt_packages+=('ccache')
 apt_packages+=('compiz')
 apt_packages+=('curl')
+apt_packages+=('fontconfig')
 apt_packages+=('fonts-kacst')
 apt_packages+=('fonts-kacst-one')
 apt_packages+=('fonts-liberation')
 apt_packages+=('fonts-stix')
 apt_packages+=('fonts-unfonts-core')
 apt_packages+=('fonts-unfonts-extra')
 apt_packages+=('fonts-vlgothic')
 apt_packages+=('g++-multilib')
@@ -84,17 +85,16 @@ apt_packages+=('ubuntu-desktop')
 apt_packages+=('unzip')
 apt_packages+=('uuid')
 apt_packages+=('wget')
 apt_packages+=('xvfb')
 apt_packages+=('yasm')
 apt_packages+=('zip')
 
 # Make sure we have libraries for 32-bit tests
-apt_packages+=('fontconfig:i386')
 apt_packages+=('libxt6:i386')
 apt_packages+=('libpulse0:i386')
 apt_packages+=('libxtst6:i386')
 apt_packages+=('libsecret-1-0:i386')
 apt_packages+=('libavcodec-extra57:i386')
 apt_packages+=('libgtk2.0-0:i386')
 apt_packages+=('libgtk-3-0:i386')
 apt_packages+=('libdbus-glib-1-2:i386')
--- a/taskcluster/scripts/tester/test-linux.sh
+++ b/taskcluster/scripts/tester/test-linux.sh
@@ -53,20 +53,17 @@ fail() {
     echo # make sure error message is on a new line
     echo "[test-linux.sh:error]" "${@}"
     exit 1
 }
 
 # start pulseaudio
 maybe_start_pulse() {
     if $NEED_PULSEAUDIO; then
-        # call pulseaudio for Ubuntu only
-        if [ $DISTRIBUTION == "Ubuntu" ]; then
-            pulseaudio --fail --daemonize --start
-        fi
+        pulseaudio --fail --daemonize --start -vvvvv --exit-idle-time=-1
     fi
 }
 
 # test required parameters are supplied
 if [ -z "${MOZHARNESS_PATH}" -a -z "${MOZHARNESS_URL}" ]; then
     fail "MOZHARNESS_PATH or MOZHARNESS_URL must be defined";
 fi
 
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -822,38 +822,37 @@ def findTestMediaDevices(log):
                            'pattern=green', 'num-buffers=1', '!',
                            'v4l2sink', 'device=%s' % device])
     info['video'] = name
 
     # check if PulseAudio module-null-sink is loaded
     pactl = spawn.find_executable("pactl")
 
     if not pactl:
-        log.error('Could not find pactl on system')
-        return None
-
+        log.critical('Could not find pactl on system')
+
+    # Load module-null-sink for the test.
+    # This assumes Pulseaudio has been initialized.
+    try:
+        o = subprocess.check_output(
+            [pactl, 'load-module', 'module-null-sink']
+        )
+    except subprocess.CalledProcessError:
+        log.critical('Could not load module-null-sink')
+
+    # List the loaded sinks.
     try:
         o = subprocess.check_output(
             [pactl, 'list', 'short', 'modules'])
     except subprocess.CalledProcessError:
-        log.error('Could not list currently loaded modules')
-        return None
-
-    null_sink = filter(lambda x: 'module-null-sink' in x, o.splitlines())
-
-    if not null_sink:
-        try:
-            subprocess.check_call([
-                pactl,
-                'load-module',
-                'module-null-sink'
-            ])
-        except subprocess.CalledProcessError:
-            log.error('Could not load module-null-sink')
-            return None
+        log.critical('Could not list currently loaded modules')
+
+    # Ensure that module-null-sink has been successfully loaded.
+    # if 'module-null-sink' not in o:
+    #     log.critical('Failed to load module-null-sink, cannot run media tests')
 
     # Hardcode the name since it's always the same.
     info['audio'] = 'Monitor of Null Output'
     return info
 
 
 def create_zip(path):
     """
--- a/testing/mozharness/scripts/desktop_unittest.py
+++ b/testing/mozharness/scripts/desktop_unittest.py
@@ -176,17 +176,16 @@ class DesktopUnittest(TestingMixin, Merc
         # abs_dirs defined already in BaseScript but is here to make pylint happy
         self.abs_dirs = None
         super(DesktopUnittest, self).__init__(
             config_options=self.config_options,
             all_actions=[
                 'clobber',
                 'download-and-extract',
                 'create-virtualenv',
-                'start-pulseaudio',
                 'install',
                 'stage-files',
                 'run-tests',
             ],
             require_config_file=require_config_file,
             config={'require_test_zip': True})
 
         c = self.config
@@ -586,40 +585,16 @@ class DesktopUnittest(TestingMixin, Merc
         if c.get('run_all_suites'):
             target_categories = SUITE_CATEGORIES
         else:
             target_categories = [cat for cat in SUITE_CATEGORIES
                                  if self._query_specified_suites(cat) is not None]
         super(DesktopUnittest, self).download_and_extract(extract_dirs=extract_dirs,
                                                           suite_categories=target_categories)
 
-    def start_pulseaudio(self):
-        command = []
-        # Implies that underlying system is Linux.
-        if (os.environ.get('NEED_PULSEAUDIO') == 'true'):
-            command.extend([
-                'pulseaudio',
-                '--daemonize',
-                '--log-level=4',
-                '--log-time=1',
-                '-vvvvv',
-                '--exit-idle-time=-1'
-            ])
-
-            # Only run the initialization for Debian.
-            # Ubuntu appears to have an alternate method of starting pulseaudio.
-            if self._is_debian():
-                self._kill_named_proc('pulseaudio')
-                self.run_command(command)
-
-            # All Linux systems need module-null-sink to be loaded, otherwise
-            # media tests fail.
-            self.run_command('pactl load-module module-null-sink')
-            self.run_command('pactl list modules short')
-
     def stage_files(self):
         for category in SUITE_CATEGORIES:
             suites = self._query_specified_suites(category)
             stage = getattr(self, '_stage_{}'.format(category), None)
             if suites and stage:
                 stage(suites)
 
     def _stage_files(self, bin_name=None):