Beispiel #1
0
def test_get_build_use_spdlog(test_parent_dir: Path,
                              project_opener: ProjectOpener,
                              http_repo: RepoServer) -> None:
    proj = project_opener.open('project')
    http_repo.import_json_file(proj.root / 'catalog.json')
    proj.dds.repo_add(http_repo.url)
    tc_fname = 'gcc.tc.jsonc' if 'gcc' in toolchain.get_default_test_toolchain(
    ).name else 'msvc.tc.jsonc'
    proj.build(toolchain=test_parent_dir / tc_fname)
    proc.check_run([
        (proj.build_root / 'use-spdlog').with_suffix(paths.EXE_SUFFIX)
    ])
def test_config_template(project_opener: ProjectOpener) -> None:
    proj = project_opener.open('copy_only')
    generated_fpath = proj.build_root / '__dds/gen/info.hpp'
    assert not generated_fpath.is_file()
    proj.build()
    assert generated_fpath.is_file()

    # Check that re-running the build will not update the generated file (the
    # file's content has not changed. Re-generating it would invalidate the
    # cache and force a false-rebuild.)
    start_time = generated_fpath.stat().st_mtime
    sleep(0.1)  # Wait just long enough to register a new stamp time
    proj.build()
    new_time = generated_fpath.stat().st_mtime
    assert new_time == start_time
Beispiel #3
0
def test_cmake_simple(project_opener: ProjectOpener) -> None:
    proj = project_opener.open('projects/simple')
    proj.dds.pkg_import(proj.root)

    cm_proj_dir = project_opener.test_dir / 'projects/simple-cmake'
    proj.build_root.mkdir(exist_ok=True, parents=True)
    proj.dds.run(
        [
            'build-deps',
            proj.dds.cache_dir_arg,
            '[email protected]',
            ('-t', ':gcc'
             if 'gcc' in toolchain.get_default_toolchain().name else ':msvc'),
            f'--cmake=libraries.cmake',
        ],
        cwd=proj.build_root,
    )

    try:
        proc.check_run(['cmake', '-S', cm_proj_dir, '-B', proj.build_root])
    except FileNotFoundError:
        assert False, 'Running the integration tests requires a CMake executable'
    proc.check_run(['cmake', '--build', proj.build_root])
Beispiel #4
0
def test_project(project_opener: ProjectOpener) -> Project:
    return project_opener.open('projects/simple')
def test_simple_substitution(project_opener: ProjectOpener) -> None:
    simple = project_opener.open('simple')
    simple.build()
Beispiel #6
0
def test_project(project_opener: ProjectOpener) -> Project:
    return project_opener.open('projects/compile_deps')
Beispiel #7
0
def test_main(project_opener: ProjectOpener) -> None:
    proj = project_opener.open('main')
    proj.build()
    test_exe = proj.build_root.joinpath('test/testlib/calc' + paths.EXE_SUFFIX)
    assert test_exe.is_file()
    assert proc.run([test_exe]).returncode == 0