Beispiel #1
0
    def test_common_msgs_against_installed(self):
        # uses core ros stacks installed in setUp
        # tries to build common_msgs in separate workspace
        try:
            # create another workspace than self.rootdir
            other_root_dir = tempfile.mkdtemp()
            other_src_dir = os.path.join(other_root_dir, 'src')
            create_catkin_workspace(other_src_dir)
            other_build_dir = os.path.join(other_root_dir, 'build')
            other_buildspace_dir = os.path.join(other_build_dir, 'buildspace')
            shutil.copytree(os.path.join(self.workspacedir, 'common_msgs'),
                            os.path.join(other_src_dir, 'common_msgs'))
            out = self.cmake(cwd=other_build_dir,
                             srcdir=other_src_dir)
            out = succeed(MAKE_CMD, cwd=other_build_dir)
            assert_exists(other_buildspace_dir,
                          PYTHON_INSTALL_PATH + '/nav_msgs/msg/_GridCells.py',
                          'include/nav_msgs/GridCells.h')

            out = succeed(MAKE_CMD + ['install'], cwd=other_build_dir)

            assert_exists(self.installdir,
                          'include/geometry_msgs/PointStamped.h',
                          PYTHON_INSTALL_PATH + '/geometry_msgs/msg/_PointStamped.py',
                          'share/geometry_msgs/msg/PointStamped.msg',
                          # 'share/typelibxml/geometry_msgs/PointStamped.xml',
                          )
        finally:
            # pass
            shutil.rmtree(other_root_dir)
Beispiel #2
0
    def test_common_msgs_against_installed(self):
        # uses core ros stacks installed in setUp
        # tries to build common_msgs in separate workspace
        try:
            # create another workspace than self.rootdir
            other_root_dir = tempfile.mkdtemp()
            other_src_dir = os.path.join(other_root_dir, 'src')
            create_catkin_workspace(other_src_dir)
            other_build_dir = os.path.join(other_root_dir, 'build')
            other_develspace_dir = os.path.join(other_build_dir, 'devel')
            shutil.copytree(os.path.join(self.workspacedir, 'common_msgs'),
                            os.path.join(other_src_dir, 'common_msgs'))
            out = self.cmake(cwd=other_build_dir,
                             srcdir=other_src_dir)
            out = succeed(MAKE_CMD, cwd=other_build_dir)
            assert_exists(other_develspace_dir,
                          PYTHON_INSTALL_PATH + '/nav_msgs/msg/_GridCells.py',
                          'include/nav_msgs/GridCells.h')

            out = succeed(MAKE_CMD + ['install'], cwd=other_build_dir)

            assert_exists(self.installdir,
                          'include/geometry_msgs/PointStamped.h',
                          PYTHON_INSTALL_PATH + '/geometry_msgs/msg/_PointStamped.py',
                          'share/geometry_msgs/msg/PointStamped.msg',
                          # 'share/typelibxml/geometry_msgs/PointStamped.xml',
                          )
        finally:
            # pass
            shutil.rmtree(other_root_dir)
Beispiel #3
0
    def test_mock_against_installed(self):
        # uses core ros stacks installed in setUp
        # tries to build mock project in separate workspace
        try:
            # create another workspace than self.rootdir
            other_root_dir = tempfile.mkdtemp()
            other_src_dir = os.path.join(other_root_dir, 'src')
            create_catkin_workspace(other_src_dir)
            other_build_dir = os.path.join(other_root_dir, 'build')
            other_develspace_dir = os.path.join(other_build_dir, 'devel')
            other_install_dir = os.path.join(other_root_dir, 'install')
            shutil.copytree(os.path.join(MOCK_DIR, 'src', 'catkin_test'),
                            os.path.join(other_src_dir, 'catkin_test'))
            self.cmake(cwd=other_build_dir,
                       srcdir=other_src_dir,
                       installdir=other_install_dir)
            succeed(MAKE_CMD, cwd=other_build_dir)

            assert_exists(other_develspace_dir,
                          "lib/liba.so",
                          "lib/libb.so",
                          "lib/libc-one.so",
                          "lib/libc-two.so",
                          "lib/libd.so")
            assert_exists(other_build_dir,
                          # "bin/nolangs_exec",
                          "catkin_test/quux_user/bin/quux_srv-exec")
            assert_exists(other_develspace_dir,
                          PYTHON_INSTALL_PATH + "/a",
                          # PYTHON_INSTALL_PATH + "/b",
                          # PYTHON_INSTALL_PATH + "/c",
                          # PYTHON_INSTALL_PATH + "/d",
                          PYTHON_INSTALL_PATH + "/a/__init__.py",
                          PYTHON_INSTALL_PATH + "/quux_msgs/__init__.py")

            # "DESTDIR="
            succeed(MAKE_CMD + ["install"],
                    cwd=other_build_dir)

            assert_exists(other_install_dir,
                          "lib/pkgconfig/a.pc",
                          "lib/pkgconfig/b.pc",
                          "lib/pkgconfig/c.pc",
                          "lib/pkgconfig/d.pc",
                          "lib/pkgconfig/quux_msgs.pc",
                          PYTHON_INSTALL_PATH + "/a/__init__.py",
                          PYTHON_INSTALL_PATH + "/quux_msgs/__init__.py")

            #
            #  make sure python imports work
            #

            # succeed([other_build_dir + "/env.sh", "python -c 'import a'"])
            # succeed([other_build_dir + "/env.sh", "python -c 'import b'"])
        finally:
            # pass
            shutil.rmtree(other_root_dir)
Beispiel #4
0
    def test_mock_against_installed(self):
        # uses core ros stacks installed in setUp
        # tries to build mock project in separate workspace
        try:
            # create another workspace than self.rootdir
            other_root_dir = tempfile.mkdtemp()
            other_src_dir = os.path.join(other_root_dir, 'src')
            create_catkin_workspace(other_src_dir)
            other_build_dir = os.path.join(other_root_dir, 'build')
            other_buildspace_dir = os.path.join(other_build_dir, 'buildspace')
            other_install_dir = os.path.join(other_root_dir, 'install')
            shutil.copytree(os.path.join(MOCK_DIR, 'src', 'catkin_test'),
                            os.path.join(other_src_dir, 'catkin_test'))
            self.cmake(cwd=other_build_dir,
                       srcdir=other_src_dir,
                       installdir=other_install_dir)
            succeed(MAKE_CMD, cwd=other_build_dir)

            assert_exists(other_buildspace_dir,
                          "lib/liba.so",
                          "lib/libb.so",
                          "lib/libc-one.so",
                          "lib/libc-two.so",
                          "lib/libd.so")
            assert_exists(other_build_dir,
                          # "bin/nolangs_exec",
                          "catkin_test/quux_user/bin/quux_srv-exec")
            assert_exists(other_buildspace_dir,
                          PYTHON_INSTALL_PATH + "/a",
                          # PYTHON_INSTALL_PATH + "/b",
                          # PYTHON_INSTALL_PATH + "/c",
                          # PYTHON_INSTALL_PATH + "/d",
                          PYTHON_INSTALL_PATH + "/a/__init__.py",
                          PYTHON_INSTALL_PATH + "/quux_msgs/__init__.py")

            # "DESTDIR="
            succeed(MAKE_CMD + ["install"],
                    cwd=other_build_dir)

            assert_exists(other_install_dir,
                          "lib/pkgconfig/a.pc",
                          "lib/pkgconfig/b.pc",
                          "lib/pkgconfig/c.pc",
                          "lib/pkgconfig/d.pc",
                          "lib/pkgconfig/quux_msgs.pc",
                          PYTHON_INSTALL_PATH + "/a/__init__.py",
                          PYTHON_INSTALL_PATH + "/quux_msgs/__init__.py")

            #
            #  make sure python imports work
            #

            # succeed([other_build_dir + "/env.sh", "python -c 'import a'"])
            # succeed([other_build_dir + "/env.sh", "python -c 'import b'"])
        finally:
            # pass
            shutil.rmtree(other_root_dir)
    def test_catkin_only(self):
        self.cmake()
        succeed(MAKE_CMD, cwd=self.builddir)
        succeed(MAKE_CMD + ["install"], cwd=self.builddir)

        assert_exists(self.installdir,
                      "env.sh",
                      "setup.sh",
                      "setup.zsh")
Beispiel #6
0
    def test_catkin_only(self):
        self.cmake()
        succeed(MAKE_CMD, cwd=self.builddir)
        succeed(MAKE_CMD + ["install"], cwd=self.builddir)

        assert_exists(self.installdir,
                      "env.sh",
                      "setup.sh",
                      "setup.zsh")
Beispiel #7
0
    def test_catkin_only(self):
        self.cmake()
        succeed(MAKE_CMD, cwd=self.builddir)
        succeed(MAKE_CMD + ['install'], cwd=self.builddir)

        assert_exists(self.installdir,
                      'env.sh',
                      'setup.sh',
                      'setup.zsh')
    def test_linker_options_propagation(self):
        dstdir = os.path.join(self.workspacedir, 'linker_options')
        shutil.copytree(os.path.join(MOCK_DIR, 'src', 'linker_options'),
                        dstdir)
        self.cmake()
        succeed(MAKE_CMD, cwd=self.builddir)
        succeed(MAKE_CMD + ['install'], cwd=self.builddir)

        assert_exists(self.installdir, 'env.sh', 'setup.sh', 'setup.zsh')
Beispiel #9
0
    def setUp(self):
        super(SimpleUnstableTest, self).setUp()
        # a bit dirty here, tester needs to manually delete
        # test/tmp/unstable_test/build folder. But else, tests take
        # too long
        if not os.path.exists(os.path.join(self.builddir, "Makefile")):
            self.cmake()
        # if make fails due to DistributionNotFound,
        # tester needs to manually delete test/tmp/unstable_test/src
        succeed(MAKE_CMD, cwd=self.builddir)

        succeed(MAKE_CMD + ["install"], cwd=self.builddir)
Beispiel #10
0
    def setUp(self):
        super(SimpleUnstableTest, self).setUp()
        # a bit dirty here, tester needs to manually delete
        # test/tmp/unstable_test/build folder. But else, tests take
        # too long
        if not os.path.exists(os.path.join(self.builddir, "Makefile")):
            self.cmake()
        # if make fails due to DistributionNotFound,
        # tester needs to manually delete test/tmp/unstable_test/src
        succeed(MAKE_CMD, cwd=self.builddir)

        succeed(MAKE_CMD + ["install"], cwd=self.builddir)
    def test_nolang(self):
        dstdir = os.path.join(self.workspacedir, 'nolangs')
        shutil.copytree(os.path.join(MOCK_DIR, 'src', 'nolangs'), dstdir)

        out = self.cmake(CATKIN_WHITELIST_PACKAGES='nolangs',
                         CATKIN_DPKG_BUILDPACKAGE_FLAGS='-d;-S;-us;-uc')
        self.assertTrue(os.path.exists(self.builddir + "/nolangs"))
        self.assertFalse(os.path.exists(self.builddir + "/std_msgs"))
        self.assertFalse(os.path.exists(self.builddir + "/genmsg"))
        out = succeed(MAKE_CMD, cwd=self.builddir)
        self.assertTrue(
            os.path.exists(self.builddir + "/nolangs/bin/nolangs_exec"))
        out = succeed(MAKE_CMD + ["install"], cwd=self.builddir)

        assert_exists(self.installdir, "bin/nolangs_exec",
                      "share/nolangs/cmake/nolangsConfig.cmake")

        # also test make help
        succeed(MAKE_CMD + ["help"], cwd=self.builddir)
    def test_nolang(self):
        dstdir = os.path.join(self.workspacedir, 'nolangs')
        shutil.copytree(os.path.join(MOCK_DIR, 'src', 'nolangs'), dstdir)

        out = self.cmake(CATKIN_WHITELIST_STACKS='nolangs',
                         CATKIN_DPKG_BUILDPACKAGE_FLAGS='-d;-S;-us;-uc')
        self.assertTrue(os.path.exists(self.builddir + "/nolangs"))
        self.assertFalse(os.path.exists(self.builddir + "/std_msgs"))
        self.assertFalse(os.path.exists(self.builddir + "/genmsg"))
        out = succeed(MAKE_CMD, cwd=self.builddir)
        self.assertTrue(os.path.exists(self.builddir + "/nolangs/bin/nolangs_exec"))
        out = succeed(MAKE_CMD + ["install"], cwd=self.builddir)

        assert_exists(self.installdir,
                      "bin/nolangs_exec",
                      "share/nolangs/cmake/nolangsConfig.cmake")

        # also test make help
        succeed(MAKE_CMD + ["help"], cwd=self.builddir)
    def test_noproject(self):
        # create workspace with just catkin and 'noproject' project
        dstdir = os.path.join(self.workspacedir, 'noproject')
        shutil.copytree(os.path.join(MOCK_DIR, 'src-fail', 'noproject'), dstdir)
        # test with whitelist
        out = self.cmake(CATKIN_WHITELIST_PACKAGES='catkin')
        out = succeed(MAKE_CMD + ["install"], cwd=self.builddir)

        shutil.rmtree(self.builddir)
        # fail if we try to build noproject stack
        os.makedirs(self.builddir)

        out = self.cmake(CMAKE_PREFIX_PATH=self.installdir,
                         expect=fail)
        print("failed as expected, out=", out)

        self.assertTrue("catkin_package() PROJECT_NAME is set to 'Project'" in out, out)
Beispiel #14
0
    def test_noproject(self):
        # create workspace with just catkin and 'noproject' project
        dstdir = os.path.join(self.workspacedir, 'noproject')
        shutil.copytree(os.path.join(MOCK_DIR, 'src-fail', 'noproject'), dstdir)
        # test with whitelist
        out = self.cmake(CATKIN_WHITELIST_PACKAGES='catkin')
        out = succeed(MAKE_CMD + ["install"], cwd=self.builddir)

        shutil.rmtree(self.builddir)
        # fail if we try to build noproject stack
        os.makedirs(self.builddir)

        out = self.cmake(CMAKE_PREFIX_PATH=self.installdir,
                         expect=fail)
        print("failed as expected, out=", out)

        assert 'catkin_project() CATKIN_CURRENT_PACKAGE is not set.' in out
    def test_noproject(self):
        # create workspace with just catkin and 'noproject' project
        dstdir = os.path.join(self.workspacedir, 'noproject')
        shutil.copytree(os.path.join(MOCK_DIR, 'src-fail', 'noproject'), dstdir)
        # test with whitelist
        out = self.cmake(CATKIN_WHITELIST_STACKS='catkin')
        out = succeed(MAKE_CMD + ["install"], cwd=self.builddir)

        shutil.rmtree(self.builddir)
        # fail if we try to build noproject stack
        os.makedirs(self.builddir)

        out = self.cmake(CMAKE_PREFIX_PATH=self.installdir,
                         expect=fail)
        print("failed as expected, out=", out)

        assert 'catkin_project() CATKIN_CURRENT_STACK is not set.' in out
Beispiel #16
0
    def test_noproject(self):
        # create workspace with just catkin and 'noproject' project
        dstdir = os.path.join(self.workspacedir, 'noproject')
        shutil.copytree(os.path.join(MOCK_DIR, 'src-fail', 'noproject'), dstdir)
        # test with whitelist
        out = self.cmake(CATKIN_WHITELIST_PACKAGES='catkin')
        out = succeed(MAKE_CMD + ['install'], cwd=self.builddir)

        shutil.rmtree(self.builddir)
        # fail if we try to build noproject stack
        os.makedirs(self.builddir)

        out = self.cmake(CMAKE_PREFIX_PATH=self.installdir,
                         expect=fail)
        print('failed as expected, out={}'.format(out))

        self.assertTrue(b"catkin_package() PROJECT_NAME is set to 'Project'" in out, out)