Пример #1
0
 def testCTSConfig(self):
   with tempfile.NamedTemporaryFile('w+t') as configFile:
     configFile.writelines(CONFIG_DATA['json'])
     configFile.flush()
     cts_config = cts_utils.CTSConfig(configFile.name)
   self.assertEqual(['platform1', 'platform2'], cts_config.get_platforms())
   self.assertEqual(['arch1', 'arch2'], cts_config.get_archs('platform1'))
   self.assertEqual(['arch1', 'arch2'], cts_config.get_archs('platform2'))
   self.assertEqual('arch1/platform1/file1.zip',
                    cts_config.get_cipd_zip('platform1', 'arch1'))
   self.assertEqual('arch2/platform1/file3.zip',
                    cts_config.get_cipd_zip('platform1', 'arch2'))
   self.assertEqual('arch1/platform2/file2.zip',
                    cts_config.get_cipd_zip('platform2', 'arch1'))
   self.assertEqual('arch2/platform2/file4.zip',
                    cts_config.get_cipd_zip('platform2', 'arch2'))
   self.assertEqual('https://a1.p1/f1.zip',
                    cts_config.get_origin('platform1', 'arch1'))
   self.assertEqual('https://a2.p1/f3.zip',
                    cts_config.get_origin('platform1', 'arch2'))
   self.assertEqual('https://a1.p2/f2.zip',
                    cts_config.get_origin('platform2', 'arch1'))
   self.assertEqual('https://a2.p2/f4.zip',
                    cts_config.get_origin('platform2', 'arch2'))
   self.assertTrue(['p1/test.apk'], cts_config.get_apks('platform1'))
   self.assertTrue(['p2/test1.apk', 'p2/test2.apk'],
                   cts_config.get_apks('platform2'))
Пример #2
0
 def testFilterCTS(self, filterzip_mock):
   with tempfile.NamedTemporaryFile('w+t') as configFile:
     configFile.writelines(CONFIG_DATA['json'])
     configFile.flush()
     cts_config = cts_utils.CTSConfig(configFile.name)
   cts_utils.filter_cts_file(cts_config, CONFIG_DATA['base11'], '/filtered')
   filterzip_mock.assert_called_with(
       CONFIG_DATA['base11'], [CONFIG_DATA['apk1']],
       os.path.join('/filtered', CONFIG_DATA['base11']))
Пример #3
0
 def testCTSConfigSanity(self):
   cts_config = cts_utils.CTSConfig()
   platforms = cts_config.get_platforms()
   self.assertTrue(platforms)
   platform = platforms[0]
   archs = cts_config.get_archs(platform)
   self.assertTrue(archs)
   self.assertTrue(cts_config.get_cipd_zip(platform, archs[0]))
   self.assertTrue(cts_config.get_origin(platform, archs[0]))
   self.assertTrue(cts_config.get_apks(platform))
Пример #4
0
    def __init__(self, work_dir, repo_root):
        """Construct UpdateCTS instance.

    Args:
      work_dir: Directory used to download and stage cipd updates
      repo_root: Repository root (e.g. /path/to/chromium/src) to base
                 all configuration files
    """
        self._work_dir = os.path.abspath(work_dir)
        self._download_dir = os.path.join(self._work_dir, 'downloaded')
        self._filter_dir = os.path.join(self._work_dir, 'filtered')
        self._cipd_dir = os.path.join(self._work_dir, 'cipd')
        self._stage_dir = os.path.join(self._work_dir, 'staged')
        self._version_file = os.path.join(self._work_dir, 'cipd_version.txt')
        self._repo_root = os.path.abspath(repo_root)
        helper = cts_utils.ChromiumRepoHelper(self._repo_root)
        self._repo_helper = helper
        self._CTSConfig = cts_utils.CTSConfig(
            helper.rebase(cts_utils.TOOLS_DIR, cts_utils.CONFIG_FILE))
        self._CIPDYaml = cts_utils.CTSCIPDYaml(
            helper.rebase(cts_utils.TOOLS_DIR, cts_utils.CIPD_FILE))