Exemplo n.º 1
0
  def test_combine_multiple(self):
    key1 = CacheKey(id='1', hash='a')
    key2 = CacheKey(id='2', hash='b')
    combined_key = CacheKey.combine_cache_keys([key1, key2])

    self.assertNotEqual(key1, combined_key)
    self.assertNotEqual(key2, combined_key)
    self.assertEqual(combined_key, CacheKey.combine_cache_keys([key1, key2]))
Exemplo n.º 2
0
    def test_combine_multiple(self):
        key1 = CacheKey(id="1", hash="a")
        key2 = CacheKey(id="2", hash="b")
        combined_key = CacheKey.combine_cache_keys([key1, key2])

        self.assertNotEqual(key1, combined_key)
        self.assertNotEqual(key2, combined_key)
        self.assertEqual(combined_key, CacheKey.combine_cache_keys([key1, key2]))
Exemplo n.º 3
0
    def __init__(self, cache_manager, versioned_targets):
        self._cache_manager = cache_manager
        self.versioned_targets = versioned_targets
        self.targets = [vt.target for vt in versioned_targets]

        # The following line is a no-op if cache_key was set in the VersionedTarget __init__ method.
        self.cache_key = CacheKey.combine_cache_keys(
            [vt.cache_key for vt in versioned_targets])
        # NB: previous_cache_key may be None on the first build of a target.
        self.previous_cache_key = cache_manager.previous_key(self.cache_key)
        self.valid = self.previous_cache_key == self.cache_key

        if cache_manager.invalidation_report:
            cache_manager.invalidation_report.add_vts(cache_manager.task_name,
                                                      self.targets,
                                                      self.cache_key,
                                                      self.valid,
                                                      phase='init')

        self._results_dir = None
        self._current_results_dir = None
        self._previous_results_dir = None
        # True if the results_dir for this VT was created incrementally via clone of the
        # previous results_dir.
        self.is_incremental = False
Exemplo n.º 4
0
  def __init__(self, cache_manager, versioned_targets):
    self._cache_manager = cache_manager
    self.versioned_targets = versioned_targets
    self.targets = [vt.target for vt in versioned_targets]

    # The following line is a no-op if cache_key was set in the VersionedTarget __init__ method.
    self.cache_key = CacheKey.combine_cache_keys([vt.cache_key for vt in versioned_targets])
    # NB: previous_cache_key may be None on the first build of a target.
    self.previous_cache_key = cache_manager.previous_key(self.cache_key)
    self.valid = self.previous_cache_key == self.cache_key

    if cache_manager.invalidation_report:
      cache_manager.invalidation_report.add_vts(cache_manager.task_name,
                                                self.targets,
                                                self.cache_key,
                                                self.valid,
                                                phase='init')

    self._results_dir = None
    self._current_results_dir = None
    self._previous_results_dir = None
    # True if the results_dir for this VT was created incrementally via clone of the
    # previous results_dir.
    self.is_incremental = False
Exemplo n.º 5
0
 def test_combine_single(self):
   key = CacheKey(id='a', hash='b')
   self.assertIs(key, CacheKey.combine_cache_keys([key]))