Skip to content

Commit

Permalink
test: add hackish riscv5 cross-build end-to-end test
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Feb 24, 2025
1 parent cc9e351 commit af169e1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN CGO_ENABLED=0 go build -tags "containers_image_openpgp exclude_graphdriver_b

FROM registry.fedoraproject.org/fedora:41

# podman mount needs this
RUN mkdir -p /etc/containers/networks
# Fast-track osbuild so we don't depend on the "slow" Fedora release process to implement new features in bib
RUN dnf install -y dnf-plugins-core \
&& dnf copr enable -y @osbuild/osbuild \
Expand Down
29 changes: 29 additions & 0 deletions test/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,32 @@ def test_container_with_progress(tmp_path, build_fake_container, progress, needl
], text=True)
assert needle in output
assert forbidden not in output


def test_container_cross_build_riscv64(tmp_path, build_container):
# XXX: we should encode this in images proper
# note that we need the "fedora-toolbox" container as the regular one
# does not contain python3
images_experimental_env = "IMAGES_EXPERIMENTAL=buildroot=ghcr.io/mvo5/fedora-buildroot:41"

# XXX: only here speed up builds by sharing downloaded stuff
os.makedirs("/var/cache/image-builder/store", exist_ok=True)
output_dir = tmp_path / "output"
output_dir.mkdir()
subprocess.check_call([
"podman", "run",
"--privileged",
"-v", "/var/lib/containers/storage:/var/lib/containers/storage",
"-v", "/var/cache/image-builder/store:/var/cache/image-builder/store",
"-v", f"{output_dir}:/output",
f"--env={images_experimental_env}",
build_container,
"build",
"--progress=verbose",
"--output-dir=/output",
"container",
"--arch=riscv64",
"--with-manifest",
"--distro", "fedora-41",
], text=True)
assert os.path.exists(output_dir / "container/container.tar")

0 comments on commit af169e1

Please sign in to comment.