Example #1
0
def test_simple_reverse_deps(build_worktree):
    world = build_worktree.create_project("world")
    hello = build_worktree.create_project("hello", build_depends=["world"])

    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([world], ["build"], reverse=True) == \
        [hello]
    assert deps_solver.get_dep_projects([hello], ["build"], reverse=True) == \
        []
Example #2
0
def test_simple_reverse_deps(build_worktree):
    world = build_worktree.create_project("world")
    hello = build_worktree.create_project("hello", build_depends=["world"])

    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([world], ["build"], reverse=True) == \
        [hello]
    assert deps_solver.get_dep_projects([hello], ["build"], reverse=True) == \
        []
Example #3
0
def test_complex_reverse_deps(build_worktree):
    """ Test Complex Reverse Deps """
    libworld = build_worktree.create_project("libworld")
    libhello = build_worktree.create_project("libhello", build_depends=["libworld"])
    hello_plugin = build_worktree.create_project("hello-plugin")
    hello = build_worktree.create_project("hello",
                                          build_depends=["libworld", "libhello"], run_depends=["hello-plugin"])
    top_world = build_worktree.create_project("top_world", run_depends=["hello"])
    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([top_world], ["build"], reverse=True) == []
    assert deps_solver.get_dep_projects([hello], ["build"], reverse=True) == []
    assert deps_solver.get_dep_projects([hello], ["build", "runtime"], reverse=True) == [top_world]
    assert deps_solver.get_dep_projects([hello_plugin], ["runtime"], reverse=True) == [hello]
    assert deps_solver.get_dep_projects([libworld], ["build", "runtime"], reverse=True) == [hello, libhello]
Example #4
0
def test_complex_reverse_deps(build_worktree):
    """ Test Complex Reverse Deps """
    libworld = build_worktree.create_project("libworld")
    libhello = build_worktree.create_project("libhello", build_depends=["libworld"])
    hello_plugin = build_worktree.create_project("hello-plugin")
    hello = build_worktree.create_project("hello",
                                          build_depends=["libworld", "libhello"], run_depends=["hello-plugin"])
    top_world = build_worktree.create_project("top_world", run_depends=["hello"])
    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([top_world], ["build"], reverse=True) == []
    assert deps_solver.get_dep_projects([hello], ["build"], reverse=True) == []
    assert deps_solver.get_dep_projects([hello], ["build", "runtime"], reverse=True) == [top_world]
    assert deps_solver.get_dep_projects([hello_plugin], ["runtime"], reverse=True) == [hello]
    assert deps_solver.get_dep_projects([libworld], ["build", "runtime"], reverse=True) == [hello, libhello]
Example #5
0
def test_recurse_deps(build_worktree):
    """ Test Recurse Deps """
    gtest = build_worktree.create_project("gtest")
    libfoo = build_worktree.create_project("libfoo", build_depends=["gtest"])
    bar1 = build_worktree.create_project("bar", build_depends=["libfoo"])
    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([bar1], ["build", "runtime"]) == [gtest, libfoo, bar1]
Example #6
0
def test_ignore_missing_deps(build_worktree):
    world = build_worktree.create_project("world")
    hello = build_worktree.create_project("hello",
                                          build_depends=["world", "foo"])

    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([hello], ["build"]) == [world, hello]
Example #7
0
def test_empty_dep_is_single(build_worktree):
    build_worktree.create_project("world")
    hello = build_worktree.create_project("hello",
                                          build_depends=["world", "foo"])

    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([hello], list()) == [hello]
Example #8
0
def test_simple_deps(build_worktree):
    """ Test Simple Deps """
    world = build_worktree.create_project("world")
    hello = build_worktree.create_project("hello", build_depends=["world"])
    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([world], ["build"]) == [world]
    assert deps_solver.get_dep_projects([hello], ["build"]) == [world, hello]
Example #9
0
def test_simple_deps(build_worktree):
    """ Test Simple Deps """
    world = build_worktree.create_project("world")
    hello = build_worktree.create_project("hello", build_depends=["world"])
    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([world], ["build"]) == [world]
    assert deps_solver.get_dep_projects([hello], ["build"]) == [world, hello]
Example #10
0
def test_recurse_deps(build_worktree):
    """ Test Recurse Deps """
    gtest = build_worktree.create_project("gtest")
    libfoo = build_worktree.create_project("libfoo", build_depends=["gtest"])
    bar1 = build_worktree.create_project("bar", build_depends=["libfoo"])
    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([bar1], ["build", "runtime"]) == [gtest, libfoo, bar1]
Example #11
0
def test_runtime_deps(build_worktree):
    libworld = build_worktree.create_project("libworld")
    hello_plugin = build_worktree.create_project("hello-plugin")
    hello = build_worktree.create_project("hello", build_depends=["libworld"],
                                                   run_depends=["hello-plugin"])
    deps_solver = DepsSolver(build_worktree)
    dep_projects = deps_solver.get_dep_projects([hello], ["build", "runtime"])
    assert dep_projects == [hello_plugin, libworld, hello]
Example #12
0
def test_runtime_deps(build_worktree):
    libworld = build_worktree.create_project("libworld")
    hello_plugin = build_worktree.create_project("hello-plugin")
    hello = build_worktree.create_project("hello",
                                          build_depends=["libworld"],
                                          run_depends=["hello-plugin"])
    deps_solver = DepsSolver(build_worktree)
    dep_projects = deps_solver.get_dep_projects([hello], ["build", "runtime"])
    assert dep_projects == [hello_plugin, libworld, hello]
Example #13
0
def test_prefer_sources_over_packages(build_worktree, toolchains):
    toolchains.create("foo")
    world_package = toolchains.add_package("foo", "world")
    world_proj = build_worktree.create_project("world")
    hello_proj  = build_worktree.create_project("hello", build_depends=["world"])
    build_worktree.set_active_config("foo")
    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([hello_proj], ["build"]) == [world_proj, hello_proj]
    assert not deps_solver.get_dep_packages([hello_proj], ["build"])
Example #14
0
def test_complex_dep_solving2(build_worktree, toolchains):
    toolchains.create("foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    behavior_proj = build_worktree.create_project("behavior", build_depends=["libqiproject"])
    toolchains.add_package("foo", "libqiproject", build_depends=["libqipackage"])
    qipackage_proj = build_worktree.create_project("libqipackage")
    deps_solver = DepsSolver(build_worktree)
    build_worktree.set_active_config("foo")
    assert deps_solver.get_dep_projects([behavior_proj], ["build"]) == \
         [qipackage_proj, behavior_proj]
Example #15
0
def test_complex_dep_solving2(build_worktree, toolchains):
    """ Test Complex Dep Solving 2 """
    toolchains.create("foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    behavior_proj = build_worktree.create_project("behavior", build_depends=["libqiproject"])
    toolchains.add_package("foo", "libqiproject", build_depends=["libqipackage"])
    qipackage_proj = build_worktree.create_project("libqipackage")
    deps_solver = DepsSolver(build_worktree)
    build_worktree.set_active_config("foo")
    assert deps_solver.get_dep_projects([behavior_proj], ["build"]) == \
        [qipackage_proj, behavior_proj]
Example #16
0
def test_prefer_sources_over_packages(build_worktree, toolchains):
    """ Test Prefer Sources Over Packages """
    toolchains.create("foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    _world_package = toolchains.add_package("foo", "world")
    world_proj = build_worktree.create_project("world")
    hello_proj = build_worktree.create_project("hello", build_depends=["world"])
    build_worktree.set_active_config("foo")
    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([hello_proj], ["build"]) == [world_proj, hello_proj]
    assert not deps_solver.get_dep_packages([hello_proj], ["build"])
Example #17
0
def test_empty_dep_is_single(build_worktree):
    build_worktree.create_project("world")
    hello = build_worktree.create_project("hello", build_depends=["world", "foo"])

    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([hello], list()) == [hello]
Example #18
0
def test_ignore_missing_deps(build_worktree):
    world = build_worktree.create_project("world")
    hello = build_worktree.create_project("hello", build_depends=["world", "foo"])

    deps_solver = DepsSolver(build_worktree)
    assert deps_solver.get_dep_projects([hello], ["build"]) == [world, hello]