Bug 1238648 - Use external-media-tests in tree instead of github for tests. r?maja_zf, r?whimboo draft
authorSyd Polk <spolk@mozilla.com>
Wed, 27 Jan 2016 14:59:08 -0600
changeset 326374 57bf9415490dee3784ba75b885351ffb699c4d52
parent 325488 bd8bb6298d90770f97843e9d7dc711cc0f87d02f
child 513591 971f98824df89d2cf6f45647c74b58f306125b99
push id10138
push userspolk@mozilla.com
push dateWed, 27 Jan 2016 21:02:05 +0000
reviewersmaja_zf, whimboo
bugs1238648
milestone47.0a1
Bug 1238648 - Use external-media-tests in tree instead of github for tests. r?maja_zf, r?whimboo
dom/media/test/external/MANIFEST.in
testing/config/external-media-tests-requirements.txt
testing/mozharness/configs/mediatests/buildbot_posix_config.py
testing/mozharness/configs/mediatests/buildbot_windows_config.py
testing/mozharness/configs/mediatests/jenkins_config.py
testing/mozharness/mozharness/mozilla/testing/firefox_media_tests.py
testing/mozharness/scripts/firefox_media_tests_buildbot.py
testing/mozharness/scripts/firefox_media_tests_jenkins.py
--- a/dom/media/test/external/MANIFEST.in
+++ b/dom/media/test/external/MANIFEST.in
@@ -1,5 +1,6 @@
 exclude MANIFEST.in
+include external-media-tests-requirements.txt
 recursive-include external_media_harness *
 recursive-include external_media_tests *
 
 
new file mode 100644
--- /dev/null
+++ b/testing/config/external-media-tests-requirements.txt
@@ -0,0 +1,3 @@
+-r marionette_requirements.txt
+../external-media-tests/
+../puppeteer/firefox/
--- a/testing/mozharness/configs/mediatests/buildbot_posix_config.py
+++ b/testing/mozharness/configs/mediatests/buildbot_posix_config.py
@@ -7,47 +7,41 @@ external_tools_path = os.path.join(
 )
 
 config = {
     "virtualenv_path": 'venv',
     "exes": {
         'python': '/tools/buildbot/bin/python',
         'virtualenv': ['/tools/buildbot/bin/python', '/tools/misc-python/virtualenv.py'],
         'tooltool.py': "/tools/tooltool.py",
-        'gittool.py': os.path.join(external_tools_path, 'gittool.py'),
     },
 
     "find_links": [
         "http://pypi.pvt.build.mozilla.org/pub",
         "http://pypi.pub.build.mozilla.org/pub",
     ],
     "pip_index": False,
 
     "buildbot_json_path": "buildprops.json",
 
     "default_actions": [
         'clobber',
         'read-buildbot-config',
-        'checkout',
         'download-and-extract',
         'create-virtualenv',
         'install',
         'run-media-tests',
     ],
     "default_blob_upload_servers": [
          "https://blobupload.elasticbeanstalk.com",
     ],
     "blob_uploader_auth_file" : os.path.join(os.getcwd(), "oauth.txt"),
     "download_minidump_stackwalk": True,
     "download_symbols": "ondemand",
 
-    "firefox_media_repo": 'https://github.com/mjzffr/firefox-media-tests.git',
-    "firefox_media_branch": 'master',
-    "firefox_media_rev": '0830e972e4b95fef3507207fc6bce028da27f2d3',
-
     "suite_definitions": {
         "media-tests": {
             "options": [],
         },
         "media-youtube-tests": {
             "options": [
                 "%(test_manifest)s"
             ],
--- a/testing/mozharness/configs/mediatests/buildbot_windows_config.py
+++ b/testing/mozharness/configs/mediatests/buildbot_windows_config.py
@@ -12,18 +12,16 @@ config = {
     "virtualenv_path": 'venv',
     "exes": {
         'python': 'c:/mozilla-build/python27/python',
         'virtualenv': ['c:/mozilla-build/python27/python', 'c:/mozilla-build/buildbotve/virtualenv.py'],
         'hg': 'c:/mozilla-build/hg/hg',
         'mozinstall': ['%s/build/venv/scripts/python' % os.getcwd(),
                        '%s/build/venv/scripts/mozinstall-script.py' % os.getcwd()],
         'tooltool.py': [sys.executable, 'C:/mozilla-build/tooltool.py'],
-        'gittool.py': [sys.executable,
-                       os.path.join(external_tools_path, 'gittool.py')],
         'hgtool.py': [sys.executable,
                       os.path.join(external_tools_path, 'hgtool.py')],
 
 
     },
 
     "find_links": [
         "http://pypi.pvt.build.mozilla.org/pub",
@@ -31,34 +29,29 @@ config = {
     ],
     "pip_index": False,
 
     "buildbot_json_path": "buildprops.json",
 
     "default_actions": [
         'clobber',
         'read-buildbot-config',
-        'checkout',
         'download-and-extract',
         'create-virtualenv',
         'install',
         'run-media-tests',
     ],
     "default_blob_upload_servers": [
          "https://blobupload.elasticbeanstalk.com",
     ],
     "blob_uploader_auth_file" : os.path.join(os.getcwd(), "oauth.txt"),
     "in_tree_config": "config/mozharness/marionette.py",
     "download_minidump_stackwalk": True,
     "download_symbols": "ondemand",
 
-    "firefox_media_repo": 'https://github.com/mjzffr/firefox-media-tests.git',
-    "firefox_media_branch": 'master',
-    "firefox_media_rev": '0830e972e4b95fef3507207fc6bce028da27f2d3',
-
     "suite_definitions": {
         "media-tests": {
             "options": [],
         },
         "media-youtube-tests": {
             "options": [
                 "%(test_manifest)s"
             ],
--- a/testing/mozharness/configs/mediatests/jenkins_config.py
+++ b/testing/mozharness/configs/mediatests/jenkins_config.py
@@ -21,52 +21,32 @@ config = {
     'find_links': ['http://pypi.pub.build.mozilla.org/pub'],
     'pip_index': False,
 
     # mozcrash support
     'download_minidump_stackwalk': True,
     'download_symbols': 'ondemand',
     'download_tooltool': True,
 
-    # Version control information
-    'firefox_media_repo': 'https://github.com/mjzffr/firefox-media-tests.git',
-    'firefox_media_branch': 'master',
-
     # Default test suite
     'test_suite': 'media-tests',
 
     'suite_definitions': {
         'media-tests': {
             'options': [],
         },
         'media-youtube-tests': {
             'options': [
                 '%(test_manifest)s'
             ],
         },
     },
 
     'default_actions': [
         'clobber',
-        'checkout',
         'download-and-extract',
         'create-virtualenv',
         'install',
         'run-media-tests',
     ],
 
 }
 
-# General local variable overwrite
-# Bug 1227079 - Python executable eeded to get it executed on Windows
-if platform.system() == 'windows':
-    gittool = [
-        sys.executable,
-        os.path.join(external_tools_path, 'gittool.py')
-    ]
-else:
-    gittool = os.path.join(external_tools_path, 'gittool.py')
-
-exes = {
-    'gittool.py' : gittool,
-}
-
-config['exes'] = exes
--- a/testing/mozharness/mozharness/mozilla/testing/firefox_media_tests.py
+++ b/testing/mozharness/mozharness/mozilla/testing/firefox_media_tests.py
@@ -52,30 +52,16 @@ media_test_config_options = [
                "test manifest (*.ini)"),
       }],
     [["--e10s"],
      {"dest": "e10s",
       "action": "store_true",
       "default": False,
       "help": "Enable e10s when running marionette tests."
       }],
-    [['--firefox-media-repo'], {
-        'dest': 'firefox_media_repo',
-        'default': 'https://github.com/mjzffr/firefox-media-tests.git',
-        'help': 'which firefox_media_tests repo to use',
-    }],
-    [['--firefox-media-branch'], {
-        'dest': 'firefox_media_branch',
-        'default': 'master',
-        'help': 'which branch to use for firefox_media_tests',
-    }],
-    [['--firefox-media-rev'], {
-        'dest': 'firefox_media_rev',
-        'help': 'which firefox_media_tests revision to use',
-    }],
     [["--suite"],
      {"action": "store",
       "dest": "test_suite",
       "default": "media-tests",
       "help": "suite name",
       }],
 ] + (copy.deepcopy(testing_config_options))
 
@@ -122,17 +108,16 @@ class FirefoxMediaTestsBase(TestingMixin
         {'regex': re.compile(r'''(\b\w*Error)'''), 'level': ERROR},
      ]
 
     def __init__(self, config_options=None, all_actions=None,
                  default_actions=None, **kwargs):
         self.config_options = media_test_config_options + (config_options or [])
         actions = [
             'clobber',
-            'checkout',
             'download-and-extract',
             'create-virtualenv',
             'install',
             'run-media-tests',
         ]
         super(FirefoxMediaTestsBase, self).__init__(
             config_options=self.config_options,
             all_actions=all_actions or actions,
@@ -150,82 +135,70 @@ class FirefoxMediaTestsBase(TestingMixin
         self.installer_path = c.get('installer_path')
         self.binary_path = c.get('binary_path')
         self.test_packages_url = c.get('test_packages_url')
         self.test_url = c.get('test_url')
 
     @PreScriptAction('create-virtualenv')
     def _pre_create_virtualenv(self, action):
         dirs = self.query_abs_dirs()
-        marionette_requirements = os.path.join(dirs['abs_test_install_dir'],
-                                    'config',
-                                    'marionette_requirements.txt')
-        if os.access(marionette_requirements, os.F_OK):
-            self.register_virtualenv_module(requirements=[marionette_requirements],
-                                            two_pass=True)
 
-        media_tests_requirements = os.path.join(dirs['firefox_media_dir'],
-                                         'requirements.txt')
+        media_tests_requirements = os.path.join(dirs['abs_test_install_dir'],
+                                                'config',
+                                                'external-media-tests-requirements.txt')
 
         if os.access(media_tests_requirements, os.F_OK):
             self.register_virtualenv_module(requirements=[media_tests_requirements],
                                             two_pass=True)
 
     def download_and_extract(self):
-        """Overriding method from TestingMixin until firefox-media-tests are in tree.
+        """Overriding method from TestingMixin for more specific behavior.
 
-        Right now we only care about the installer and symbolds.
+        We use the test_packages_url command line argument to check where to get the
+        harness, puppeteer, and tests from and how to set them up.
 
         """
-        self._download_installer()
-
-        if self.config.get('download_symbols'):
-            self._download_and_extract_symbols()
+        target_unzip_dirs = ['config/*',
+                             'external-media-tests/*',
+                             'marionette/*',
+                             'mozbase/*',
+                             'puppeteer/*',
+                             'tools/wptserve/*',
+                             ]
+        super(FirefoxMediaTestsBase, self).download_and_extract(
+                target_unzip_dirs=target_unzip_dirs)
 
     def query_abs_dirs(self):
         if self.abs_dirs:
             return self.abs_dirs
         abs_dirs = super(FirefoxMediaTestsBase, self).query_abs_dirs()
         dirs = {
-            'firefox_media_dir': os.path.join(abs_dirs['abs_work_dir'],
-                                              'firefox-media-tests')
+            'abs_test_install_dir' : os.path.join(abs_dirs['abs_work_dir'],
+                                                    'tests')
         }
-        dirs['abs_test_install_dir'] = os.path.join(abs_dirs['abs_work_dir'],
-                                                    'tests')
+        dirs['external-media-tests'] = os.path.join(dirs['abs_test_install_dir'],
+                                                    'external-media-tests')
         abs_dirs.update(dirs)
         self.abs_dirs = abs_dirs
         return self.abs_dirs
 
-    @PreScriptAction('checkout')
-    def _pre_checkout(self, action):
-        super(FirefoxMediaTestsBase, self)._pre_checkout(action)
-        c = self.config
-        dirs = self.query_abs_dirs()
-        self.firefox_media_vc = {
-            'branch': c['firefox_media_branch'],
-            'repo': c['firefox_media_repo'],
-            'dest': dirs['firefox_media_dir'],
-        }
-        if 'firefox-media-rev' in c:
-            self.firefox_media_vc['revision'] = c['firefox_media_rev']
-
-    def checkout(self):
-        self.vcs_checkout(vcs='gittool', **self.firefox_media_vc)
-
     def _query_cmd(self):
         """ Determine how to call firefox-media-tests """
         if not self.binary_path:
             self.fatal("Binary path could not be determined. "
                        "Should be set by default during 'install' action.")
         dirs = self.query_abs_dirs()
-        venv_python_path = self.query_python_path()
-        runner_script = os.path.join(dirs['firefox_media_dir'],
-                                     'media_test_harness',
-                                     'runtests.py')
-        cmd = [venv_python_path, runner_script]
+
+        import external_media_harness.runtests
+
+        cmd = [
+            self.query_python_path(),
+            external_media_harness.runtests.__file__
+        ]
+
         cmd += ['--binary', self.binary_path]
         if self.symbols_path:
             cmd += ['--symbols-path', self.symbols_path]
         if self.media_urls:
             cmd += ['--urls', self.media_urls]
         if self.profile:
             cmd += ['--profile', self.profile]
         if self.tests:
@@ -233,18 +206,18 @@ class FirefoxMediaTestsBase(TestingMixin
         if self.e10s:
             cmd.append('--e10s')
 
         test_suite = self.config.get('test_suite')
         if test_suite not in self.config["suite_definitions"]:
             self.fatal("%s is not defined in the config!" % test_suite)
 
         test_manifest = None if test_suite != 'media-youtube-tests' else \
-            os.path.join(dirs['firefox_media_dir'],
-                         'firefox_media_tests',
+            os.path.join(dirs['external-media-tests'],
+                         'external-media-tests',
                          'playback', 'youtube', 'manifest.ini')
         config_fmt_args = {
             'test_manifest': test_manifest,
         }
 
         for s in self.config["suite_definitions"][test_suite]["options"]:
             cmd.append(s % config_fmt_args)
 
--- a/testing/mozharness/scripts/firefox_media_tests_buildbot.py
+++ b/testing/mozharness/scripts/firefox_media_tests_buildbot.py
@@ -32,17 +32,16 @@ from mozharness.mozilla.testing.firefox_
 class FirefoxMediaTestsBuildbot(FirefoxMediaTestsBase, BlobUploadMixin):
 
     def __init__(self):
         config_options = copy.deepcopy(blobupload_config_options)
         super(FirefoxMediaTestsBuildbot, self).__init__(
             config_options=config_options,
             all_actions=['clobber',
                          'read-buildbot-config',
-                         'checkout',
                          'download-and-extract',
                          'create-virtualenv',
                          'install',
                          'run-media-tests',
                          ],
         )
 
     def run_media_tests(self):
--- a/testing/mozharness/scripts/firefox_media_tests_jenkins.py
+++ b/testing/mozharness/scripts/firefox_media_tests_jenkins.py
@@ -21,17 +21,16 @@ from mozharness.mozilla.testing.firefox_
 )
 
 
 class FirefoxMediaTestsJenkins(FirefoxMediaTestsBase):
 
     def __init__(self):
         super(FirefoxMediaTestsJenkins, self).__init__(
             all_actions=['clobber',
-                         'checkout',
                          'download-and-extract',
                          'create-virtualenv',
                          'install',
                          'run-media-tests',
                          ],
         )
 
     def _query_cmd(self):