Commits

Anonymous committed 478d301

Backed out changeset 812da5854739

  • Participants
  • Parent commits 812da58

Comments (0)

Files changed (4)

configs/b2g/emulator_automation_config.py

     ],
     "download_symbols": "ondemand",
     "download_minidump_stackwalk": True,
-
-    # test harness options
-    "run_file_names": {
-        "mochitest": "runtestsb2g.py",
-        "reftest": "runreftestb2g.py",
-        "crashtest": "runreftestb2g.py",
-        "xpcshell": "runtestsb2g.py"
-    },
-
-    "mochitest_options": [
-        "--adbpath=%(adbpath)s", "--b2gpath=%(b2gpath)s", "--console-level=INFO",
-        "--emulator=%(emulator)s", "--logcat-dir=%(logcat_dir)s",
-        "--remote-webserver=%(remote_webserver)s", "--test-manifest=%(test_manifest)s",
-        "--xre-path=%(xre_path)s", "--gecko-path=%(gecko_path)s",
-        "--symbols-path=%(symbols_path)s", "--busybox=%(busybox)s",
-        "--total-chunks=%(total_chunks)s", "--this-chunk=%(this_chunk)s",
-    ],
-
-    "reftest_options": [
-        "--adbpath=%(adbpath)s", "--b2gpath=%(b2gpath)s", "--emulator=%(emulator)s",
-        "--emulator-res=800x1000", "--logcat-dir=%(logcat_dir)s",
-        "--remote-webserver=%(remote_webserver)s", "--ignore-window-size",
-        "--xre-path=%(xre_path)s", "--gecko-path=%(gecko_path)s",
-        "--symbols-path=%(symbols_path)s", "--busybox=%(busybox)s",
-        "--total-chunks=%(total_chunks)s", "--this-chunk=%(this_chunk)s",
-        "%(test_manifest)s",
-    ],
-
-    "crashtest_options": [
-        "--adbpath=%(adbpath)s", "--b2gpath=%(b2gpath)s", "--emulator=%(emulator)s",
-        "--emulator-res=800x1000", "--logcat-dir=%(logcat_dir)s",
-        "--remote-webserver=%(remote_webserver)s", "--ignore-window-size",
-        "--xre-path=%(xre_path)s", "--gecko-path=%(gecko_path)s",
-        "--symbols-path=%(symbols_path)s", "--busybox=%(busybox)s",
-        "--total-chunks=%(total_chunks)s", "--this-chunk=%(this_chunk)s",
-        "%(test_manifest)s",
-    ],
-
-    "xpcshell_options": [
-        "--adbpath=%(adbpath)s", "--b2gpath=%(b2gpath)s", "--emulator=%(emulator)s",
-        "--logcat-dir=%(logcat_dir)s", "--manifest=%(test_manifest)s",
-        "--testing-modules-dir=%(modules_dir)s", "--gecko-path=%(gecko_path)s",
-        "--symbols-path=%(symbols_path)s", "--busybox=%(busybox)s",
-        "--total-chunks=%(total_chunks)s", "--this-chunk=%(this_chunk)s",
-    ],
 }

mozharness/mozilla/testing/testbase.py

 import os
 import platform
 
-from mozharness.base.config import ReadOnlyDict, parse_config_file
 from mozharness.base.errors import BaseErrorList
 from mozharness.base.log import FATAL
 from mozharness.base.python import virtualenv_config_options, VirtualenvMixin
     binary_path = None
     test_url = None
     test_zip_path = None
-    tree_config = ReadOnlyDict({})
     symbols_url = None
     symbols_path = None
     minidump_stackwalk_path = None
         # TODO error_list
         self.run_command(unzip_cmd, cwd=test_install_dir, halt_on_failure=True)
 
-    def _read_tree_config(self):
-        """Reads an in-tree config file"""
-        dirs = self.query_abs_dirs()
-        test_install_dir = dirs.get('abs_test_install_dir',
-                                    os.path.join(dirs['abs_work_dir'], 'tests'))
-        tree_config_path = os.path.join(test_install_dir, 'config', 'mozharness_config.py')
-
-        if os.path.isfile(tree_config_path):
-            self.tree_config.update(parse_config_file(tree_config_path))
-        self.tree_config.lock()
-
     def _download_installer(self):
         file_name = None
         if self.installer_path:
         if self.test_url:
             self._download_test_zip()
             self._extract_test_zip(target_unzip_dirs=target_unzip_dirs)
-            self._read_tree_config()
         self._download_installer()
         if self.config.get('download_symbols'):
             self._download_and_extract_symbols()

scripts/b2g_emulator_unittest.py

             dirs['abs_test_install_dir'], 'modules')
         dirs['abs_reftest_dir'] = os.path.join(
             dirs['abs_test_install_dir'], 'reftest')
-        dirs['abs_crashtest_dir'] = os.path.join(
-            dirs['abs_test_install_dir'], 'reftest')
         dirs['abs_xpcshell_dir'] = os.path.join(
             dirs['abs_test_install_dir'], 'xpcshell')
         for key in dirs.keys():
         self.abs_dirs = abs_dirs
         return self.abs_dirs
 
+    def _build_arg(self, option, value):
+        """
+        Build a command line argument
+        """
+        if not value:
+            return []
+        return [str(option), str(value)]
+
     def download_and_extract(self):
         super(B2GEmulatorTest, self).download_and_extract()
         dirs = self.query_abs_dirs()
                                parent_dir=dirs['abs_work_dir'])
             self.busybox_path = os.path.join(dirs['abs_work_dir'], 'busybox')
 
-    def _query_abs_base_cmd(self, suite):
+    def _build_mochitest_args(self):
+        c = self.config
         dirs = self.query_abs_dirs()
-        cmd = [self.query_python_path('python')]
-        cmd.append(self.config['run_file_names'][suite])
+        python = self.query_python_path('python')
+        cmd = [
+            python, os.path.join(dirs['abs_mochitest_dir'], 'runtestsb2g.py'),
+            '--adbpath', self.adb_path,
+            '--b2gpath', dirs['abs_b2g-distro_dir'],
+            '--console-level', 'INFO',
+            '--emulator', c['emulator'],
+            '--logcat-dir', dirs['abs_work_dir'],
+            '--remote-webserver', c['remote_webserver'],
+            '--run-only-tests', self.test_manifest,
+            '--xre-path', os.path.join(dirs['abs_xre_dir'], 'bin'),
+        ]
+        cmd.extend(self._build_arg('--total-chunks', c.get('total_chunks')))
+        cmd.extend(self._build_arg('--this-chunk', c.get('this_chunk')))
+        # self.binary_path gets set by super(B2GEmulatorTest, self).install()
+        cmd.extend(self._build_arg('--gecko-path', os.path.dirname(self.binary_path)))
+        cmd.extend(self._build_arg('--busybox', self.busybox_path))
+        cmd.extend(self._build_arg('--symbols-path', self.symbols_path))
+        return cmd
 
-        str_format_values = {
-            'adbpath': self.adb_path,
-            'b2gpath': dirs['abs_b2g-distro_dir'],
-            'emulator': self.config['emulator'],
-            'logcat_dir': dirs['abs_work_dir'],
-            'remote_webserver': self.config['remote_webserver'],
-            'xre_path': os.path.join(dirs['abs_xre_dir'], 'bin'),
-            'test_manifest': self.test_manifest,
-            'gecko_path': os.path.dirname(self.binary_path),
-            'symbols_path': self.symbols_path,
-            'busybox': self.busybox_path,
-            'total_chunks': self.config.get('total_chunks'),
-            'this_chunk': self.config.get('this_chunk'),
-        }
+    def _build_reftest_args(self):
+        c = self.config
+        dirs = self.query_abs_dirs()
+        python = self.query_python_path('python')
+        cmd = [
+            python, 'runreftestb2g.py',
+            '--adbpath', self.adb_path,
+            '--b2gpath', dirs['abs_b2g-distro_dir'],
+            '--emulator', c['emulator'],
+            '--emulator-res', '800x1000',
+            '--ignore-window-size',
+            '--logcat-dir', dirs['abs_work_dir'],
+            '--remote-webserver', c['remote_webserver'],
+            '--xre-path', os.path.join(dirs['abs_xre_dir'], 'bin'),
+        ]
+        cmd.extend(self._build_arg('--total-chunks', c.get('total_chunks')))
+        cmd.extend(self._build_arg('--this-chunk', c.get('this_chunk')))
+        # self.binary_path gets set by super(B2GEmulatorTest, self).install()
+        cmd.extend(self._build_arg('--gecko-path', os.path.dirname(self.binary_path)))
+        cmd.extend(self._build_arg('--busybox', self.busybox_path))
+        cmd.extend(self._build_arg('--symbols-path', self.symbols_path))
+        cmd.append(self.test_manifest)
+        return cmd
 
-        name = '%s_options' % suite
-        options = self.tree_config.get(name, self.config.get(name))
-        if options:
-            for option in options:
-                option = option % str_format_values
-                if not option.endswith('None'):
-                    cmd.append(option)
+    def _build_xpcshell_args(self):
+        c = self.config
+        dirs = self.query_abs_dirs()
+        python = self.query_python_path('python')
+        cmd = [
+            python, 'runtestsb2g.py',
+            '--adbpath', self.adb_path,
+            '--b2gpath', dirs['abs_b2g-distro_dir'],
+            '--emulator', c['emulator'],
+            '--gecko-path', os.path.dirname(self.binary_path),
+            '--logcat-dir', dirs['abs_work_dir'],
+            '--manifest', self.test_manifest,
+            '--testing-modules-dir', dirs['abs_modules_dir'],
+            '--use-device-libs',
+        ]
+        cmd.extend(self._build_arg('--total-chunks', c.get('total_chunks')))
+        cmd.extend(self._build_arg('--this-chunk', c.get('this_chunk')))
+        cmd.extend(self._build_arg('--busybox', self.busybox_path))
+        cmd.extend(self._build_arg('--symbols-path', self.symbols_path))
         return cmd
 
     def _query_adb(self):
         error_list = self.error_list
         error_list.extend(BaseErrorList)
 
-        suite = self.config['test_suite']
-        if suite not in self.test_suites:
-            self.fatal("Don't know how to run --test-suite '%s'!" % suite)
-
-        cmd = self._query_abs_base_cmd(suite)
-        cwd = dirs['abs_%s_dir' % suite]
-
+        if self.config['test_suite'] == 'mochitest':
+            cmd = self._build_mochitest_args()
+            cwd = dirs['abs_mochitest_dir']
+        elif self.config['test_suite'] in ('reftest', 'crashtest'):
+            cmd = self._build_reftest_args()
+            cwd = dirs['abs_reftest_dir']
+        elif self.config['test_suite'] == 'xpcshell':
+            cmd = self._build_xpcshell_args()
+            cwd = dirs['abs_xpcshell_dir']
+        else:
+            self.fatal("Don't know how to run --test-suite '%s'!" % self.config['test_suite'])
         # TODO we probably have to move some of the code in
         # scripts/desktop_unittest.py and scripts/marionette.py to
         # mozharness.mozilla.testing.unittest so we can share it.

scripts/desktop_unittest.py

             # self.symbols_path when downloading/extracting.
             if self.symbols_path:
                 str_format_values['symbols_path'] = self.symbols_path
-
-            name = '%s_options' % suite
-            options = self.tree_config.get(name, self.config.get(name))
-            if options:
-                for option in options:
+            if self.config['%s_options' % suite_category]:
+                for option in self.config['%s_options' % suite_category]:
                     options.append(option % str_format_values)
                 abs_base_cmd = base_cmd + options
                 return abs_base_cmd