コード例 #1
0
    def test_build_purge_cmake(self):

        build_tool = build_tools.get_build_tool(BuildToolType.CMAKE)

        template_project_root_dir = os.path.dirname(cmake_template.__file__)

        toolchain = toolchains.get_tool_chain('native/identity',
                                              template_project_root_dir)

        build_dir = os.path.join(template_project_root_dir, 'build')
        install_dir = os.path.join(template_project_root_dir, 'install')

        build_tool.setup(project_root_dir=template_project_root_dir,
                         toolchain=toolchain,
                         build_type=BuildType.DEBUG)

        self.assertTrue(os.path.exists(build_dir))
        self.assertTrue(os.path.exists(install_dir))

        build_tool.purge(project_root_dir=template_project_root_dir,
                         toolchain=toolchain)

        build_dir = os.path.join(template_project_root_dir, 'build',
                                 toolchain.get_name())
        install_dir = os.path.join(template_project_root_dir, 'install',
                                   toolchain.get_name())

        self.assertFalse(os.path.exists(build_dir))
        self.assertFalse(os.path.exists(install_dir))
コード例 #2
0
 def setup(self,
           tool_type=BuildToolType.CMAKE,
           toolchain_name='native/identity',
           build_type=BuildType.DEBUG):
     project_root_dir = self.config.get_project_root_dir()
     toolchain = toolchains.get_tool_chain(toolchain_name, project_root_dir)
     build_tool = build_tools.get_build_tool(tool_type)
     build_tool.setup(project_root_dir, toolchain, build_type)
コード例 #3
0
 def test_get_wrapper_script_abs_path(self):
     toolchain = toolchains.get_tool_chain('native/identity')
     template_project_root_dir = os.path.dirname(cmake_template.__file__)
     self.assertEqual(
         toolchain.get_wrapper_script_abs_path(
             project_root_dir=template_project_root_dir),
         os.path.join(template_project_root_dir,
                      '.practci/bin/toolchains/native/linux/identity'))
コード例 #4
0
    def test_exec_command(self):
        toolchain = toolchains.get_tool_chain(
            'native/identity', os.path.dirname(cmake_template.__file__))

        template_project_root_dir = os.path.dirname(cmake_template.__file__)

        command_output_stream = io.StringIO()
        toolchain.exec_command(['echo', '-n', 'I am a master command!'],
                               project_root_dir=template_project_root_dir,
                               stdout=command_output_stream)

        self.assertEqual('I am a master command!',
                         command_output_stream.getvalue())
コード例 #5
0
    def test_build_setup_cmake(self):
        build_tool = build_tools.get_build_tool(BuildToolType.CMAKE)

        template_project_root_dir = os.path.dirname(cmake_template.__file__)

        toolchain = toolchains.get_tool_chain('native/identity',
                                              template_project_root_dir)

        build_tool.setup(
            project_root_dir=template_project_root_dir,
            toolchain=toolchain,
            build_type=BuildType.DEBUG,
        )

        build_dir = os.path.join(template_project_root_dir, 'build')

        self.assertTrue(os.path.exists(build_dir))
        self.assertTrue(os.path.isdir(build_dir))

        shutil.rmtree(build_dir)
コード例 #6
0
    def test_fail_exec_command(self):
        toolchain = toolchains.get_tool_chain(
            'native/identity', os.path.dirname(cmake_template.__file__))

        template_project_root_dir = os.path.dirname(cmake_template.__file__)

        command = os.path.join(os.path.dirname(scripts.__file__),
                               'fail_script.sh')

        command_err_stream = io.StringIO()

        try:
            toolchain.exec_command([command],
                                   project_root_dir=template_project_root_dir,
                                   stderr=command_err_stream)
        except toolchains.ToolChainExecFail:
            pass
        except Exception as ex:
            self.fail(ex)
        else:
            self.fail()

        self.assertEqual('I am a master error!', command_err_stream.getvalue())
コード例 #7
0
 def test_not_is_installed(self):
     toolchain = toolchains.get_tool_chain(
         'native/none', os.path.dirname(cmake_template.__file__))
     self.assertFalse(toolchain.is_installed())
コード例 #8
0
 def test_is_installed(self):
     toolchain = toolchains.get_tool_chain(
         'native/identity', os.path.dirname(cmake_template.__file__))
     self.assertTrue(toolchain.is_installed())
コード例 #9
0
 def test_get_wrapper_script_path(self):
     toolchain = toolchains.get_tool_chain('native/identity')
     self.assertIsNotNone(toolchain.get_wrapper_script_path())
     self.assertEqual(toolchain.get_wrapper_script_path(),
                      '.practci/bin/toolchains/native/linux/identity')
コード例 #10
0
 def test_get_wrapper_script_name(self):
     toolchain = toolchains.get_tool_chain('native/gcc')
     self.assertIsNotNone(toolchain.get_wrapper_script_name())
     self.assertEqual(toolchain.get_wrapper_script_name(), 'gcc')
コード例 #11
0
 def test_get_toolchain_channel(self):
     toolchain = toolchains.get_tool_chain('native/gcc')
     self.assertIsNotNone(toolchain.get_channel())
     self.assertEqual(toolchain.get_channel(), 'native')
コード例 #12
0
 def test_get_toolchain(self):
     toolchain = toolchains.get_tool_chain('native/gcc')
     self.assertIsNotNone(toolchain)