def test_static_base_with_libc6_stage_packaged(self, mock_elf_patcher,
                                                   confinement):
        # The "bare" base is a static base.
        handler = load_part(
            "test-part",
            snap_type="app",
            base="bare",
            build_base="core",
            confinement=confinement,
        )

        patcher = PartPatcher(
            elf_files=frozenset(["foo"]),
            project=handler._project,
            snap_base_path="/snap/test-snap/current",
            stage_packages=["libc6"],
        )

        patcher.patch()

        mock_elf_patcher.assert_called_once_with(
            dynamic_linker=
            "/snap/test-snap/current/lib/x86_64-linux-gnu/ld-2.27.so",
            preferred_patchelf_path=None,
            root_path=handler._project.prime_dir,
        )
Beispiel #2
0
    def test_static_base_with_libc6_stage_packaged(self):
        # The "bare" base is a static base.
        snapcraft_yaml = fixture_setup.SnapcraftYaml(
            self.path, base="bare", confinement=self.confinement)
        snapcraft_yaml.update_part("part1", dict(plugin="nil"))
        self.useFixture(snapcraft_yaml)

        project = Project(
            snapcraft_yaml_file_path=snapcraft_yaml.snapcraft_yaml_file_path)

        patcher = PartPatcher(
            elf_files=frozenset(["foo"]),
            project=project,
            confinement="strict",
            core_base="bare",
            snap_base_path="/snap/test-snap/current",
            stage_packages=["libc6"],
            stagedir="stage",
            primedir="prime",
        )

        patcher.patch()

        self.fake_patchelf.mock.assert_called_once_with(
            dynamic_linker=
            "/snap/test-snap/current/lib/x86_64-linux-gnu/ld-2.27.so",
            preferred_patchelf_path=None,
            root_path="prime",
        )
    def test_no_base(self, mock_elf_patcher, confinement):
        handler = load_part(
            "test-part",
            snap_type="app",
            base=None,
            build_base="core",
            confinement=confinement,
        )

        patcher = PartPatcher(
            elf_files=frozenset(["foo"]),
            project=handler._project,
            snap_base_path="/snap/test-snap/current",
            stage_packages=[],
        )

        patcher.patch()

        mock_elf_patcher.assert_not_called()
Beispiel #4
0
    def test_static_base_without_libc6_stage_packaged(self):
        # The "bare" base is a static base, empty, so there is no linker loader to look for.
        handler = self.load_part(
            "test-part",
            snap_type="app",
            base="bare",
            build_base="core",
            confinement=self.confinement,
        )

        patcher = PartPatcher(
            elf_files=frozenset(["foo"]),
            project=handler._project,
            snap_base_path="/snap/test-snap/current",
            stage_packages=[],
        )

        patcher.patch()

        self.fake_patchelf.mock.assert_not_called()
Beispiel #5
0
    def test_static_base_without_libc6_stage_packaged(self):
        # The "bare" base is a static base, empty, so there is no linker loader to look for.
        snapcraft_yaml = fixture_setup.SnapcraftYaml(
            self.path, base="bare", confinement=self.confinement)
        snapcraft_yaml.update_part("part1", dict(plugin="nil"))
        self.useFixture(snapcraft_yaml)

        project = Project(
            snapcraft_yaml_file_path=snapcraft_yaml.snapcraft_yaml_file_path)

        patcher = PartPatcher(
            elf_files=frozenset(["foo"]),
            project=project,
            confinement="strict",
            core_base="bare",
            snap_base_path="/snap/test-snap/current",
            stage_packages=[],
            stagedir="stage",
            primedir="prime",
        )

        patcher.patch()

        self.fake_patchelf.mock.assert_not_called()