third_party/blink/tools/blinkpy/tool/commands/copy_existing_baselines.py
def _copy_existing_baseline(self, port_name, test_name, suffix):
        """Copies the baseline for the given builder to all "predecessor" directories."""
        baseline_directory = self._tool.port_factory.get(
            port_name).baseline_version_dir()
        ports = [
            self._port_for_primary_baseline(baseline) for baseline in self.
            _immediate_predecessors_in_fallback(baseline_directory)
        ]

        old_baselines = []
        new_baselines = []

        # Need to gather all the baseline paths before modifying the filesystem since
        # the modifications can affect the results of port.expected_filename.
        for port in ports:
            old_baseline = port.expected_filename(test_name, '.' + suffix)
            if not self._tool.filesystem.exists(old_baseline):
                _log.debug('No existing baseline for %s.', test_name)
                continue

            new_baseline = self._tool.filesystem.join(
                port.baseline_version_dir(),
                self._file_name_for_expected_result(test_name, suffix))
            if self._tool.filesystem.exists(new_baseline):
                _log.debug('Existing baseline at %s, not copying over it.',
                           new_baseline)
                continue

            full_expectations = TestExpectations(port)
            if ResultType.Skip in full_expectations.get_expectations(
                    test_name).results:
                _log.debug('%s is skipped on %s.', test_name, port.name())
                continue
            if port.skipped_due_to_smoke_tests(test_name):
                _log.debug('%s is skipped on %s.', test_name, port.name())
                continue

            old_baselines.append(old_baseline)
            new_baselines.append(new_baseline)

        for i in range(len(old_baselines)):
            old_baseline = old_baselines[i]
            new_baseline = new_baselines[i]

            _log.debug('Copying baseline from %s to %s.', old_baseline,
                       new_baseline)
            self._tool.filesystem.maybe_make_directory(
                self._tool.filesystem.dirname(new_baseline))
            self._tool.filesystem.copyfile(old_baseline, new_baseline)
Copies the baseline for the given builder to all "predecessor" directories.
Copies the baseline for the given builder to all "predecessor" directories.
Copies the baseline for the given builder to all " predecessor " directories .
def _copy_existing_baseline(self, port_name, test_name, suffix):
        baseline_directory = self._tool.port_factory.get(
            port_name).baseline_version_dir()
        ports = [
            self._port_for_primary_baseline(baseline) for baseline in self.
            _immediate_predecessors_in_fallback(baseline_directory)
        ]
        old_baselines = []
        new_baselines = []
        for port in ports:
            old_baseline = port.expected_filename(test_name, '.' + suffix)
            if not self._tool.filesystem.exists(old_baseline):
                _log.debug('No existing baseline for %s.', test_name)
                continue
            new_baseline = self._tool.filesystem.join(
                port.baseline_version_dir(),
                self._file_name_for_expected_result(test_name, suffix))
            if self._tool.filesystem.exists(new_baseline):
                _log.debug('Existing baseline at %s, not copying over it.',
                           new_baseline)
                continue
            full_expectations = TestExpectations(port)
            if ResultType.Skip in full_expectations.get_expectations(
                    test_name).results:
                _log.debug('%s is skipped on %s.', test_name, port.name())
                continue
            if port.skipped_due_to_smoke_tests(test_name):
                _log.debug('%s is skipped on %s.', test_name, port.name())
                continue
            old_baselines.append(old_baseline)
            new_baselines.append(new_baseline)
        for i in range(len(old_baselines)):
            old_baseline = old_baselines[i]
            new_baseline = new_baselines[i]
            _log.debug('Copying baseline from %s to %s.', old_baseline,
                       new_baseline)
            self._tool.filesystem.maybe_make_directory(
                self._tool.filesystem.dirname(new_baseline))
            self._tool.filesystem.copyfile(old_baseline, new_baseline)
def _copy_existing_baseline ( self , port_name , test_name , suffix ) : baseline_directory = self . _tool . port_factory . get ( port_name ) . baseline_version_dir ( ) ports = [ self . _port_for_primary_baseline ( baseline ) for baseline in self . _immediate_predecessors_in_fallback ( baseline_directory ) ] old_baselines = [ ] new_baselines = [ ] for port in ports : old_baseline = port . expected_filename ( test_name , '.' + suffix ) if not self . _tool . filesystem . exists ( old_baseline ) : _log . debug ( 'No existing baseline for %s.' , test_name ) continue new_baseline = self . _tool . filesystem . join ( port . baseline_version_dir ( ) , self . _file_name_for_expected_result ( test_name , suffix ) ) if self . _tool . filesystem . exists ( new_baseline ) : _log . debug ( 'Existing baseline at %s, not copying over it.' , new_baseline ) continue full_expectations = TestExpectations ( port ) if ResultType . Skip in full_expectations . get_expectations ( test_name ) . results : _log . debug ( '%s is skipped on %s.' , test_name , port . name ( ) ) continue if port . skipped_due_to_smoke_tests ( test_name ) : _log . debug ( '%s is skipped on %s.' , test_name , port . name ( ) ) continue old_baselines . append ( old_baseline ) new_baselines . append ( new_baseline ) for i in range ( len ( old_baselines ) ) : old_baseline = old_baselines [ i ] new_baseline = new_baselines [ i ] _log . debug ( 'Copying baseline from %s to %s.' , old_baseline , new_baseline ) self . _tool . filesystem . maybe_make_directory ( self . _tool . filesystem . dirname ( new_baseline ) ) self . _tool . filesystem . copyfile ( old_baseline , new_baseline )
Copies the baseline for the given builder to all "predecessor" directories.
Copies the baseline for the given builder to all " predecessor " directories .
"""Copies the baseline for the given builder to all "predecessor" directories.""" # Need to gather all the baseline paths before modifying the filesystem since # the modifications can affect the results of port.expected_filename.
self
port_name
test_name
suffix