def test_default_build_dir(target: str, args: list, expected: str):
    # Check that the cheribsd build dir is correct
    config = _parse_arguments(args)
    target = target_manager.get_target(target, None, config, caller="test_default_arch")
    builddir = target.get_or_create_project(None, config).build_dir
    assert isinstance(builddir, Path)
    assert builddir.name == expected
예제 #2
0
def _sort_targets(targets: "typing.List[str]",
                  add_dependencies=False,
                  add_toolchain=True,
                  skip_sdk=False,
                  build_morello_from_source=False) -> "typing.List[str]":
    target_manager.reset()
    # print(real_targets)
    real_targets = list(
        target_manager.get_target(
            t, None, global_config, caller="_sort_targets") for t in targets)
    global_config.include_dependencies = add_dependencies
    global_config.include_toolchain_dependencies = add_toolchain
    global_config.skip_sdk = skip_sdk
    global_config.build_morello_firmware_from_source = build_morello_from_source
    for t in real_targets:
        if t.project_class._xtarget is None:
            continue
    for t in target_manager.targets:
        assert t.project_class._cached_full_deps is None
        assert t.project_class._cached_filtered_deps is None
    result = list(
        t.name
        for t in target_manager.get_all_targets(real_targets, global_config))
    # print("result = ", result)
    return result
def test_target_aliases_default_target(target_name, resolved_target):
    # Check that only some targets (e.g. llvm) have a default target and that we have to explicitly
    # specify the target name for e.g. cheribsd-* run-*, etc
    if resolved_target is None:
        # The target should not exist in the list of targets accepted on the command line
        assert target_name not in target_manager.target_names
        # However, if we use get_target_raw we should get the TargetAlias
        assert isinstance(target_manager.get_target_raw(target_name), MultiArchTargetAlias)
        assert target_manager.get_target_raw(target_name).project_class.default_architecture is None
    else:
        assert target_name in target_manager.target_names
        raw_target = target_manager.get_target_raw(target_name)
        assert isinstance(raw_target, MultiArchTargetAlias) or raw_target.name == resolved_target
        target = target_manager.get_target(target_name, None, _parse_arguments([]),
                                           caller="test_target_aliases_default_target")
        assert target.name == resolved_target
예제 #4
0
def _sort_targets(targets: "typing.List[str]",
                  add_dependencies=False,
                  add_toolchain=True,
                  skip_sdk=False) -> "typing.List[str]":
    target_manager.reset()
    # print(real_targets)
    real_targets = list(
        target_manager.get_target(
            t, None, global_config, caller="_sort_targets") for t in targets)
    global_config.include_dependencies = add_dependencies
    global_config.include_toolchain_dependencies = add_toolchain
    global_config.skip_sdk = skip_sdk
    for t in real_targets:
        # noinspection PyProtectedMember
        if t.project_class._xtarget is None:
            continue
        t.project_class._cached_deps = None
        t.get_dependencies(global_config)  # ensure they have been cached
    result = list(
        t.name
        for t in target_manager.get_all_targets(real_targets, global_config))
    # print("result = ", result)
    return result