예제 #1
0
파일: driver.py 프로젝트: AOSP8146/external
    def ForceEventsOnceForBuild(self, keywords, build_name,
                                os_type=task.OS_TYPE_CROS):
        """Force events with provided keywords to happen, with given build.

        @param keywords: iterable of event keywords to force
        @param build_name: instead of looking up builds to test, test this one.
        @param os_type: Type of the OS to test, default to cros.
        """
        branch_builds = None
        launch_control_builds = None
        if os_type == task.OS_TYPE_CROS:
            board, type, milestone, manifest = utils.ParseBuildName(build_name)
            branch_builds = {task.PickBranchName(type, milestone): [build_name]}
            logging.info('Testing build R%s-%s on %s', milestone, manifest,
                         board)
        else:
            logging.info('Build is not a ChromeOS build, try to parse as a '
                         'Launch Control build.')
            _,target,_ = utils.parse_launch_control_build(build_name)
            board = utils.parse_launch_control_target(target)[0]
            # Translate board name in build target to the actual board name.
            board = utils.ANDROID_TARGET_TO_BOARD_MAP.get(board, board)
            launch_control_builds = [build_name]
            logging.info('Testing Launch Control build %s on %s', build_name,
                         board)

        for e in self._events.itervalues():
            if e.keyword in keywords:
                e.Handle(self._scheduler, branch_builds, board, force=True,
                         launch_control_builds=launch_control_builds)
예제 #2
0
 def test_parse_launch_control_target(self):
     """Test parse_launch_control_target function."""
     target_tests = {
         ('shamu', 'userdebug'): 'shamu-userdebug',
         ('shamu', 'eng'): 'shamu-eng',
         ('shamu-board', 'eng'): 'shamu-board-eng',
         (None, None): 'bad_target',
         (None, None): 'target'
     }
     for result, target in target_tests.items():
         self.assertEqual(result, utils.parse_launch_control_target(target))
예제 #3
0
def parse_job_name(name):
    """Parse job name to get information including build, board and suite etc.

    Suite job created by run_suite follows the naming convention of:
    [build]-test_suites/control.[suite]
    For example: lumpy-release/R46-7272.0.0-test_suites/control.bvt
    The naming convention is defined in rpc_interface.create_suite_job.

    Test job created by suite job follows the naming convention of:
    [build]/[suite]/[test name]
    For example: lumpy-release/R46-7272.0.0/bvt/login_LoginSuccess
    The naming convention is defined in
    server/cros/dynamic_suite/tools.create_job_name

    Note that pgo and chrome-perf builds will fail the method. Since lab does
    not run test for these builds, they can be ignored.
    Also, tests for Launch Control builds have different naming convention.
    The build ID will be used as build_version.

    @param name: Name of the job.

    @return: A dictionary containing the test information. The keyvals include:
             build: Name of the build, e.g., lumpy-release/R46-7272.0.0
             build_version: The version of the build, e.g., R46-7272.0.0
             board: Name of the board, e.g., lumpy
             suite: Name of the test suite, e.g., bvt

    """
    info = {}
    suite_job_regex = '([^/]*/[^/]*(?:/\d+)?)-test_suites/control\.(.*)'
    test_job_regex = '([^/]*/[^/]*(?:/\d+)?)/([^/]+)/.*'
    match = re.match(suite_job_regex, name)
    if not match:
        match = re.match(test_job_regex, name)
    if match:
        info['build'] = match.groups()[0]
        info['suite'] = match.groups()[1]
        info['build_version'] = info['build'].split('/')[1]
        try:
            info['board'], _, _, _ = ParseBuildName(info['build'])
        except ParseBuildNameException:
            # Try to parse it as Launch Control build
            # Launch Control builds have name format:
            # branch/build_target-build_type/build_id.
            try:
                _, target, build_id = utils.parse_launch_control_build(
                        info['build'])
                build_target, _ = utils.parse_launch_control_target(target)
                if build_target:
                    info['board'] = build_target
                    info['build_version'] = build_id
            except ValueError:
                pass
    return info