Exemplo n.º 1
0
def test_read_cmake_files(cmake_build: Path) -> None:
    api = API("cmake", cmake_build)
    api.parse_doc()
    assert api.query()
    api.read_reply()

    import platform

    system = platform.system()
    if system == "Linux":
        assert "GNU" in api.get_variable_doc("CMAKE_CXX_COMPILER_ID")
    elif system == "Windows":
        assert "MSVC" in api.get_variable_doc("CMAKE_CXX_COMPILER_ID")
    elif system == "Darwin":
        assert "Clang" in api.get_variable_doc("CMAKE_CXX_COMPILER_ID")
    else:
        raise RuntimeError("Unexpected system")
Exemplo n.º 2
0
def test_parse_variables(cmake_build: Path) -> None:
    api = API("cmake", cmake_build)
    api.parse_doc()

    p = subprocess.run(
        ["cmake", "--help-variable-list"],
        universal_newlines=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
    )
    variables = p.stdout.strip().split("\n")

    for variable in variables:
        if "<" in variable:
            continue
        assert api.get_variable_doc(variable) is not None, f"{variable} not found"

    assert api.get_variable_doc("BUILD_SHARED_LIBS") is not None
    assert api.get_variable_doc("not_existing_variable") is None
Exemplo n.º 3
0
def test_read_variable(cmake_build: Path) -> None:
    api = API("cmake", cmake_build)
    assert api.query()
    assert api.read_reply()

    assert api.get_variable_doc("testproject_BINARY_DIR")