예제 #1
0
    def test_build_artifacts(self, link_or_copy_mock, link_or_copy_tree_mock,
                             run_mock):
        self.options.artifacts = ["dir_artifact", "file_artifact"]
        plugin = make.MakePlugin("test-part", self.options, self.project)

        os.makedirs(os.path.join(plugin.builddir, "dir_artifact"))

        plugin.build()

        self.assertThat(run_mock.call_count, Equals(1))
        run_mock.assert_has_calls([mock.call(["make", "-j2"], env=None)])
        self.assertThat(link_or_copy_mock.call_count, Equals(1))
        link_or_copy_mock.assert_has_calls([
            mock.call(
                os.path.join(plugin.builddir, "file_artifact"),
                os.path.join(plugin.installdir, "file_artifact"),
            )
        ])
        self.assertThat(link_or_copy_tree_mock.call_count, Equals(1))
        link_or_copy_tree_mock.assert_has_calls([
            mock.call(
                os.path.join(plugin.builddir, "dir_artifact"),
                os.path.join(plugin.installdir, "dir_artifact"),
            )
        ])
예제 #2
0
    def test_build_empty_install_var(self, run_mock):
        self.options.make_install_var = ""
        plugin = make.MakePlugin("test-part", self.options, self.project)
        os.makedirs(plugin.sourcedir)

        plugin.build()

        self.assertThat(run_mock.call_count, Equals(2))
        run_mock.assert_has_calls([
            mock.call(["make", "-j2"], env=None),
            mock.call(["make", "install"], env=None),
        ])
예제 #3
0
    def test_make_with_env(self, run_mock):
        plugin = make.MakePlugin("test-part", self.options, self.project)
        os.makedirs(plugin.sourcedir)

        env = {"foo": "bar"}
        plugin.make(env=env)

        self.assertThat(run_mock.call_count, Equals(2))
        run_mock.assert_has_calls([
            mock.call(["make", "-j2"], env=env),
            mock.call(
                ["make", "install", "DESTDIR={}".format(plugin.installdir)],
                env=env),
        ])
예제 #4
0
    def test_build(self, run_mock):
        plugin = make.MakePlugin("test-part", self.options, self.project)
        os.makedirs(plugin.sourcedir)

        plugin.build()

        self.assertThat(run_mock.call_count, Equals(2))
        run_mock.assert_has_calls([
            mock.call(["make", "-j2"], env=None),
            mock.call(
                ["make", "install", "DESTDIR={}".format(plugin.installdir)],
                env=None,
            ),
        ])
예제 #5
0
    def test_make_with_parameters(self, run_mock):
        """Ensure the targets comes before the parameters."""
        self.options.make_parameters = ["FOO=BAR"]
        plugin = make.MakePlugin("test-part", self.options, self.project)
        os.makedirs(plugin.sourcedir)

        plugin.make()

        self.assertThat(run_mock.call_count, Equals(2))
        run_mock.assert_has_calls([
            mock.call(["make", "-j2", "FOO=BAR"], env=None),
            mock.call(
                ["make", "install", "FOO=BAR", f"DESTDIR={plugin.installdir}"],
                env=None,
            ),
        ])