def test_build_host_tools(build_worktree, fake_ctc): build_worktree.add_test_project("footool") usefootool_proj = build_worktree.add_test_project("usefootool") cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree, [usefootool_proj]) build_worktree.set_active_config("fake-ctc") cmake_builder.build_host_tools() cmake_builder.configure() cmake_builder.build()
def test_default_install(build_worktree, toolchains, tmpdir): hello_proj = build_worktree.create_project("hello", run_depends="bar") toolchains.create("foo") build_worktree.set_active_config("foo") toolchains.add_package("foo", "bar") cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree, [hello_proj]) cmake_builder.configure() cmake_builder.build() cmake_builder.install(tmpdir.strpath)
def test_default_install(build_worktree, toolchains, tmpdir): hello_proj = build_worktree.create_project("hello", run_depends="bar") toolchains.create("foo") qibuild.config.add_build_config("foo", toolchain="foo") build_worktree.set_active_config("foo") toolchains.add_package("foo", "bar") cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree, [hello_proj]) cmake_builder.configure() cmake_builder.build() cmake_builder.install(tmpdir.strpath)
def test_forward_args_to_configure(): build_worktree = mock.Mock() deps_solver = mock.Mock() hello_proj = mock.Mock() deps_solver.get_dep_projects.return_value = [hello_proj] cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree, [hello_proj]) cmake_builder.deps_solver = deps_solver cmake_builder.configure(trace_cmake=True) hello_proj.configure.assert_called_with(trace_cmake=True)
def test_check_configure_called_on_runtime_deps(build_worktree): hello_proj = build_worktree.create_project("hello", run_depends=["bar"]) build_worktree.create_project("bar") cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree, [hello_proj]) # qibuild configure --single cmake_builder.dep_types = [] cmake_builder.configure() # qibuild make cmake_builder.dep_types = ["build", "runtime"] # pylint: disable-msg=E1101 with pytest.raises(qibuild.cmake_builder.NotConfigured): cmake_builder.build()
def test_calls_configure(): build_worktree = mock.Mock() hello_proj = mock.Mock() world_proj = mock.Mock() deps_solver = mock.Mock() deps_solver.get_dep_projects.return_value = [world_proj, hello_proj] cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree, [hello_proj]) cmake_builder.deps_solver = deps_solver cmake_builder.configure() assert world_proj.configure.called assert hello_proj.configure.called
def test_generate_symbols(build_worktree, tmpdir): build_worktree.add_test_project("world") cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree) build_config = cmake_builder.build_config build_config.build_type = "Release" build_config.user_flags = [("QI_WITH_DEBUG_INFO", "ON")] world_proj = build_worktree.get_build_project("world") cmake_builder.projects = [world_proj] cmake_builder.configure() cmake_builder.build() dest = tmpdir.join("dest").strpath installed_files = cmake_builder.install(dest, components=["runtime"]) symbols_archive = tmpdir.join("dest", "world.symbols.zip").strpath res = qibuild.breakpad.gen_symbol_archive(base_dir=dest, output=symbols_archive) assert os.path.exists(res)
def test_generate_symbols(build_worktree, tmpdir): build_worktree.add_test_project("world") cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree) build_config = cmake_builder.build_config build_config.build_type = "Release" build_config.user_flags = [("QI_WITH_DEBUG_INFO", "ON")] world_proj = build_worktree.get_build_project("world") cmake_builder.projects = [world_proj] cmake_builder.configure() cmake_builder.build() dest = tmpdir.join("dest").strpath cmake_builder.install(dest, components=["runtime"]) symbols_archive = tmpdir.join("dest", "world.symbols.zip").strpath res = qibuild.breakpad.gen_symbol_archive(base_dir=dest, output=symbols_archive) assert os.path.exists(res)
def test_write_dependencies_cmake_first(): build_worktree = mock.Mock() deps_solver = mock.Mock() hello_proj = mock.Mock() sdk_dirs = [ "/path/to/hello/build/sdk", "/path/to/world/build/sdk" ] deps_solver.get_dep_projects.return_value = [hello_proj] deps_solver.get_sdk_dirs.return_value = sdk_dirs cmake_builder = qibuild.cmake_builder.CMakeBuilder(build_worktree, [hello_proj]) cmake_builder.deps_solver = deps_solver cmake_builder.configure() hello_proj.write_dependencies_cmake.assert_called_with(sdk_dirs)