def test_simple(qitoolchain_action, svn_server, feed, record_messages):
    """ Test Simple """
    toolchain = qitoolchain.toolchain.Toolchain("foo")
    boost_url = svn_server.create_repo("boost")
    svn_server.commit_file("boost", "version.hpp", "")
    qt_url = svn_server.create_repo("qt")
    boost_package = qitoolchain.svn_package.SvnPackage("boost")
    boost_package.url = boost_url
    qt_package = qitoolchain.svn_package.SvnPackage("qt")
    qt_package.url = qt_url
    feed.add_svn_package(boost_package)
    feed.add_svn_package(qt_package)
    toolchain.update(feed.url)
    record_messages.reset()
    rc = qitoolchain_action("svn-status", "foo", retcode=True)
    assert rc == 0
    assert not record_messages.find("qt")
    assert not record_messages.find("boost")
    assert record_messages.find("All OK")
    # Now create a problem in the svn repo:
    boost_path = toolchain.get_package("boost").path
    version_hpp = os.path.join(boost_path, "version.hpp")
    os.remove(version_hpp)
    record_messages.reset()
    rc = qitoolchain_action("svn-status", "foo", retcode=True)
    assert rc != 0
    assert record_messages.find("boost")
    assert record_messages.find("version.hpp")
Exemplo n.º 2
0
def test_update_local_ctc(qitoolchain_action, tmpdir):
    """ Test Update Locat Cross Toolchain """
    ctc_path = tmpdir.join("ctc").ensure(dir=True)
    ctc_path.join("toolchain.xml").write("""\n<toolchain>\n  <package name="ctc" directory="." />\n</toolchain>\n""")
    toolchain_xml = ctc_path.join("toolchain.xml")
    qitoolchain_action("create", "ctc", toolchain_xml.strpath)
    qitoolchain_action("update", "ctc", toolchain_xml.strpath)
    assert ctc_path.check(dir=True)
Exemplo n.º 3
0
def test_update_local_ctc(qitoolchain_action, tmpdir):
    """ Test Update Locat Cross Toolchain """
    ctc_path = tmpdir.join("ctc").ensure(dir=True)
    ctc_path.join("toolchain.xml").write(
        """\n<toolchain>\n  <package name="ctc" directory="." />\n</toolchain>\n"""
    )
    toolchain_xml = ctc_path.join("toolchain.xml")
    qitoolchain_action("create", "ctc", toolchain_xml.strpath)
    qitoolchain_action("update", "ctc", toolchain_xml.strpath)
    assert ctc_path.check(dir=True)
def test_simple(qitoolchain_action):
    """ Test Simple """
    qitoolchain_action("create", "foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    word_package = qitoolchain_action.get_test_package("world")
    qitoolchain_action("add-package", "-c", "foo", word_package)
    tc = qitoolchain.get_toolchain("foo")
    world_package = tc.packages[0]
    assert world_package.name == "world"
    assert world_package.path
def test_legacy_no_name_given(tmpdir, qitoolchain_action):
    """ Test Legacy No Name Given """
    qitoolchain_action("create", "foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    world = tmpdir.mkdir("world")
    world.ensure("include", "world.h", file=True)
    world.ensure("lib", "libworld.so", file=True)
    archive = qisys.archive.compress(world.strpath)
    error = qitoolchain_action("add-package", "-c", "foo", archive, raises=True)
    assert "Must specify --name" in error
def test_simple(qitoolchain_action):
    """ Test Simple """
    qitoolchain_action("create", "foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    word_package = qitoolchain_action.get_test_package("world")
    qitoolchain_action("add-package", "-c", "foo", word_package)
    tc = qitoolchain.get_toolchain("foo")
    world_package = tc.packages[0]
    assert world_package.name == "world"
    assert world_package.path
def test_legacy_happy_path(tmpdir, qitoolchain_action):
    """ Test Legacy Happy Path """
    qitoolchain_action("create", "foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    world = tmpdir.mkdir("world")
    world.ensure("include", "world.h", file=True)
    world.ensure("lib", "libworld.so", file=True)
    archive = qisys.archive.compress(world.strpath)
    qitoolchain_action("add-package", "-c", "foo", "--name", "world", archive)
    tc = qitoolchain.get_toolchain("foo")
    world_package = tc.get_package("world")
    assert os.path.exists(os.path.join(world_package.path, "include", "world.h"))
    assert os.path.exists(os.path.join(world_package.path, "lib", "libworld.so"))
def test_legacy_no_name_given(tmpdir, qitoolchain_action):
    """ Test Legacy No Name Given """
    qitoolchain_action("create", "foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    world = tmpdir.mkdir("world")
    world.ensure("include", "world.h", file=True)
    world.ensure("lib", "libworld.so", file=True)
    archive = qisys.archive.compress(world.strpath)
    error = qitoolchain_action("add-package",
                               "-c",
                               "foo",
                               archive,
                               raises=True)
    assert "Must specify --name" in error
def test_legacy_happy_path(tmpdir, qitoolchain_action):
    """ Test Legacy Happy Path """
    qitoolchain_action("create", "foo")
    qibuild.config.add_build_config("foo", toolchain="foo")
    world = tmpdir.mkdir("world")
    world.ensure("include", "world.h", file=True)
    world.ensure("lib", "libworld.so", file=True)
    archive = qisys.archive.compress(world.strpath)
    qitoolchain_action("add-package", "-c", "foo", "--name", "world", archive)
    tc = qitoolchain.get_toolchain("foo")
    world_package = tc.get_package("world")
    assert os.path.exists(
        os.path.join(world_package.path, "include", "world.h"))
    assert os.path.exists(
        os.path.join(world_package.path, "lib", "libworld.so"))
Exemplo n.º 10
0
def test_simple(qitoolchain_action, record_messages):
    """ Test Simple """
    qitoolchain_action("create", "foo")
    qitoolchain_action("create", "bar")
    qibuild.config.add_build_config("foo", toolchain="foo")
    world_package = qitoolchain_action.get_test_package("world")
    qitoolchain_action("add-package", "-c", "foo", world_package)
    record_messages.reset()
    qitoolchain_action("info")
    assert record_messages.find("foo")
    assert record_messages.find("world")
    assert record_messages.find("bar")
    record_messages.reset()
    qitoolchain_action("info", "foo")
    assert record_messages.find("foo")
    assert record_messages.find("world")
    assert not record_messages.find("bar")
def test_flags_package(tmpdir, qitoolchain_action):
    """ Test Flags Package """
    qitoolchain_action("create", "foo")
    c11_flags = tmpdir.mkdir("c++11-flags")
    c11_flags.join("config.cmake").write("""\nset(CMAKE_CXX_FLAGS "-std=gnu++11")\n""")
    c11_flags.join("package.xml").write("""\n<package name="c++11-flags" toolchain_file="config.cmake" />\n""")
    flags_package = tmpdir.join("c++11-flags.zip")
    qisys.archive.compress(c11_flags.strpath, output=flags_package.strpath, flat=True)
    qitoolchain_action("add-package", "--toolchain", "foo", flags_package.strpath)
    foo_toolchain = qitoolchain.get_toolchain("foo")
    tc_file = foo_toolchain.toolchain_file
    with open(tc_file, "r") as fp:
        contents = fp.read()
    included_file = None
    for line in contents.splitlines():
        match = re.match(r'include\("(.*)"\)', line)
        if match:
            included_file = match.groups()[0]
    assert os.path.exists(included_file)
Exemplo n.º 12
0
def test_udpate_all_toolchains(qitoolchain_action, feed, record_messages):
    """ Test Update All Toochains """
    qitoolchain_action("create", "foo", feed.url)
    qitoolchain_action("create", "bar")
    qitoolchain_action("update")
    assert record_messages.find("These toolchains will be skipped because they have no feed: bar")
    assert record_messages.find("Updating foo")
Exemplo n.º 13
0
def test_udpate_all_toolchains(qitoolchain_action, feed, record_messages):
    """ Test Update All Toochains """
    qitoolchain_action("create", "foo", feed.url)
    qitoolchain_action("create", "bar")
    qitoolchain_action("update")
    assert record_messages.find(
        "These toolchains will be skipped because they have no feed: bar")
    assert record_messages.find("Updating foo")
def test_flags_package(tmpdir, qitoolchain_action):
    """ Test Flags Package """
    qitoolchain_action("create", "foo")
    c11_flags = tmpdir.mkdir("c++11-flags")
    c11_flags.join("config.cmake").write(
        """\nset(CMAKE_CXX_FLAGS "-std=gnu++11")\n""")
    c11_flags.join("package.xml").write(
        """\n<package name="c++11-flags" toolchain_file="config.cmake" />\n""")
    flags_package = tmpdir.join("c++11-flags.zip")
    qisys.archive.compress(c11_flags.strpath,
                           output=flags_package.strpath,
                           flat=True)
    qitoolchain_action("add-package", "--toolchain", "foo",
                       flags_package.strpath)
    foo_toolchain = qitoolchain.get_toolchain("foo")
    tc_file = foo_toolchain.toolchain_file
    with open(tc_file, "r") as fp:
        contents = fp.read()
    included_file = None
    for line in contents.splitlines():
        match = re.match(r'include\("(.*)"\)', line)
        if match:
            included_file = match.groups()[0]
    assert os.path.exists(included_file)
Exemplo n.º 15
0
def test_switching_to_git_feed(qitoolchain_action, git_server, feed, record_messages):
    """ Test Swith To Git Feed """
    boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44")
    feed.add_package(boost_package)
    qitoolchain_action("create", "foo", feed.feed_xml.strpath)
    toolchain_repo = git_server.create_repo("toolchains.git")
    boost_package.version = "1.45"
    feed.add_package(boost_package)
    git_server.push_file("toolchains.git", "feeds/foo.xml", feed.feed_xml.read())
    qitoolchain_action("update", "--feed-name", "foo", "foo", toolchain_repo.clone_url)
    assert record_messages.find("from 1.44 to 1.45")
    qitoolchain_action("info", "foo")
    assert record_messages.find("on master")
Exemplo n.º 16
0
def test_switching_to_git_feed(qitoolchain_action, git_server, feed,
                               record_messages):
    """ Test Swith To Git Feed """
    boost_package = qitoolchain.qipackage.QiPackage("boost", version="1.44")
    feed.add_package(boost_package)
    qitoolchain_action("create", "foo", feed.feed_xml.strpath)
    toolchain_repo = git_server.create_repo("toolchains.git")
    boost_package.version = "1.45"
    feed.add_package(boost_package)
    git_server.push_file("toolchains.git", "feeds/foo.xml",
                         feed.feed_xml.read())
    qitoolchain_action("update", "--feed-name", "foo", "foo",
                       toolchain_repo.clone_url)
    assert record_messages.find("from 1.44 to 1.45")
    qitoolchain_action("info", "foo")
    assert record_messages.find("on master")
Exemplo n.º 17
0
def test_no_toolchain(qitoolchain_action, record_messages):
    """ Test No Toolchain """
    qitoolchain_action("list")
    assert record_messages.find("No toolchain yet")
Exemplo n.º 18
0
def test_list(qitoolchain_action, record_messages):
    """ Test List """
    qitoolchain_action("create", "foo")
    qitoolchain_action("list")
    assert record_messages.find(r"\* foo")
def test_simple(qitoolchain_action, toolchains, record_messages):
    """ Test Simple """
    toolchains.create("foo")
    toolchains.add_package("foo", "boost", package_version="1.57-r3")
    qitoolchain_action("package-info", "--toolchain", "foo", "boost")
    assert record_messages.find("boost 1.57-r3")
Exemplo n.º 20
0
def test_update_no_feed(qitoolchain_action):
    """ Test Update No Feed """
    qitoolchain_action("create", "foo")
    error = qitoolchain_action("update", "foo", raises=True)
    assert "Could not find feed" in error
Exemplo n.º 21
0
def test_update_no_feed(qitoolchain_action):
    """ Test Update No Feed """
    qitoolchain_action("create", "foo")
    error = qitoolchain_action("update", "foo", raises=True)
    assert "Could not find feed" in error