def load_baseline(self):
        """The baseline file lists the services we know and
        whether (and how) they are sandboxed.
        """

        def load(path):
            """Load baseline from |path| and return its fields and dictionary.

            @param path: The baseline to load.
            """
            logging.info('Loading baseline %s', path)
            reader = csv.DictReader(open(path))
            return reader.fieldnames, dict((d['exe'], d) for d in reader
                                           if not d['exe'].startswith('#'))

        baseline_path = os.path.join(self.bindir, 'baseline')
        fields, ret = load(baseline_path)

        board = utils.get_current_board()
        baseline_path += '.' + board
        if os.path.exists(baseline_path):
            new_fields, new_entries = load(baseline_path)
            if new_fields != fields:
                raise error.TestError('header mismatch in %s' % baseline_path)
            ret.update(new_entries)

        return fields, ret
    def __init__(self, test_name, board=None, expectation_file_path=None):
        """Initialize a perf expectation checker.

           @param test_name: the name of the performance test,
               will be used to load the expectation.
           @param board: an alternative board name, will be used
               to load the expectation. Defaults to the board name
               in /etc/lsb-release.
           @expectation_file_path: an alternative expectation file.
               Defaults to perf_expectations.json under the same folder
               of this file.
        """
        self._expectations = {}
        if expectation_file_path:
            self._expectation_file_path = expectation_file_path
        else:
            self._expectation_file_path = os.path.abspath(
                os.path.join(os.path.dirname(__file__),
                             'perf_expectations.json'))
        self._board = board or utils.get_current_board()
        self._test_name = test_name
        assert self._board, 'Failed to get board name.'
        assert self._test_name, ('You must specify a test name when initialize'
                                 ' perf_expectation_checker.')
        self._load_perf_expectations_file()
예제 #3
0
    def run_once(self):
        """Test main loop."""
        # TODO: Remove the following block once the bug(crbug.com/594336)
        # is fixed.
        boards_to_skip = ['cyan-cheets']
        dut_board = utils.get_current_board()
        if dut_board in boards_to_skip:
            logging.info("Skipping test run on this board.")
            return

        with shill_context.stopped_shill():
            try:
                os.remove(self.DEFAULT_PROFILE_PATH)
            except OSError as e:
                if e.errno != errno.ENOENT:
                    raise e
        shill = shill_proxy.ShillProxy.get_proxy()
        start_time = time.time()
        profile = None
        while time.time() - start_time < self.PROFILE_LOAD_TIMEOUT_SECONDS:
            if shill.get_profiles():
                with open(self.DEFAULT_PROFILE_PATH) as f:
                    profile = f.read()
                    if profile:
                        break

            time.sleep(1)
        else:
            if profile is None:
                raise error.TestFail('shill should load a profile within '
                                     '%d seconds.' %
                                     self.PROFILE_LOAD_TIMEOUT_SECONDS)
            else:
                raise error.TestFail('shill profile is still empty after '
                                     '%d seconds.' %
                                     self.PROFILE_LOAD_TIMEOUT_SECONDS)

        logging.info('Profile contents after %d seconds:\%s',
                     time.time() - start_time, profile)
        for setting in self.EXPECTED_SETTINGS:
            if setting not in profile:
                logging.error('Did not find setting %s', setting)
                logging.error('Full profile contents are:\n%s', profile)
                raise error.TestFail('Missing setting(s) in default profile.')
예제 #4
0
    def is_skipping_test(self, codec):
        """Determine whether this test should skip.

        @param codec: the codec to be tested. Example values: 'vp8', 'vp9', 'h264'.
        """
        blacklist = [
                # (board, milestone, codec); None if don't care.

                # kevin did support hw decode, but not ready in M54 and M55.
                ('kevin', 54, 'vp8'),('kevin', 55, 'vp8')
        ]

        entry = (utils.get_current_board(), utils.get_chrome_milestone(), codec)
        for black_entry in blacklist:
            for i, to_match in enumerate(black_entry):
                if to_match and str(to_match) != entry[i]:
                    break
            else:
                return True

        return False
예제 #5
0
    def is_skipping_test(self):
        """Determine whether this test should skip."""
        blacklist = [
            # (board, milestone); None if don't care.

            # kevin did support hw decode, but not ready in M54 and M55.
            ('kevin', 54),
            ('kevin', 55),

            # elm and hana support hw decode since M57.
            ('elm', 56),
            ('hana', 56),
        ]

        entry = (utils.get_current_board(), utils.get_chrome_milestone())
        for black_entry in blacklist:
            for i, to_match in enumerate(black_entry):
                if to_match and str(to_match) != entry[i]:
                    break
            else:
                return True

        return False