def test_write_cc_system_setup_file(platform_config, docker_config, tmp_path):
    """Check if the system setup file was written to directory."""
    sysroot_dir, ros_workspace_dir = setup_mock_sysroot(tmp_path)
    sysroot_compiler = SysrootCompiler(
        str(tmp_path), str(ros_workspace_dir), platform_config, docker_config)
    setup_script_path = sysroot_compiler._write_cc_system_setup_script()

    assert isinstance(setup_script_path, Path)
    assert setup_script_path.exists() is True
Пример #2
0
def test_sysroot_compiler_constructor(platform_config, docker_config, tmpdir):
    """Test the SysrootCompiler constructor assuming valid path setup."""
    # Create mock directories and files
    sysroot_dir, ros_workspace_dir = setup_mock_sysroot(tmpdir)
    sysroot_compiler = SysrootCompiler(str(sysroot_dir),
                                       str(ros_workspace_dir), platform_config,
                                       docker_config)

    assert isinstance(sysroot_compiler.get_build_setup_script_path(), Path)
    assert isinstance(sysroot_compiler.get_system_setup_script_path(), Path)
def main():
    """Start the cross-compilation workflow."""
    # Configuration
    parser = create_arg_parser()
    args = parser.parse_args()
    platform = Platform(args.arch, args.os, args.rosdistro, args.rmw)
    docker_args = DockerConfig(args.arch, args.os, args.rosdistro,
                               args.sysroot_base_image,
                               args.docker_network_mode, args.sysroot_nocache)

    # Main pipeline
    sysroot_create = SysrootCompiler(
        cc_root_dir=args.sysroot_path,
        ros_workspace_dir=args.ros_workspace,
        platform=platform,
        docker_config=docker_args,
        custom_setup_script_path=args.custom_setup_script)
    sysroot_create.execute_cc_pipeline()
Пример #4
0
def main():
    """Start the cross-compilation workflow."""
    # Configuration
    parser = create_arg_parser()
    args = parser.parse_args()
    platform = Platform(args)
    docker_args = DockerConfig(args)

    # Main pipeline
    sysroot_create = SysrootCompiler(cc_root_dir=args.sysroot_path,
                                     ros_workspace_dir=args.ros2_workspace,
                                     platform=platform,
                                     docker_config=docker_args)
    sysroot_create.execute_cc_pipeline()

    logger.info(
        CC_COMPLETE_STRING.substitute(system_setup_script_path=sysroot_create.
                                      get_system_setup_script_path(),
                                      build_setup_file_path=sysroot_create.
                                      get_build_setup_script_path()))