Ejemplo n.º 1
0
def test_read_profiles(build_worktree):
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("foo")
    assert build_config.cmake_args == \
            ["-DCMAKE_BUILD_TYPE=Debug", "-DWITH_FOO=ON"]
Ejemplo n.º 2
0
def test_read_profiles(build_worktree):
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("foo")
    assert build_config.cmake_args == \
            ["-DCMAKE_BUILD_TYPE=Debug", "-DWITH_FOO=ON"]
Ejemplo n.º 3
0
def test_local_cmake(build_worktree):
    qibuild.config.add_build_config("foo")
    foo_cmake = os.path.join(build_worktree.root, ".qi", "foo.cmake")
    with open(foo_cmake, "w") as fp:
        fp.write("")
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("foo")
    assert build_config.local_cmake == foo_cmake
Ejemplo n.º 4
0
def test_local_cmake(build_worktree):
    qibuild.config.add_build_config("foo")
    foo_cmake = os.path.join(build_worktree.root, ".qi", "foo.cmake")
    with open(foo_cmake, "w") as fp:
        fp.write("")
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("foo")
    assert build_config.local_cmake == foo_cmake
Ejemplo n.º 5
0
def test_read_profiles(build_worktree):
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("foo")
    cmake_args = build_config.cmake_args
    cmake_args = [x for x in cmake_args if "WITH" in x]
    assert cmake_args == \
            ["-DWITH_FOO=ON"]
Ejemplo n.º 6
0
def test_users_flags_taken_last(build_worktree):
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config.set_active_config("foo")
    build_config.user_flags = [("WITH_FOO", "OFF")]
    assert build_config.cmake_args == \
            ["-DCMAKE_BUILD_TYPE=Debug",
             "-DWITH_FOO=ON",
             "-DWITH_FOO=OFF"]
Ejemplo n.º 7
0
def test_read_profiles(build_worktree):
    """ Test Read Profiles """
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("foo")
    cmake_args = build_config.cmake_args
    cmake_args = [x for x in cmake_args if "VIRTUALENV" not in x]
    assert cmake_args == \
        ["-DCMAKE_BUILD_TYPE=Debug", "-DWITH_FOO=ON"]
Ejemplo n.º 8
0
def test_users_flags_taken_last(build_worktree):
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config.set_active_config("foo")
    build_config.user_flags = [("WITH_FOO", "OFF")]
    cmake_args = build_config.cmake_args
    cmake_args = [x for x in cmake_args if "WITH" in x]
    assert cmake_args == \
            ["-DWITH_FOO=ON", "-DWITH_FOO=OFF"]
Ejemplo n.º 9
0
def test_read_profiles(build_worktree):
    """ Test Read Profiles """
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("foo")
    cmake_args = build_config.cmake_args
    cmake_args = [x for x in cmake_args if "VIRTUALENV" not in x]
    assert cmake_args == \
        ["-DCMAKE_BUILD_TYPE=Debug", "-DWITH_FOO=ON"]
Ejemplo n.º 10
0
def test_users_flags_taken_last(build_worktree):
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config.set_active_config("foo")
    build_config.user_flags = [("WITH_FOO", "OFF")]
    assert build_config.cmake_args == \
            ["-DCMAKE_BUILD_TYPE=Debug",
             "-DWITH_FOO=ON",
             "-DWITH_FOO=OFF"]
Ejemplo n.º 11
0
def test_users_flags_taken_last(build_worktree):
    """ Test Users Flags Taken Last """
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config.set_active_config("foo")
    build_config.user_flags = [("WITH_FOO", "OFF")]
    cmake_args = build_config.cmake_args
    cmake_args = [x for x in cmake_args if "VIRTUALENV" not in x]
    assert cmake_args == \
        ["-DCMAKE_BUILD_TYPE=Debug",
         "-DWITH_FOO=ON",
         "-DWITH_FOO=OFF"]
Ejemplo n.º 12
0
def test_users_flags_taken_last(build_worktree):
    """ Test Users Flags Taken Last """
    build_worktree.configure_build_profile("foo", [("WITH_FOO", "ON")])
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    qibuild.config.add_build_config("foo", profiles=["foo"])
    build_config.set_active_config("foo")
    build_config.user_flags = [("WITH_FOO", "OFF")]
    cmake_args = build_config.cmake_args
    cmake_args = [x for x in cmake_args if "VIRTUALENV" not in x]
    assert cmake_args == \
        ["-DCMAKE_BUILD_TYPE=Debug",
         "-DWITH_FOO=ON",
         "-DWITH_FOO=OFF"]
Ejemplo n.º 13
0
def test_overwriting_remote_profiles(build_worktree):
    to_make = os.path.join(build_worktree.dot_qi, "manifests", "default")
    qisys.sh.mkdir(to_make, recursive=True)
    remote_xml = os.path.join(to_make, "manifest.xml")
    with open(remote_xml, "w") as fp:
        fp.write("<qibuild />")
    qibuild.profile.configure_build_profile(remote_xml, "bar", [("WITH_BAR", "ON")])
    local_xml = build_worktree.qibuild_xml
    qibuild.profile.configure_build_profile(local_xml, "bar", [("WITH_BAR", "OFF")])
    build_config = build_worktree.build_config

    qibuild.config.add_build_config("bar", profiles=["bar"])
    build_config.set_active_config("bar")
    assert build_config._profile_flags == [("WITH_BAR", "OFF")]
Ejemplo n.º 14
0
def test_overwriting_remote_profiles(build_worktree):
    to_make = os.path.join(build_worktree.dot_qi, "manifests", "default")
    qisys.sh.mkdir(to_make, recursive=True)
    remote_xml = os.path.join(to_make, "manifest.xml")
    with open(remote_xml, "w") as fp:
        fp.write("<qibuild />")
    qibuild.profile.configure_build_profile(remote_xml, "bar", [("WITH_BAR", "ON")])
    local_xml = build_worktree.qibuild_xml
    qibuild.profile.configure_build_profile(local_xml, "bar", [("WITH_BAR", "OFF")])
    build_config = build_worktree.build_config

    qibuild.config.add_build_config("bar", profiles=["bar"])
    build_config.set_active_config("bar")
    assert build_config._profile_flags == [("WITH_BAR", "OFF")]
Ejemplo n.º 15
0
def test_set_config_name(build_worktree):
    qibuild_xml = qisys.sh.get_config_path("qi", "qibuild.xml")
    with open(qibuild_xml, "w") as fp:
        fp.write("""
<qibuild>
  <defaults>
    <cmake generator="Ninja" />
  </defaults>
  <config name="vs2010">
    <cmake generator="Visual Studio 2010" />
  </config>
</qibuild>
""")
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    assert build_config.cmake_generator == "Ninja"
    build_config.set_active_config("vs2010")
    assert build_config.cmake_generator == "Visual Studio 2010"
Ejemplo n.º 16
0
def test_set_config_name(build_worktree):
    qibuild_xml = qisys.sh.get_config_path("qi", "qibuild.xml")
    with open(qibuild_xml, "w") as fp:
        fp.write("""
<qibuild>
  <defaults>
    <cmake generator="Ninja" />
  </defaults>
  <config name="vs2010">
    <cmake generator="Visual Studio 2010" />
  </config>
</qibuild>
""")
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    assert build_config.cmake_generator == "Ninja"
    build_config.set_active_config("vs2010")
    assert build_config.cmake_generator == "Visual Studio 2010"
Ejemplo n.º 17
0
def test_build_env(build_worktree):
    qibuild_xml = qisys.sh.get_config_path("qi", "qibuild.xml")
    with open(qibuild_xml, "w") as fp:
        fp.write(r"""
<qibuild>
  <defaults>
    <env path="c:\swig" />
  </defaults>
  <config name="mingw">
    <env path="c:\mingw\bin" />
  </config>
</qibuild>
""")
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("mingw")
    path = build_config.build_env["PATH"]
    assert r"c:\swig" in path
    assert r"c:\mingw\bin" in path
Ejemplo n.º 18
0
def test_build_env(build_worktree):
    qibuild_xml = qisys.sh.get_config_path("qi", "qibuild.xml")
    with open(qibuild_xml, "w") as fp:
        fp.write(r"""
<qibuild>
  <defaults>
    <env path="c:\swig" />
  </defaults>
  <config name="mingw">
    <env path="c:\mingw\bin" />
  </config>
</qibuild>
""")
    build_config = qibuild.build_config.CMakeBuildConfig(build_worktree)
    build_config.set_active_config("mingw")
    path = build_config.build_env["PATH"]
    assert r"c:\swig" in path
    assert r"c:\mingw\bin" in path